update db
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
f4523de5a4
commit
2078e008f3
|
@ -2,6 +2,7 @@
|
|||
-- +goose StatementBegin
|
||||
CREATE TABLE IF NOT EXISTS budgets (
|
||||
id SERIAL PRIMARY KEY,
|
||||
name TEXT NOT NULL,
|
||||
start_day INT NOT NULL,
|
||||
created_at TIMESTAMP
|
||||
);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
CREATE TABLE IF NOT EXISTS categories (
|
||||
id SERIAL PRIMARY KEY,
|
||||
name TEXT NOT NULL,
|
||||
budget_id INT REFERENCES budgets(id),
|
||||
budget_id INT REFERENCES budgets(id) ON DELETE CASCADE,
|
||||
favorite BOOLEAN DEFAULT FALSE,
|
||||
monthly_limit INT DEFAULT 0,
|
||||
UNIQUE (budget_id, name),
|
|
@ -5,6 +5,8 @@ CREATE TABLE IF NOT EXISTS positions (
|
|||
name TEXT NOT NULL,
|
||||
price INT NOT NULL,
|
||||
amount FLOAT NOT NULL,
|
||||
budget_id INT REFERENCES budgets(id) ON DELETE CASCADE,
|
||||
category_id INT REFERENCES categories(id) ON DELETE RESTRICT,
|
||||
created_at TIMESTAMP
|
||||
);
|
||||
-- +goose StatementEnd
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
-- +goose Up
|
||||
-- +goose StatementBegin
|
||||
CREATE TABLE IF NOT EXISTS users_budgets (
|
||||
id SERIAL PRIMARY KEY,
|
||||
user_id INT REFERENCES users(id) ON DELETE CASCADE,
|
||||
budget_id INT REFERENCES budgets(id) ON DELETE RESTRICT,
|
||||
created_at TIMESTAMP
|
||||
);
|
||||
-- +goose StatementEnd
|
||||
|
||||
-- +goose Down
|
||||
-- +goose StatementBegin
|
||||
DROP TABLE IF EXISTS users_budgets;
|
||||
-- +goose StatementEnd
|
Loading…
Reference in New Issue