add categories table and local env

This commit is contained in:
2024-11-18 20:29:45 +07:00
parent 9a51201678
commit 6cfab72b9c
8 changed files with 65 additions and 6 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
-- +goose Up
-- +goose StatementBegin
CREATE TABLE IF NOT EXISTS "user" (
CREATE TABLE IF NOT EXISTS "users" (
id SERIAL PRIMARY KEY,
chat_id TEXT NOT NULL
);
@@ -8,5 +8,5 @@ CREATE TABLE IF NOT EXISTS "user" (
-- +goose Down
-- +goose StatementBegin
DROP TABLE IF EXISTS "user";
DROP TABLE IF EXISTS "users";
-- +goose StatementEnd
@@ -0,0 +1,16 @@
-- +goose Up
-- +goose StatementBegin
CREATE TABLE IF NOT EXISTS categories (
id SERIAL PRIMARY KEY,
name TEXT NOT NULL,
user_id INT REFERENCES "users"(id),
favorite BOOLEAN DEFAULT FALSE,
"limit" INT DEFAULT 0
);
comment on column categories.limit is 'Лимит трат в месяц в копейках';
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE IF EXISTS categories;
-- +goose StatementEnd