Fix schema
This commit is contained in:
16
postgres/schema/0009_transactions.sql
Normal file
16
postgres/schema/0009_transactions.sql
Normal file
@ -0,0 +1,16 @@
|
||||
-- +goose Up
|
||||
CREATE TABLE transactions (
|
||||
id uuid DEFAULT uuid_generate_v4() PRIMARY KEY,
|
||||
date date NOT NULL,
|
||||
memo text NOT NULL,
|
||||
amount decimal(12,2) NOT NULL,
|
||||
account_id uuid NOT NULL REFERENCES accounts (id),
|
||||
category_id uuid REFERENCES categories (id),
|
||||
payee_id uuid REFERENCES payees (id)
|
||||
);
|
||||
ALTER TABLE "transactions" ADD FOREIGN KEY ("account_id") REFERENCES "accounts" ("id");
|
||||
ALTER TABLE "transactions" ADD FOREIGN KEY ("payee_id") REFERENCES "payees" ("id");
|
||||
ALTER TABLE "transactions" ADD FOREIGN KEY ("category_id") REFERENCES "categories" ("id");
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE transactions;
|
Reference in New Issue
Block a user