From 40e1001ceab292a26ec09da0216608944bcb17fb Mon Sep 17 00:00:00 2001 From: Gros Frumos Date: Tue, 17 Mar 2026 18:25:20 +0200 Subject: [PATCH] =?UTF-8?q?kin:=20KIN-INFRA-010=20=D0=98=D1=81=D0=BF=D1=80?= =?UTF-8?q?=D0=B0=D0=B2=D0=B8=D1=82=D1=8C=20link=5Ftype=20vs=20type:=20fro?= =?UTF-8?q?ntend=20=D0=BE=D1=82=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D1=8F=D0=B5?= =?UTF-8?q?=D1=82=20=D0=BD=D0=B5=D0=B2=D0=B5=D1=80=D0=BD=D0=BE=D0=B5=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=BB=D0=B5=20=D0=B2=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/db.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/core/db.py b/core/db.py index d808011..d35c90a 100644 --- a/core/db.py +++ b/core/db.py @@ -719,6 +719,23 @@ def _migrate(conn: sqlite3.Connection): ) conn.commit() + # Create indexes for project_links (KIN-INFRA-008). + # Guard: indexes must be created AFTER the table exists. + if "project_links" in existing_tables: + existing_indexes = {r[0] for r in conn.execute( + "SELECT name FROM sqlite_master WHERE type='index'" + ).fetchall()} + if "idx_project_links_to" not in existing_indexes: + conn.execute( + "CREATE INDEX IF NOT EXISTS idx_project_links_to ON project_links(to_project)" + ) + conn.commit() + if "idx_project_links_from" not in existing_indexes: + conn.execute( + "CREATE INDEX IF NOT EXISTS idx_project_links_from ON project_links(from_project)" + ) + conn.commit() + def _seed_default_hooks(conn: sqlite3.Connection): """Seed default hooks for the kin project (idempotent).