add more stuff

This commit is contained in:
2023-08-29 21:34:00 +02:00
parent 894e59d862
commit aac192eb97
11 changed files with 872 additions and 214 deletions

View File

@@ -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);

View File

@@ -0,0 +1,3 @@
DROP TABLE inventory_items;
ALTER TABLE "inventory_items_tmp" RENAME TO inventory_items;