15 lines
438 B
SQL
15 lines
438 B
SQL
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;
|