forked from lavina/lavina
1
0
Fork 0
lavina/crates/lavina-core/migrations/3_dialogs.sql

18 lines
538 B
MySQL
Raw Permalink Normal View History

create table dialogs(
id integer primary key autoincrement not null,
participant_1 integer not null,
participant_2 integer not null,
created_at timestamp not null,
message_count integer not null default 0,
unique (participant_1, participant_2)
);
create table dialog_messages(
dialog_id integer not null,
id integer not null, -- unique per dialog, sequential in one dialog
author_id integer not null,
content string not null,
created_at timestamp not null,
primary key (dialog_id, id)
);