| 1 | CREATE TABLE conversations (id text PRIMARY KEY, team_id text, person text, revision integer, last_sequence integer); |
| 2 | CREATE UNIQUE INDEX conversation_person ON conversations(team_id,person); |
| 3 | CREATE TABLE conversation_threads (id text PRIMARY KEY, task_id text, team_id text, revision integer, last_sequence integer); |
| 4 | CREATE UNIQUE INDEX conversation_task ON conversation_threads(task_id); |
| 5 | CREATE TABLE conversation_messages (id text PRIMARY KEY, stream_id text, sequence integer, conversation_id text, thread_id text, author_kind text, author_id text, body text, revision integer, created_at datetime); |
| 6 | CREATE UNIQUE INDEX conversation_sequence ON conversation_messages(stream_id,sequence); |
| 7 | CREATE TABLE conversation_cards (id text PRIMARY KEY, stream_id text, kind text, resource_id text, sequence integer, revision integer); |
| 8 | CREATE INDEX conversation_card_stream ON conversation_cards(stream_id); |
| 9 | CREATE TABLE conversation_requests (principal text, operation text, resource text, request_id text, input_hash text, result text, PRIMARY KEY(principal,operation,resource,request_id)); |
| 10 | CREATE TABLE conversation_routes (source_id text PRIMARY KEY, task_id text, reply_id text, notice_id text); |
| 11 | CREATE TABLE conversation_outboxes (message_id text PRIMARY KEY, stream_id text, purpose text); |
| 12 | CREATE TABLE conversation_cursors (id text PRIMARY KEY, principal text, stream_id text, after integer, through integer, revision integer, expires_at datetime); |
| 13 | |