diff --git a/postgres/schema/0002_budgets.sql b/postgres/schema/0002_budgets.sql index 6d7de91..828f1d0 100644 --- a/postgres/schema/0002_budgets.sql +++ b/postgres/schema/0002_budgets.sql @@ -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 diff --git a/postgres/schema/0008_categories.sql b/postgres/schema/0008_categories.sql index 908f680..cb64403 100644 --- a/postgres/schema/0008_categories.sql +++ b/postgres/schema/0008_categories.sql @@ -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; \ No newline at end of file