mirror of
https://github.com/kuhyx/screen-locker.git
synced 2026-11-21 09:12:18 +01:00
Make the v10 migration idempotent
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
394ff70dc5
commit
218e84e04a
@ -162,9 +162,14 @@ extension StorageServiceSchema on StorageService {
|
||||
if (oldVersion < 10) {
|
||||
// NULL for every existing row: no deload before v10 stamped anything,
|
||||
// and the gap deload reads NULL as "due if the gap says so".
|
||||
await db.execute(
|
||||
'ALTER TABLE exercise_state ADD COLUMN $_lastDeloadedColumn',
|
||||
);
|
||||
// Checked first: a DB rewound to an older user_version (a test, a
|
||||
// hand repair) can already carry the column, and ADD would fail.
|
||||
final cols = await db.rawQuery('PRAGMA table_info(exercise_state)');
|
||||
if (!cols.any((c) => c['name'] == 'last_deloaded_at')) {
|
||||
await db.execute(
|
||||
'ALTER TABLE exercise_state ADD COLUMN $_lastDeloadedColumn',
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user