fix: entrypoint.sh set -e crash, __main__.py PostgreSQL check, cli.py seed placeholders

- entrypoint.sh: use NEEDS_INIT variable instead of exit codes (set -e was killing the script)
- __main__.py: skip db_path.exists() check when using PostgreSQL
- cli.py: use dual-backend placeholders for _seed_context (was using SQLite ? syntax)
- cli.py: use 'admin' instead of 'system' for seed updated_by (FK constraint)
This commit is contained in:
2026-06-25 00:20:55 +00:00
parent b9f911994d
commit 364c7795d4
3 changed files with 42 additions and 15 deletions
+9 -8
View File
@@ -64,14 +64,15 @@ Multi-camera remote monitoring system.
def _seed_context(conn):
"""Insert seed project context with real newlines."""
conn.execute(
"INSERT OR IGNORE INTO project_context (project_id, content, version, updated_by) VALUES (?, ?, 0, 'system')",
('welcome', _WELCOME_CONTENT),
)
conn.execute(
"INSERT OR IGNORE INTO project_context (project_id, content, version, updated_by) VALUES (?, ?, 0, 'system')",
('remote-rig', _REMOTE_RIG_CONTENT),
)
from ctxd.db import _is_pg, _ph
ph = _ph(conn, 2)
placeholders = ph.split(", ")
if _is_pg(conn):
sql = f"INSERT INTO project_context (project_id, content, version, updated_by) VALUES ({placeholders[0]}, {placeholders[1]}, 0, 'admin') ON CONFLICT DO NOTHING"
else:
sql = f"INSERT OR IGNORE INTO project_context (project_id, content, version, updated_by) VALUES ({placeholders[0]}, {placeholders[1]}, 0, 'admin')"
conn.execute(sql, ('welcome', _WELCOME_CONTENT))
conn.execute(sql, ('remote-rig', _REMOTE_RIG_CONTENT))
def cmd_init(args):