CREATE TABLE events (
    id TEXT PRIMARY KEY,
    kind INTEGER NOT NULL,
    pubkey TEXT NOT NULL,
    content TEXT NOT NULL,
    created_at INTEGER NOT NULL,
    tags TEXT NOT NULL,
    sig TEXT NOT NULL
);

CREATE INDEX idx_events_kind ON events (kind);
CREATE INDEX idx_events_pubkey ON events (pubkey);


CREATE TABLE tags (
    tag TEXT NOT NULL,
    value TEXT NOT NULL,
    event_id TEXT REFERENCES events(id) ON DELETE CASCADE
);

CREATE INDEX idx_tags_tag ON tags (tag);
CREATE INDEX idx_tags_value ON tags (value);
CREATE INDEX idx_tags_event_id ON tags (event_id);
