Files
apskel-pos-backend/migrations/000086_make_ingredients_unit_id_nullable.down.sql
T

7 lines
278 B
SQL
Raw Normal View History

2026-08-11 21:20:17 +07:00
-- Restoring NOT NULL fails if any ingredient still has a NULL unit_id. Assign a
-- unit to those rows first:
-- SELECT id, name FROM ingredients WHERE unit_id IS NULL;
COMMENT ON COLUMN ingredients.unit_id IS NULL;
ALTER TABLE ingredients ALTER COLUMN unit_id SET NOT NULL;