forked from lavina/lavina
18 lines
538 B
SQL
18 lines
538 B
SQL
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)
|
|
);
|