mirror of
				https://github.com/grocy/grocy.git
				synced 2025-10-31 18:49:38 +00:00 
			
		
		
		
	
		
			
	
	
		
			10 lines
		
	
	
		
			271 B
		
	
	
	
		
			MySQL
		
	
	
	
	
	
		
		
			
		
	
	
			10 lines
		
	
	
		
			271 B
		
	
	
	
		
			MySQL
		
	
	
	
	
	
|   | 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);
 |