add more stuff
This commit is contained in:
@@ -7,7 +7,7 @@ CREATE TABLE "inventory_products" (
|
||||
UNIQUE (name)
|
||||
);
|
||||
|
||||
CREATE TABLE "inventory_items_tmp"
|
||||
CREATE TABLE "inventory_items_tmp" (
|
||||
id VARCHAR(36) NOT NULL,
|
||||
name TEXT NOT NULL,
|
||||
description TEXT,
|
||||
@@ -16,8 +16,12 @@ CREATE TABLE "inventory_items_tmp"
|
||||
product_id VARCHAR(36),
|
||||
PRIMARY KEY (id),
|
||||
FOREIGN KEY (category_id) REFERENCES inventory_items_categories(id)
|
||||
FOREIGN KEY (product_id) REFERENCES inventory_products(id);
|
||||
)
|
||||
FOREIGN KEY (product_id) REFERENCES inventory_products(id)
|
||||
);
|
||||
|
||||
INSERT INTO inventory_items_tmp SELECT *, NULL as product_id FROM inventory_items;
|
||||
|
||||
/* DROP TABLE inventory_items; */
|
||||
|
||||
/* ALTER TABLE "inventory_items_tmp" RENAME TO inventory_items; */
|
||||
|
||||
ALTER TABLE "inventory_items"
|
||||
FOREIGN KEY (product_id) REFERENCES inventory_products(id);
|
||||
|
||||
0
rust/migrations/20230523212341_finalize.sql
Normal file
0
rust/migrations/20230523212341_finalize.sql
Normal file
3
rust/migrations/20230523221247_finalize2.sql
Normal file
3
rust/migrations/20230523221247_finalize2.sql
Normal file
@@ -0,0 +1,3 @@
|
||||
DROP TABLE inventory_items;
|
||||
|
||||
ALTER TABLE "inventory_items_tmp" RENAME TO inventory_items;
|
||||
Reference in New Issue
Block a user