add product migrations
This commit is contained in:
parent
12f96c1514
commit
80f2d0e150
8
migrations/000069_add_outlet_id_to_products.down.sql
Normal file
8
migrations/000069_add_outlet_id_to_products.down.sql
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
-- Remove foreign key constraint
|
||||||
|
ALTER TABLE products DROP CONSTRAINT IF EXISTS fk_products_outlet;
|
||||||
|
|
||||||
|
-- Remove index
|
||||||
|
DROP INDEX IF EXISTS idx_products_outlet_id;
|
||||||
|
|
||||||
|
-- Remove outlet_id column
|
||||||
|
ALTER TABLE products DROP COLUMN IF EXISTS outlet_id;
|
||||||
8
migrations/000069_add_outlet_id_to_products.up.sql
Normal file
8
migrations/000069_add_outlet_id_to_products.up.sql
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
-- Add nullable outlet_id column to products table
|
||||||
|
ALTER TABLE products ADD COLUMN outlet_id UUID;
|
||||||
|
|
||||||
|
-- Create index on outlet_id for faster queries
|
||||||
|
CREATE INDEX idx_products_outlet_id ON products (outlet_id);
|
||||||
|
|
||||||
|
-- Add foreign key constraint
|
||||||
|
ALTER TABLE products ADD CONSTRAINT fk_products_outlet FOREIGN KEY (outlet_id) REFERENCES outlets(id) ON DELETE SET NULL;
|
||||||
Loading…
x
Reference in New Issue
Block a user