feat(database): add script to reset product data and related tables
This commit is contained in:
@@ -0,0 +1,21 @@
|
|||||||
|
-- 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;
|
||||||
Reference in New Issue
Block a user