CREATE TABLE IF NOT EXISTS secret (
    `id` INTEGER PRIMARY KEY AUTOINCREMENT,
    `name` TEXT NOT NULL,
    `content` TEXT NOT NULL,
    `user_id` INTEGER NOT NULL REFERENCES user(id) ON DELETE CASCADE,
    `timeout_seconds` INTEGER NOT NULL,
    `expired` BOOLEAN NOT NULL DEFAULT 0,
    `created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE IF NOT EXISTS secret_recipient (
    `secret_id` INTEGER NOT NULL REFERENCES secret(id) ON DELETE CASCADE,
    `user_id` INTEGER NOT NULL REFERENCES user(id) ON DELETE CASCADE,
    PRIMARY KEY (secret_id, user_id)
);