Add income_category_id only after categories table exists
This commit is contained in:
parent
208ffce968
commit
8b6a8c3697
@ -2,8 +2,7 @@
|
||||
CREATE TABLE budgets (
|
||||
id uuid DEFAULT uuid_generate_v4() PRIMARY KEY,
|
||||
name text NOT NULL,
|
||||
last_modification timestamp with time zone,
|
||||
income_category_id uuid NOT NULL REFERENCES categories (id) DEFERRABLE
|
||||
last_modification timestamp with time zone
|
||||
);
|
||||
|
||||
-- +goose Down
|
||||
|
@ -4,6 +4,8 @@ CREATE TABLE categories (
|
||||
category_group_id uuid NOT NULL REFERENCES category_groups (id) ON DELETE CASCADE,
|
||||
name varchar(50) NOT NULL
|
||||
);
|
||||
ALTER TABLE budgets ADD COLUMN income_category_id uuid NOT NULL REFERENCES categories (id) DEFERRABLE;
|
||||
|
||||
-- +goose Down
|
||||
ALTER TABLE budgets DROP COLUMN income_category_id;
|
||||
DROP TABLE categories;
|
Loading…
x
Reference in New Issue
Block a user