From 63e555b8228ad2c35aae11fa496415ecdb6e118f Mon Sep 17 00:00:00 2001 From: David Kiania Date: Fri, 10 Apr 2026 23:40:32 +0300 Subject: [PATCH] Fix: create tracksolid schema before schema_migrations table MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On a fresh database the tracksolid schema doesn't exist yet — migration 02 creates it, but ensure_tracking_table() ran first. Added CREATE SCHEMA IF NOT EXISTS tracksolid before the table DDL. Co-Authored-By: Claude Sonnet 4.6 --- run_migrations.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/run_migrations.py b/run_migrations.py index 2af6374..8e79a9e 100644 --- a/run_migrations.py +++ b/run_migrations.py @@ -54,8 +54,11 @@ def get_conn(): def ensure_tracking_table(conn): - """Create schema_migrations tracking table if it doesn't exist.""" + """Create schema and schema_migrations tracking table if they don't exist.""" with conn.cursor() as cur: + # Schema may not exist yet on a fresh DB (migration 02 creates it, + # but we need it before we can create the tracking table). + cur.execute("CREATE SCHEMA IF NOT EXISTS tracksolid") cur.execute(""" CREATE TABLE IF NOT EXISTS tracksolid.schema_migrations ( filename TEXT PRIMARY KEY,