feat: add db migrations

This commit is contained in:
Vinicius Souza 2024-08-09 11:04:55 +00:00
parent 5f26218307
commit 03c1025147
3 changed files with 29 additions and 0 deletions

View file

@ -0,0 +1,8 @@
CREATE TABLE IF NOT EXISTS rooms (
"id" uuid PRIMARY KEY NOT NULL DEFAULT gen_random_uuid(),
"theme" VARCHAR(255) NOT NULL
);
---- create above / drop below ----
DROP TABLE IF EXISTS rooms;

View file

@ -0,0 +1,13 @@
CREATE TABLE IF NOT EXISTS messages (
"id" uuid PRIMARY KEY NOT NULL DEFAULT gen_random_uuid(),
"room_id" uuid NOT NULL,
"message" VARCHAR(255) NOT NULL,
"reaction_count" BIGINT NOT NULL DEFAULT 0,
"answered" BOOLEAN NOT NULL DEFAULT false,
FOREIGN KEY (room_id) REFERENCES rooms(id)
);
---- create above / drop below ----
DROP TABLE IF EXISTS messages;

View file

@ -0,0 +1,8 @@
[database]
host = {{ env "WSRS_DATABASE_HOST" }}
port = {{ env "WSRS_DATABASE_PORT" }}
# database is required
database = {{ env "WSRS_DATABASE_NAME" }}
# user defaults to OS user
user = {{ env "WSRS_DATABASE_USER" }}
password = {{ env "WSRS_DATABASE_PASSWORD" }}