feat(bibliotheque): tags et duplication profonde

Ticket #83 B1-B3 : tags JSON dénormalisés, migration Drift v19, mappings sync, helpers de filtre/suggestions, duplication profonde Program/WorkoutTemplate, tests associés.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-22 10:01:31 +02:00
parent 10fba8d2ec
commit add5025dd2
9 changed files with 1012 additions and 10 deletions

View File

@ -196,6 +196,7 @@ class Exercises extends SyncableTable {
TextColumn get category =>
text().withDefault(const Constant('uncategorized'))();
BoolColumn get isExample => boolean().withDefault(const Constant(false))();
TextColumn get tagsJson => text().withDefault(const Constant('[]'))();
DateTimeColumn get archivedAt => dateTime().nullable()();
@override
@ -214,6 +215,7 @@ class Exercises extends SyncableTable {
'default_target_score_time_ms > 0)',
"CHECK (category IN ('shoot', 'freeThrows', 'dribble', 'finishing', "
"'conditioning', 'defense', 'mobility', 'uncategorized'))",
'CHECK (json_valid(tags_json))',
];
}
@ -284,9 +286,13 @@ class Programs extends SyncableTable {
TextColumn get name => text().withLength(min: 1)();
IntColumn get defaultRestSeconds => integer()();
BoolColumn get isExample => boolean().withDefault(const Constant(false))();
TextColumn get tagsJson => text().withDefault(const Constant('[]'))();
@override
List<String> get customConstraints => ['CHECK (default_rest_seconds >= 0)'];
List<String> get customConstraints => [
'CHECK (default_rest_seconds >= 0)',
'CHECK (json_valid(tags_json))',
];
}
class ProgramExercises extends SyncableTable {
@ -367,6 +373,10 @@ class WorkoutTemplates extends SyncableTable {
TextColumn get name => text().withLength(min: 1)();
DateTimeColumn get lastStartedAt => dateTime().nullable()();
BoolColumn get isExample => boolean().withDefault(const Constant(false))();
TextColumn get tagsJson => text().withDefault(const Constant('[]'))();
@override
List<String> get customConstraints => ['CHECK (json_valid(tags_json))'];
}
class LocalSeedMetadata extends Table {