fix: 新增V9迁移,商品表外键添加级联删除
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Agent
2026-03-31 16:05:31 +00:00
parent 5750adeb03
commit 3f7f6f8c32

View File

@@ -0,0 +1,12 @@
-- 修改商品表外键约束,级联删除
ALTER TABLE stock DROP CONSTRAINT IF EXISTS stock_product_id_fkey;
ALTER TABLE stock ADD CONSTRAINT stock_product_id_fkey
FOREIGN KEY (product_id) REFERENCES products(product_id) ON DELETE CASCADE;
ALTER TABLE stock_flow DROP CONSTRAINT IF EXISTS stock_flow_product_id_fkey;
ALTER TABLE stock_flow ADD CONSTRAINT stock_flow_product_id_fkey
FOREIGN KEY (product_id) REFERENCES products(product_id) ON DELETE CASCADE;
ALTER TABLE order_items DROP CONSTRAINT IF EXISTS order_items_product_id_fkey;
ALTER TABLE order_items ADD CONSTRAINT order_items_product_id_fkey
FOREIGN KEY (product_id) REFERENCES products(product_id) ON DELETE CASCADE;