kin: KIN-INFRA-010 Исправить link_type vs type: frontend отправляет неверное поле в API

This commit is contained in:
Gros Frumos 2026-03-17 18:25:20 +02:00
parent b973b9219a
commit 40e1001cea

View file

@ -719,6 +719,23 @@ def _migrate(conn: sqlite3.Connection):
) )
conn.commit() 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): def _seed_default_hooks(conn: sqlite3.Connection):
"""Seed default hooks for the kin project (idempotent). """Seed default hooks for the kin project (idempotent).