-- sort local SQLite schema v4
-- Chrome 프로필과 무관한 수집계정 queue의 SQLite 기준 저장 구조.

PRAGMA foreign_keys = ON;

CREATE TABLE IF NOT EXISTS collection_account_queue (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    username TEXT NOT NULL COLLATE NOCASE,
    position INTEGER NOT NULL DEFAULT 0,
    enabled INTEGER NOT NULL DEFAULT 1,
    is_deleted INTEGER NOT NULL DEFAULT 0,
    source_type TEXT NOT NULL DEFAULT 'SIDE',
    created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
    updated_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
    UNIQUE(username)
);
CREATE INDEX IF NOT EXISTS idx_collection_account_queue_position
    ON collection_account_queue(enabled, is_deleted, position, id);

PRAGMA user_version = 4;
