mirror of
				https://github.com/grocy/grocy.git
				synced 2025-11-04 05:15:08 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			10 lines
		
	
	
		
			271 B
		
	
	
	
		
			SQL
		
	
	
	
	
	
			
		
		
	
	
			10 lines
		
	
	
		
			271 B
		
	
	
	
		
			SQL
		
	
	
	
	
	
CREATE TRIGGER remove_recipe_from_meal_plans AFTER DELETE ON recipes
 | 
						|
BEGIN
 | 
						|
	DELETE FROM meal_plan
 | 
						|
	WHERE recipe_id = OLD.id;
 | 
						|
END;
 | 
						|
 | 
						|
-- Delete all recipes from the meal plan which doesn't exist anymore
 | 
						|
DELETE FROM meal_plan
 | 
						|
WHERE recipe_id NOT IN (SELECT id FROM recipes);
 |