CREATE TABLE IF NOT EXISTS chats (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    username TEXT
) STRICT;

CREATE TABLE IF NOT EXISTS posts (
    id INTEGER PRIMARY KEY,
    chat INTEGER NOT NULL,
    chat_message_id INTEGER NOT NULL,
    e621_id INTEGER NOT NULL,
    FOREIGN KEY(chat) REFERENCES chats(id),
    UNIQUE (chat, chat_message_id, e621_id)
) STRICT;
