diff --git a/internal/store/migrations.go b/internal/store/migrations.go index e67bd43..8bc86eb 100644 --- a/internal/store/migrations.go +++ b/internal/store/migrations.go @@ -91,7 +91,9 @@ ALTER TABLE reminders ADD COLUMN next_fire_ts INTEGER;`, // #2 // #12 — a suppressed nudge gets a 'dropped' row (Vikunja #370). sqlite // can't widen a CHECK constraint in place, so the table is rebuilt; the - // index goes with the old table and is recreated. + // index goes with the old table and is recreated. The columns are listed + // out rather than `SELECT *` — copying by position would silently shuffle + // every row if the old table's column order ever differed from this one. `CREATE TABLE delivery_attempts_v12 ( id INTEGER PRIMARY KEY AUTOINCREMENT, kind TEXT NOT NULL CHECK (kind IN ('nudge','reminder')), @@ -103,7 +105,10 @@ ALTER TABLE reminders ADD COLUMN next_fire_ts INTEGER;`, // #2 created_ts INTEGER NOT NULL, completed_ts INTEGER ); - INSERT INTO delivery_attempts_v12 SELECT * FROM delivery_attempts; + INSERT INTO delivery_attempts_v12 + (id, kind, rule, reminder_id, channel, body_hash, status, created_ts, completed_ts) + SELECT id, kind, rule, reminder_id, channel, body_hash, status, created_ts, completed_ts + FROM delivery_attempts; DROP TABLE delivery_attempts; ALTER TABLE delivery_attempts_v12 RENAME TO delivery_attempts; CREATE INDEX IF NOT EXISTS idx_delivery_attempts_status ON delivery_attempts (status);`,