mirror of
				https://github.com/grocy/grocy.git
				synced 2025-10-31 18:49:38 +00:00 
			
		
		
		
	
		
			
	
	
		
			11 lines
		
	
	
		
			416 B
		
	
	
	
		
			MySQL
		
	
	
	
	
	
		
		
			
		
	
	
			11 lines
		
	
	
		
			416 B
		
	
	
	
		
			MySQL
		
	
	
	
	
	
|   | CREATE TRIGGER enfore_product_nesting_level BEFORE UPDATE ON products
 | ||
|  | BEGIN
 | ||
|  | 	-- Currently only 1 level is supported
 | ||
|  |     SELECT CASE WHEN((
 | ||
|  |         SELECT 1
 | ||
|  |         FROM products p
 | ||
|  |         WHERE IFNULL(NEW.parent_product_id, '') != ''
 | ||
|  |             AND IFNULL(parent_product_id, '') = NEW.id
 | ||
|  |     ) NOTNULL) THEN RAISE(ABORT, "Unsupported product nesting level detected (currently only 1 level is supported)") END;
 | ||
|  | END;
 |