db: add more tables
This commit is contained in:
@ -0,0 +1,2 @@
|
||||
CREATE TABLE "transaction";
|
||||
|
@ -0,0 +1,14 @@
|
||||
CREATE TABLE "transaction" (
|
||||
"id" serial NOT NULL,
|
||||
PRIMARY KEY ("id"),
|
||||
"expense_id" integer NOT NULL,
|
||||
"user_id" integer NOT NULL,
|
||||
"amount" integer NOT NULL,
|
||||
"currency" character varying(255) NOT NULL,
|
||||
"is_income" boolean NOT NULL DEFAULT FALSE,
|
||||
"created_at" date NOT NULL,
|
||||
"updated_at" date NOT NULL
|
||||
);
|
||||
|
||||
ALTER TABLE "transaction"
|
||||
ADD FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
@ -0,0 +1 @@
|
||||
DROP TABLE "expense";
|
@ -0,0 +1,14 @@
|
||||
CREATE TABLE "expense" (
|
||||
"id" serial NOT NULL,
|
||||
PRIMARY KEY ("id"),
|
||||
"created_at" date NOT NULL,
|
||||
"updated_at" date NOT NULL,
|
||||
"amount" integer NOT NULL,
|
||||
"currency" character varying NOT NULL,
|
||||
"event_id" integer NOT NULL,
|
||||
"name" integer NULL,
|
||||
"place" integer NULL
|
||||
);
|
||||
|
||||
ALTER TABLE "expense"
|
||||
ADD FOREIGN KEY ("event_id") REFERENCES "event" ("id") ON DELETE CASCADE ON UPDATE CASCADE
|
@ -0,0 +1,2 @@
|
||||
ALTER TABLE "transaction"
|
||||
ADD FOREIGN KEY ("expense_id") REFERENCES "expense" ("id") ON DELETE CASCADE ON UPDATE CASCADE
|
Reference in New Issue
Block a user