-- create `media_activities` table
CREATE TABLE IF NOT EXISTS `media_activities` (
    `id` INTEGER NOT NULL UNIQUE,

    `album_id` INTEGER NOT NULL,
    `content_id` INTEGER NOT NULL,

    `site` TEXT,
    `post_id` INTEGER,
    `post_type` TEXT,

    `current_time` INTEGER NOT NULL,
    `is_completed` INTEGER NOT NULL,
    `created_at` TEXT NOT NULL,
    `updated_at` TEXT NOT NULL,
    PRIMARY KEY(`id` AUTOINCREMENT)
);

-- unique composite index on `album_id` and `content_id`
CREATE UNIQUE INDEX IF NOT EXISTS `media_activities_album_id_content_id_unique` ON `media_activities` (`album_id`, `content_id`);
