Skip to content

Commit

Permalink
Updated chat server
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreiMartynenko committed Mar 17, 2024
1 parent 9823385 commit c76917c
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions postgres/migrations/20240317023516_newmigration.sql
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



0 comments on commit c76917c

Please sign in to comment.