fix: correct schema-qualified CREATE INDEX syntax (breaks SQLite install)
CREATE INDEX ... ON chatelet.bookings is invalid SQLite grammar — the schema qualifier must go on the INDEX name, not the table (SQLite attaches the ext DB as schema `chatelet`). Would have failed m001 on every SQLite-backed install (the default backend). Fixed to `CREATE INDEX chatelet.idx_... ON <table>`, matching the restaurant extension. Caught by a real-DB migration smoke (m001+m002 applied, room+booking round-tripped) before tagging; safe to amend m001 in place since chatelet has never been installed anywhere yet. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019VUQCfdqiLSsFS2jcGnaFD
This commit is contained in:
parent
65f5c19a96
commit
7c249f08f6
1 changed files with 8 additions and 5 deletions
|
|
@ -86,13 +86,16 @@ async def m001_initial(db):
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
# Overlap checks scan by room + status; index the hot path.
|
# Overlap checks scan by room + status; index the hot path.
|
||||||
|
# NOTE: the schema qualifier goes on the INDEX name, not the table — SQLite
|
||||||
|
# attaches the ext DB as schema `chatelet`, and `CREATE INDEX ON schema.table`
|
||||||
|
# is a syntax error there. (Matches the restaurant extension's pattern.)
|
||||||
await db.execute(
|
await db.execute(
|
||||||
"CREATE INDEX idx_chatelet_bookings_room_status "
|
"CREATE INDEX chatelet.idx_bookings_room_status "
|
||||||
"ON chatelet.bookings (room_id, status);"
|
"ON bookings (room_id, status);"
|
||||||
)
|
)
|
||||||
await db.execute(
|
await db.execute(
|
||||||
"CREATE INDEX idx_chatelet_bookings_payment_hash "
|
"CREATE INDEX chatelet.idx_bookings_payment_hash "
|
||||||
"ON chatelet.bookings (payment_hash);"
|
"ON bookings (payment_hash);"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Manual owner-side blocks (maintenance, personal use).
|
# Manual owner-side blocks (maintenance, personal use).
|
||||||
|
|
@ -109,7 +112,7 @@ async def m001_initial(db):
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
await db.execute(
|
await db.execute(
|
||||||
"CREATE INDEX idx_chatelet_blocks_room ON chatelet.blocks (room_id);"
|
"CREATE INDEX chatelet.idx_blocks_room ON blocks (room_id);"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue