fix(db): strip inline -- comments before splitting schema statements #82
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/schema-loader-inline-comment-split"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The server crash-loops on boot against a fresh/live database, failing to ensure the schema:
Root cause
ensureSchema()inserver/src/utils/db.jsstripped only full-line--comments, then split the schema file on;. Themobile_auth_sessions.session_idcolumn carries a trailing comment that contains a semicolon:That embedded
;split theCREATE TABLEin half, so MariaDB received the truncated fragment (ending at-- uuid) and rejected it — exactly thenear '' at line 3error above. Not DB-version-specific; the bug had simply never been triggered until a column comment happened to contain a;.Fix
Strip
--comments on every line (full-line and trailing) before the;split. Safe because the schema never places--inside a string literal (verified with a grep overschema.sql).Verification
ensureSchema()against a fresh MariaDB: schema ensured, 49 tables created,mobile_auth_sessionshas all 11 columns.No docs/protocol/API/schema change — this is loader behavior only.
AI-assisted: authored with Claude Code (see commit
Co-Authored-Bytrailer).🤖 Generated with Claude Code
https://claude.ai/code/session_01NgyHnrNa8WwG3doxvxjuCr