require("dotenv").config(); const db = require("../config/database"); const categories = [ ["Groente", "๐Ÿฅฌ"], ["Fruit", "๐ŸŽ"], ["Zuivel", "๐Ÿฅ›"], ["Brood", "๐Ÿž"], ["Dranken", "๐Ÿฅค"], ["Huishouden", "๐Ÿงป"] ]; const products = [ [ "Melk", 3 ], [ "Bananen", 2 ], [ "Brood", 4 ], [ "Koffie", 5 ], [ "WC papier", 6 ] ]; const insertProduct = db.prepare(` INSERT OR IGNORE INTO products ( name, category_id ) VALUES (?,?) `); const seedProducts = db.transaction(() => { for(const product of products){ insertProduct.run(product); } }); seedProducts(); const insert = db.prepare(` INSERT OR IGNORE INTO categories (name, icon) VALUES (?,?) `); const seed = db.transaction(() => { for (const category of categories) { insert.run(category); } }); seed(); console.log("Seed voltooid.");