feat(exercice): modèle et migration pour l'auto-enchaînement des chronos d'étapes (ticket #75)
Étend le modèle Drift (migration schemaVersion 13→14, ADD COLUMN) et la couche application (entités, use cases, repositories) pour supporter l'auto-enchaînement des chronos d'étapes. flutter pub get OK, build_runner OK, analyze propre (mêmes infos préexistantes), 141/141 tests verts, build APK debug validé. Premier ticket du chantier "auto-enchaînement des chronos d'étapes" (#73). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@ -46,7 +46,7 @@ final class AppDatabase extends _$AppDatabase {
|
||||
}
|
||||
|
||||
@override
|
||||
int get schemaVersion => 13;
|
||||
int get schemaVersion => 14;
|
||||
|
||||
@override
|
||||
MigrationStrategy get migration {
|
||||
@ -100,6 +100,9 @@ final class AppDatabase extends _$AppDatabase {
|
||||
if (from < 13) {
|
||||
await _migrateToSchema13();
|
||||
}
|
||||
if (from < 14) {
|
||||
await _migrateToSchema14();
|
||||
}
|
||||
await _createIndexes();
|
||||
},
|
||||
beforeOpen: (details) async {
|
||||
@ -469,4 +472,26 @@ FROM exercises
|
||||
await customStatement('ALTER TABLE exercises_new RENAME TO exercises');
|
||||
await customStatement('PRAGMA foreign_keys = ON');
|
||||
}
|
||||
|
||||
Future<void> _migrateToSchema14() async {
|
||||
await customStatement(
|
||||
'ALTER TABLE exercises ADD COLUMN auto_start_next_timed_step '
|
||||
'INTEGER NOT NULL DEFAULT 1 CHECK (auto_start_next_timed_step IN (0, 1))',
|
||||
);
|
||||
await customStatement(
|
||||
'ALTER TABLE program_exercises ADD COLUMN '
|
||||
'auto_start_next_timed_step_snapshot INTEGER NOT NULL DEFAULT 1 '
|
||||
'CHECK (auto_start_next_timed_step_snapshot IN (0, 1))',
|
||||
);
|
||||
await customStatement(
|
||||
'ALTER TABLE program_exercises ADD COLUMN '
|
||||
'auto_start_next_timed_step_override INTEGER '
|
||||
'CHECK (auto_start_next_timed_step_override IN (0, 1))',
|
||||
);
|
||||
await customStatement(
|
||||
'ALTER TABLE workout_template_exercise_overrides ADD COLUMN '
|
||||
'auto_start_next_timed_step_override INTEGER '
|
||||
'CHECK (auto_start_next_timed_step_override IN (0, 1))',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user