All checks were successful
Deploy production / deploy (push) Successful in 1m7s
13 lines
1.1 KiB
SQL
13 lines
1.1 KiB
SQL
ALTER TABLE "groceries"."groups" ADD COLUMN "is_food" boolean DEFAULT true NOT NULL;--> statement-breakpoint
|
|
ALTER TABLE "groceries"."items" ADD COLUMN "is_food" boolean DEFAULT true NOT NULL;--> statement-breakpoint
|
|
-- New stores (Plus already exists): Xenos and Amazing Oriental (orientalwebshop.nl).
|
|
INSERT INTO "groceries"."stores" ("slug", "name", "website", "color", "sort_order") VALUES
|
|
('xenos', 'Xenos', 'https://www.xenos.nl', '#e6007e', 50),
|
|
('amazing-oriental', 'Amazing Oriental', 'https://www.orientalwebshop.nl/nl/', '#2e7d32', 60)
|
|
ON CONFLICT ("slug") DO NOTHING;--> statement-breakpoint
|
|
-- Existing AH/Jumbo items: drugstore and household are not food (the importer keeps this current).
|
|
UPDATE "groceries"."items" SET "is_food" = false WHERE "category" IN ('Drogisterij', 'Huishouden & dieren');--> statement-breakpoint
|
|
UPDATE "groceries"."groups" g SET "is_food" = false
|
|
WHERE NOT EXISTS (SELECT 1 FROM "groceries"."items" i WHERE i.group_id = g.id AND i.available AND i.is_food)
|
|
AND EXISTS (SELECT 1 FROM "groceries"."items" i WHERE i.group_id = g.id AND i.available);
|