22 lines
693 B
SQL
22 lines
693 B
SQL
-- reset_products.sql
|
|
-- Rensar all produktdata och relaterade tabeller.
|
|
-- Behåller: User, Category (med seed-data), Recipe, MealPlanEntry, RecipeShare
|
|
-- Kör: docker exec -i recipe-db mariadb -u recipe_user -pSITT_LÖSENORD recipe_db < db/reset_products.sql
|
|
|
|
SET FOREIGN_KEY_CHECKS = 0;
|
|
|
|
TRUNCATE TABLE `ReceiptAlias`;
|
|
TRUNCATE TABLE `InventoryConsumption`;
|
|
TRUNCATE TABLE `InventoryItem`;
|
|
TRUNCATE TABLE `PantryItem`;
|
|
TRUNCATE TABLE `Nutrition`;
|
|
TRUNCATE TABLE `ProductTag`;
|
|
TRUNCATE TABLE `Tag`;
|
|
TRUNCATE TABLE `UserProduct`;
|
|
TRUNCATE TABLE `RecipeIngredient`;
|
|
TRUNCATE TABLE `Product`;
|
|
|
|
SET FOREIGN_KEY_CHECKS = 1;
|
|
|
|
SELECT 'Klar! Produktdata borttagen.' AS status;
|