feat: add db migrations
This commit is contained in:
parent
5f26218307
commit
03c1025147
3 changed files with 29 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
@ -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;
|
||||
8
internal/store/pgstore/migrations/tern.conf
Normal file
8
internal/store/pgstore/migrations/tern.conf
Normal 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" }}
|
||||
Loading…
Reference in a new issue