db: add migrations
This commit is contained in:
parent
86832cf1f9
commit
39eaae46d8
@ -0,0 +1 @@
|
|||||||
|
DROP TABLE "event"
|
10
migrations/20241017215433_create_event_table.postgres.up.sql
Normal file
10
migrations/20241017215433_create_event_table.postgres.up.sql
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
CREATE TABLE "event" (
|
||||||
|
"id" serial NOT NULL,
|
||||||
|
PRIMARY KEY ("id"),
|
||||||
|
"name" character varying(255) NOT NULL,
|
||||||
|
"description" character varying(10000) NULL,
|
||||||
|
"default_currency" character varying(255) NOT NULL,
|
||||||
|
"owner_id" integer NOT NULL,
|
||||||
|
"created_at" date NOT NULL,
|
||||||
|
"updated_at" date NOT NULL
|
||||||
|
);
|
@ -0,0 +1 @@
|
|||||||
|
DROP TABLE participation;
|
@ -0,0 +1,16 @@
|
|||||||
|
CREATE TABLE "participation" (
|
||||||
|
"id" serial NOT NULL,
|
||||||
|
PRIMARY KEY ("id"),
|
||||||
|
"user_id" integer NOT NULL,
|
||||||
|
"event_id" integer NOT NULL,
|
||||||
|
"invited_by_user_id" integer NULL,
|
||||||
|
"created_at" date NOT NULL,
|
||||||
|
"updated_at" date NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
ALTER TABLE "participation"
|
||||||
|
ADD FOREIGN KEY ("event_id") REFERENCES "event" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
ALTER TABLE "participation"
|
||||||
|
ADD FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||||
|
|
@ -0,0 +1,2 @@
|
|||||||
|
ALTER TABLE "event"
|
||||||
|
ADD "total_amount" integer NULL;
|
Loading…
Reference in New Issue
Block a user