Archive old migrations (#426)

* Archive old migrations

* Fix invalid placement of migrations
This commit is contained in:
Rikard Bartholf
2024-10-17 11:19:12 +02:00
committed by GitHub
parent 763262c108
commit ddcbd0afb0
500 changed files with 0 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
-- Drop what is created below for developer convenience
DROP TABLE IF EXISTS paint_card_samples;
-- Create paint primer table structure
-- Create paint_primer table
CREATE TABLE paint_card_samples (
id INTEGER GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
paint_id INTEGER NOT NULL REFERENCES paint(id),
stock INTEGER NOT NULL DEFAULT 0,
created timestamp with time zone NOT NULL DEFAULT now(),
updated timestamp with time zone DEFAULT NULL
);
CREATE TRIGGER updated_timestamp BEFORE UPDATE ON paint_card_samples FOR EACH ROW EXECUTE PROCEDURE updated_timestamp();
-- For each paint row add a paint_card_sample row with stock 1
INSERT INTO paint_card_samples (paint_id, stock) SELECT id, 1 FROM paint;