From fb121e401033b3aa661f48331c4f148ae1f8fcbc Mon Sep 17 00:00:00 2001 From: m3taversal Date: Thu, 16 Apr 2026 18:07:04 +0100 Subject: [PATCH] Add github_pr column to prs table (migration v21) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enables GitHub↔Forgejo PR linking for the contributor pipeline. Mirror script will store GitHub PR number when creating Forgejo PRs, allowing back-sync of eval feedback and merge/close status. Co-Authored-By: Claude Opus 4.6 (1M context) --- lib/db.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/db.py b/lib/db.py index d419a6a..a7c1f3d 100644 --- a/lib/db.py +++ b/lib/db.py @@ -9,7 +9,7 @@ from . import config logger = logging.getLogger("pipeline.db") -SCHEMA_VERSION = 20 +SCHEMA_VERSION = 21 SCHEMA_SQL = """ CREATE TABLE IF NOT EXISTS schema_version ( @@ -70,6 +70,7 @@ CREATE TABLE IF NOT EXISTS prs ( last_attempt TEXT, cost_usd REAL DEFAULT 0, auto_merge INTEGER DEFAULT 0, + github_pr INTEGER, created_at TEXT DEFAULT (datetime('now')), merged_at TEXT ); @@ -546,6 +547,17 @@ def migrate(conn: sqlite3.Connection): conn.commit() logger.info("Migration v20: added conflict retry columns to prs") + if current < 21: + try: + conn.execute("ALTER TABLE prs ADD COLUMN github_pr INTEGER") + except sqlite3.OperationalError: + pass + conn.execute( + "CREATE INDEX IF NOT EXISTS idx_prs_github_pr ON prs (github_pr) WHERE github_pr IS NOT NULL" + ) + conn.commit() + logger.info("Migration v21: added github_pr column + index to prs") + if current < SCHEMA_VERSION: conn.execute( "INSERT OR REPLACE INTO schema_version (version) VALUES (?)",