database for seed

This commit is contained in:
Jake Kasper
2025-09-03 12:02:27 -04:00
parent b62db962fd
commit 46e2ee3d7b
2 changed files with 23 additions and 4 deletions

View File

@@ -0,0 +1,15 @@
-- Expand allowed values for user_products.custom_product_type to include seed and powder
DO $$
DECLARE cname text;
BEGIN
SELECT conname INTO cname
FROM pg_constraint
WHERE conrelid = 'user_products'::regclass AND contype='c' AND conname LIKE '%custom_product_type%';
IF cname IS NOT NULL THEN
EXECUTE format('ALTER TABLE user_products DROP CONSTRAINT %I', cname);
END IF;
END $$;
ALTER TABLE user_products
ADD CONSTRAINT user_products_custom_product_type_check CHECK (custom_product_type IN ('granular','liquid','seed','powder'));