Replace individual Rust migration modules with a define_sql_migrations macro that reads up/down SQL files via include_str!. Consolidate all legacy single-file SQL into per-table directories and add full schema migration coverage for 90+ tables.
37 lines
1.2 KiB
SQL
37 lines
1.2 KiB
SQL
create table if not exists room_message
|
|
(
|
|
id uuid not null
|
|
primary key,
|
|
seq bigint not null,
|
|
room uuid not null,
|
|
sender_type varchar(255) not null,
|
|
sender_id uuid,
|
|
thread uuid,
|
|
content text not null,
|
|
content_type varchar(255) not null,
|
|
edited_at timestamp with time zone,
|
|
send_at timestamp with time zone not null,
|
|
revoked timestamp with time zone,
|
|
revoked_by uuid,
|
|
in_reply_to uuid,
|
|
content_tsv tsvector,
|
|
model_id uuid,
|
|
thinking_content text
|
|
);
|
|
|
|
create index if not exists idx_room_message_room_seq
|
|
on room_message (room, seq);
|
|
|
|
create index if not exists idx_room_message_thread
|
|
on room_message (thread);
|
|
|
|
create index if not exists idx_room_message_send_at
|
|
on room_message (send_at);
|
|
|
|
create index if not exists idx_room_message_content_tsv
|
|
on room_message using gin (content_tsv);
|
|
|
|
create index if not exists idx_room_message_model_id
|
|
on room_message (model_id)
|
|
where (model_id IS NOT NULL);
|