Fix migration v4 ordering and add a v3->v4 regression test (AUD-70)

schema.sql runs before the incremental migrations, so the folder index must
not live there: on a v3 database the column does not exist yet and startup
failed with "no such column: folder". The migration still creates the index.
The regression test opens a hand-built v3 database with the current code.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
2026-10-11 21:46:19 +11:00
parent 8c0416750e
commit 318b7b4e1e
2 changed files with 54 additions and 1 deletions

View File

@@ -39,7 +39,6 @@ CREATE TABLE IF NOT EXISTS messages (
);
CREATE INDEX IF NOT EXISTS idx_messages_received_at ON messages (received_at);
CREATE INDEX IF NOT EXISTS idx_messages_folder ON messages (folder, received_at);
CREATE INDEX IF NOT EXISTS idx_messages_thread_id ON messages (thread_id);
CREATE INDEX IF NOT EXISTS idx_messages_source ON messages (source_address);