// Generated by scripts/gen-scoped-schema.ts from the D1 migrations up to 0057_drop_moved_tables.sql. Do not edit; rerun
// the script. New scoped-table DDL goes in schema-extra.ts.
/* oxlint-disable max-lines */
export const REPO_SCHEMA: readonly string[] = [
"CREATE TABLE IF NOT EXISTS issues (\n id TEXT PRIMARY KEY,\n repo_id TEXT NOT NULL,\n number INTEGER NOT NULL,\n author_id TEXT NOT NULL,\n title TEXT NOT NULL,\n body TEXT NOT NULL DEFAULT '',\n state TEXT NOT NULL CHECK (state IN ('open', 'closed')),\n is_pull INTEGER NOT NULL DEFAULT 0,\n comments_count INTEGER NOT NULL DEFAULT 0,\n locked INTEGER NOT NULL DEFAULT 0,\n closed_at INTEGER,\n closed_by TEXT,\n created_at INTEGER NOT NULL,\n updated_at INTEGER NOT NULL,\n milestone_id TEXT REFERENCES milestones(id) ON DELETE SET NULL,\n type_id TEXT REFERENCES issue_types(id) ON DELETE SET NULL,\n parent_id TEXT REFERENCES issues(id) ON DELETE SET NULL, hidden_at INTEGER,\n UNIQUE (repo_id, number)\n)",
"CREATE INDEX IF NOT EXISTS issues_repo_state ON issues(repo_id, is_pull, state, number DESC)",
"CREATE INDEX IF NOT EXISTS issues_author ON issues(author_id)",
"CREATE INDEX IF NOT EXISTS issues_milestone ON issues(milestone_id, state)",
"CREATE INDEX IF NOT EXISTS issues_parent ON issues(parent_id, state)",
"CREATE TABLE IF NOT EXISTS pull_requests (\n issue_id TEXT PRIMARY KEY REFERENCES issues(id) ON DELETE CASCADE,\n repo_id TEXT NOT NULL,\n head_repo_id TEXT NOT NULL,\n head_ref TEXT NOT NULL,\n head_sha TEXT NOT NULL,\n base_ref TEXT NOT NULL,\n base_sha TEXT NOT NULL,\n merge_base_sha TEXT,\n draft INTEGER NOT NULL DEFAULT 0,\n mergeable TEXT NOT NULL DEFAULT 'unknown' CHECK (mergeable IN ('unknown', 'clean', 'conflict')),\n merged_at INTEGER,\n merged_by TEXT,\n merge_commit_sha TEXT,\n merge_method TEXT,\n refs_swept_at INTEGER\n, bridged_bytes INTEGER NOT NULL DEFAULT 0, stacked_on_issue_id TEXT REFERENCES issues(id) ON DELETE SET NULL, restack_upstream_sha TEXT)",
"CREATE INDEX IF NOT EXISTS pull_requests_head ON pull_requests(head_repo_id, head_ref)",
"CREATE INDEX IF NOT EXISTS pull_requests_base ON pull_requests(repo_id, base_ref)",
"CREATE TABLE IF NOT EXISTS comments (\n id TEXT PRIMARY KEY,\n issue_id TEXT NOT NULL REFERENCES issues(id) ON DELETE CASCADE,\n author_id TEXT NOT NULL,\n body TEXT NOT NULL,\n created_at INTEGER NOT NULL,\n updated_at INTEGER NOT NULL\n, hidden_at INTEGER)",
"CREATE INDEX IF NOT EXISTS comments_issue ON comments(issue_id, created_at)",
"CREATE TABLE IF NOT EXISTS issue_events (\n id TEXT PRIMARY KEY,\n issue_id TEXT NOT NULL REFERENCES issues(id) ON DELETE CASCADE,\n actor_id TEXT,\n kind TEXT NOT NULL,\n data TEXT NOT NULL DEFAULT '{}',\n created_at INTEGER NOT NULL\n)",
"CREATE INDEX IF NOT EXISTS issue_events_issue ON issue_events(issue_id, created_at)",
"CREATE TABLE IF NOT EXISTS reviews (\n id TEXT PRIMARY KEY,\n issue_id TEXT NOT NULL REFERENCES issues(id) ON DELETE CASCADE,\n author_id TEXT NOT NULL,\n state TEXT NOT NULL CHECK (state IN ('approved', 'changes_requested', 'commented', 'dismissed')),\n body TEXT NOT NULL DEFAULT '',\n commit_sha TEXT NOT NULL,\n created_at INTEGER NOT NULL,\n dismissed_by TEXT,\n dismiss_reason TEXT\n)",
"CREATE INDEX IF NOT EXISTS reviews_issue ON reviews(issue_id, created_at)",
"CREATE TABLE IF NOT EXISTS review_comments (\n id TEXT PRIMARY KEY,\n issue_id TEXT NOT NULL REFERENCES issues(id) ON DELETE CASCADE,\n review_id TEXT REFERENCES reviews(id) ON DELETE CASCADE,\n author_id TEXT NOT NULL,\n path TEXT NOT NULL,\n line INTEGER NOT NULL,\n side TEXT NOT NULL CHECK (side IN ('LEFT', 'RIGHT')),\n commit_sha TEXT NOT NULL,\n body TEXT NOT NULL,\n in_reply_to TEXT REFERENCES review_comments(id) ON DELETE CASCADE,\n resolved INTEGER NOT NULL DEFAULT 0,\n created_at INTEGER NOT NULL,\n updated_at INTEGER NOT NULL,\n start_line INTEGER,\n start_side TEXT CHECK (start_side IN ('LEFT', 'RIGHT')),\n suggestion_applied_sha TEXT\n, hidden_at INTEGER)",
"CREATE INDEX IF NOT EXISTS review_comments_issue ON review_comments(issue_id, path, line)",
"CREATE TABLE IF NOT EXISTS review_requests (\n issue_id TEXT NOT NULL REFERENCES issues(id) ON DELETE CASCADE,\n user_id TEXT NOT NULL,\n created_at INTEGER NOT NULL,\n code_owner INTEGER NOT NULL DEFAULT 0,\n PRIMARY KEY (issue_id, user_id)\n)",
"CREATE TABLE IF NOT EXISTS labels (\n id TEXT PRIMARY KEY,\n repo_id TEXT NOT NULL,\n name TEXT NOT NULL COLLATE NOCASE,\n color TEXT NOT NULL,\n description TEXT,\n UNIQUE (repo_id, name)\n)",
"CREATE TABLE IF NOT EXISTS issue_labels (\n issue_id TEXT NOT NULL REFERENCES issues(id) ON DELETE CASCADE,\n label_id TEXT NOT NULL REFERENCES labels(id) ON DELETE CASCADE,\n PRIMARY KEY (issue_id, label_id)\n)",
"CREATE INDEX IF NOT EXISTS issue_labels_label ON issue_labels(label_id)",
"CREATE TABLE IF NOT EXISTS issue_assignees (\n issue_id TEXT NOT NULL REFERENCES issues(id) ON DELETE CASCADE,\n user_id TEXT NOT NULL,\n PRIMARY KEY (issue_id, user_id)\n)",
"CREATE INDEX IF NOT EXISTS issue_assignees_user ON issue_assignees(user_id)",
"CREATE TABLE IF NOT EXISTS branch_protections (\n id TEXT PRIMARY KEY,\n repo_id TEXT NOT NULL,\n pattern TEXT NOT NULL,\n require_pull_request INTEGER NOT NULL DEFAULT 1,\n required_approvals INTEGER NOT NULL DEFAULT 0,\n required_checks TEXT NOT NULL DEFAULT '[]',\n dismiss_stale_reviews INTEGER NOT NULL DEFAULT 0,\n allow_deletions INTEGER NOT NULL DEFAULT 0,\n enforce_admins INTEGER NOT NULL DEFAULT 0,\n created_at INTEGER NOT NULL,\n require_code_owner_review INTEGER NOT NULL DEFAULT 0,\n allow_force_pushes INTEGER NOT NULL DEFAULT 0,\n UNIQUE (repo_id, pattern)\n)",
"CREATE TABLE IF NOT EXISTS webhooks (\n id TEXT PRIMARY KEY,\n repo_id TEXT NOT NULL,\n url TEXT NOT NULL,\n secret TEXT,\n events TEXT NOT NULL,\n active INTEGER NOT NULL DEFAULT 1,\n created_at INTEGER NOT NULL\n)",
"CREATE INDEX IF NOT EXISTS webhooks_repo ON webhooks(repo_id)",
"CREATE TABLE IF NOT EXISTS webhook_deliveries (\n id TEXT PRIMARY KEY,\n webhook_id TEXT NOT NULL REFERENCES webhooks(id) ON DELETE CASCADE,\n event TEXT NOT NULL,\n status_code INTEGER,\n error TEXT,\n request_body TEXT NOT NULL,\n response_body TEXT,\n duration_ms INTEGER,\n attempt INTEGER NOT NULL,\n created_at INTEGER NOT NULL\n)",
"CREATE INDEX IF NOT EXISTS webhook_deliveries_hook ON webhook_deliveries(webhook_id, created_at DESC)",
"CREATE TABLE IF NOT EXISTS secrets (\n repo_id TEXT NOT NULL,\n name TEXT NOT NULL,\n ciphertext TEXT NOT NULL,\n iv TEXT NOT NULL,\n updated_at INTEGER NOT NULL,\n PRIMARY KEY (repo_id, name)\n)",
"CREATE TABLE IF NOT EXISTS workflow_runs (\n id TEXT PRIMARY KEY,\n repo_id TEXT NOT NULL,\n source_repo_id TEXT NOT NULL,\n run_number INTEGER NOT NULL,\n workflow_path TEXT NOT NULL,\n workflow_name TEXT NOT NULL,\n event TEXT NOT NULL,\n ref TEXT NOT NULL,\n sha TEXT NOT NULL,\n title TEXT NOT NULL,\n actor_id TEXT,\n pr_number INTEGER,\n status TEXT NOT NULL CHECK (status IN ('queued', 'in_progress', 'completed')),\n conclusion TEXT CHECK (conclusion IN ('success', 'failure', 'cancelled', 'skipped')),\n created_at INTEGER NOT NULL,\n started_at INTEGER,\n completed_at INTEGER,\n approval_required INTEGER NOT NULL DEFAULT 0,\n workflow_source TEXT,\n context TEXT,\n trigger_depth INTEGER NOT NULL DEFAULT 0,\n rerun_of TEXT,\n untrusted INTEGER NOT NULL DEFAULT 0,\n UNIQUE (repo_id, run_number)\n)",
"CREATE INDEX IF NOT EXISTS workflow_runs_repo ON workflow_runs(repo_id, created_at DESC)",
"CREATE INDEX IF NOT EXISTS workflow_runs_sha ON workflow_runs(repo_id, sha)",
"CREATE TABLE IF NOT EXISTS workflow_jobs (\n id TEXT PRIMARY KEY,\n run_id TEXT NOT NULL REFERENCES workflow_runs(id) ON DELETE CASCADE,\n repo_id TEXT NOT NULL,\n job_key TEXT NOT NULL,\n name TEXT NOT NULL,\n runs_on TEXT NOT NULL,\n needs TEXT NOT NULL DEFAULT '[]',\n spec TEXT NOT NULL,\n status TEXT NOT NULL CHECK (status IN ('pending', 'queued', 'in_progress', 'completed')),\n conclusion TEXT CHECK (conclusion IN ('success', 'failure', 'cancelled', 'skipped')),\n runner_id TEXT,\n runner_name TEXT,\n created_at INTEGER NOT NULL,\n started_at INTEGER,\n completed_at INTEGER,\n outputs TEXT,\n environment TEXT,\n gate TEXT,\n UNIQUE (run_id, job_key)\n)",
"CREATE INDEX IF NOT EXISTS workflow_jobs_queue ON workflow_jobs(status, created_at)",
"CREATE INDEX IF NOT EXISTS workflow_jobs_runner ON workflow_jobs(runner_id, status)",
"CREATE TABLE IF NOT EXISTS job_steps (\n job_id TEXT NOT NULL REFERENCES workflow_jobs(id) ON DELETE CASCADE,\n idx INTEGER NOT NULL,\n name TEXT NOT NULL,\n status TEXT NOT NULL CHECK (status IN ('pending', 'in_progress', 'completed')),\n conclusion TEXT CHECK (conclusion IN ('success', 'failure', 'cancelled', 'skipped')),\n started_at INTEGER,\n completed_at INTEGER,\n PRIMARY KEY (job_id, idx)\n)",