fix: 新增V9迁移,商品表外键添加级联删除
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -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;
|
||||||
Reference in New Issue
Block a user