-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9823385
commit c76917c
Showing
1 changed file
with
24 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,31 @@ | ||
-- +goose Up | ||
-- +goose StatementBegin | ||
SELECT 'up SQL query'; | ||
|
||
create table if not exists chats ( | ||
id bigserial primary key | ||
); | ||
|
||
create table if not exists chats_users ( | ||
chat_id bigserial references chats, | ||
user_id bigint not null, | ||
primary key (chat_id, user_id) | ||
); | ||
|
||
create table if not exists chats_messages ( | ||
id bigserial primary key, | ||
chat_id bigint references chats, | ||
user_id bigint not null, | ||
body text not null, | ||
time timestamp with time zone not null | ||
); | ||
-- +goose StatementEnd | ||
|
||
-- +goose Down | ||
-- +goose StatementBegin | ||
SELECT 'down SQL query'; | ||
drop table if exists chats_messages; | ||
drop table if exists chats_users; | ||
drop table if exists chats; | ||
-- +goose StatementEnd | ||
|
||
|
||
|