From cfcb85012404f4045b43da662d61814cd842a587 Mon Sep 17 00:00:00 2001 From: Eunhak Lee <lee@enak.kr> Date: Tue, 3 Dec 2024 18:09:54 +0900 Subject: [PATCH] =?UTF-8?q?chore(db):=20transaction=20=ED=85=8C=EC=9D=B4?= =?UTF-8?q?=EB=B8=94=20=EB=8F=84=EC=9E=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- init/sql/init.sql | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/init/sql/init.sql b/init/sql/init.sql index e8a06a7..b3d775a 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", -- GitLab