Werk hoofdapplicatie bij
Legt de bestaande wijzigingen in de hoofdworktree vast voordat de laatste worktree wordt gemerged.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
+23
-33
@@ -49,16 +49,29 @@ const products = [
|
||||
];
|
||||
|
||||
|
||||
const insertCategory = db.prepare(`
|
||||
|
||||
INSERT INTO categories (name, icon)
|
||||
SELECT ?, ?
|
||||
WHERE NOT EXISTS (SELECT 1 FROM categories WHERE name = ?)
|
||||
|
||||
`);
|
||||
|
||||
const seedCategories = db.transaction(() => {
|
||||
|
||||
for (const category of categories) {
|
||||
insertCategory.run(category[0], category[1], category[0]);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
seedCategories();
|
||||
|
||||
const insertProduct = db.prepare(`
|
||||
|
||||
INSERT OR IGNORE INTO products
|
||||
|
||||
(
|
||||
name,
|
||||
category_id
|
||||
)
|
||||
|
||||
VALUES (?,?)
|
||||
INSERT INTO products (name, category_id)
|
||||
SELECT ?, ?
|
||||
WHERE NOT EXISTS (SELECT 1 FROM products WHERE name = ?)
|
||||
|
||||
`);
|
||||
|
||||
@@ -70,7 +83,7 @@ const seedProducts = db.transaction(() => {
|
||||
|
||||
for(const product of products){
|
||||
|
||||
insertProduct.run(product);
|
||||
insertProduct.run(product[0], product[1], product[0]);
|
||||
|
||||
}
|
||||
|
||||
@@ -80,28 +93,5 @@ const seedProducts = db.transaction(() => {
|
||||
|
||||
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.");
|
||||
console.log("Seed voltooid.");
|
||||
|
||||
Reference in New Issue
Block a user