diff --git a/init/sql/init.sql b/init/sql/init.sql index e8a06a7608c7b0af29ac378713115c9e13a2eb04..b3d775aacd1e9ba4797ee2920f59c1645e74167a 100644 --- a/init/sql/init.sql +++ b/init/sql/init.sql @@ -1,5 +1,6 @@ DROP ROLE IF EXISTS wsd; CREATE USER wsd WITH PASSWORD 'wsdpass1234'; +ALTER USER wsd SUPERUSER; CREATE TABLE users ( id SERIAL NOT NULL PRIMARY KEY, /* SERIAL is denoted as INTEGER when referencing */ @@ -38,6 +39,16 @@ CREATE TABLE relations ( CONSTRAINT relation_part_id REFERENCES "parts" ); +CREATE TABLE transactions ( + id CHAR(12) NOT NULL, + user_id INTEGER NOT NULL, + CONSTRAINT transaction_user_id REFERENCES "users", + combination_id INTEGER NULL, + CONSTRAINT transaction_combination_id REFERENCES "combinations", + created_at TIMESTAMP NOT NULL DEFAULT NOW(), + updated_at TIMESTAMP NOT NULL DEFAULT NOW(), +); + CREATE TABLE part_info_cpu ( part_id INTEGER NOT NULL CONSTRAINT cpu_part_id REFERENCES "parts",