From 60bc5719872772ab4b9635e2a4dfc589850c00d6 Mon Sep 17 00:00:00 2001 From: Joshua Burman Date: Fri, 24 Jan 2025 16:15:22 -0500 Subject: [PATCH] action display, and full display, started action editor --- lib/daos/actions_dao.dart | 2 + lib/database/database.dart | 9 +- lib/database/database.g.dart | 114 + lib/database/database.steps.dart | 1881 ++++++++++++ .../sendtrain/drift_schema_v23.json | 1 + .../sendtrain/drift_schema_v24.json | 1 + .../sendtrain/drift_schema_v25.json | 1 + .../sendtrain/drift_schema_v26.json | 1 + .../sendtrain/drift_schema_v27.json | 1 + .../sendtrain/drift_schema_v28.json | 1 + .../sendtrain/drift_schema_v29.json | 1 + .../sendtrain/drift_schema_v30.json | 1 + .../sendtrain/drift_schema_v31.json | 1 + .../sendtrain/drift_schema_v32.json | 1 + .../sendtrain/drift_schema_v33.json | 1 + lib/database/seed.dart | 2 +- lib/helpers/date_time_helpers.dart | 5 + lib/helpers/widget_helpers.dart | 24 +- lib/main.dart | 7 +- lib/models/action_model.dart | 259 ++ lib/providers/action_timer.dart | 173 ++ .../activities/activity_action_editor.dart | 39 + .../activities/activity_action_view.dart | 277 +- lib/widgets/activities/activity_view.dart | 221 +- lib/widgets/builders/dialogs.dart | 50 + .../generic/elements/form_search_input.dart | 52 +- pubspec.yaml | 1 + test/drift/sendtrain/generated/schema.dart | 46 +- .../drift/sendtrain/generated/schema_v23.dart | 2669 ++++++++++++++++ .../drift/sendtrain/generated/schema_v24.dart | 2670 ++++++++++++++++ .../drift/sendtrain/generated/schema_v25.dart | 2702 +++++++++++++++++ .../drift/sendtrain/generated/schema_v26.dart | 2701 ++++++++++++++++ .../drift/sendtrain/generated/schema_v27.dart | 2701 ++++++++++++++++ .../drift/sendtrain/generated/schema_v28.dart | 2701 ++++++++++++++++ .../drift/sendtrain/generated/schema_v29.dart | 2702 +++++++++++++++++ .../drift/sendtrain/generated/schema_v30.dart | 2702 +++++++++++++++++ .../drift/sendtrain/generated/schema_v31.dart | 2702 +++++++++++++++++ .../drift/sendtrain/generated/schema_v32.dart | 2702 +++++++++++++++++ .../drift/sendtrain/generated/schema_v33.dart | 2702 +++++++++++++++++ 39 files changed, 32576 insertions(+), 251 deletions(-) create mode 100644 lib/database/drift_schemas/sendtrain/drift_schema_v23.json create mode 100644 lib/database/drift_schemas/sendtrain/drift_schema_v24.json create mode 100644 lib/database/drift_schemas/sendtrain/drift_schema_v25.json create mode 100644 lib/database/drift_schemas/sendtrain/drift_schema_v26.json create mode 100644 lib/database/drift_schemas/sendtrain/drift_schema_v27.json create mode 100644 lib/database/drift_schemas/sendtrain/drift_schema_v28.json create mode 100644 lib/database/drift_schemas/sendtrain/drift_schema_v29.json create mode 100644 lib/database/drift_schemas/sendtrain/drift_schema_v30.json create mode 100644 lib/database/drift_schemas/sendtrain/drift_schema_v31.json create mode 100644 lib/database/drift_schemas/sendtrain/drift_schema_v32.json create mode 100644 lib/database/drift_schemas/sendtrain/drift_schema_v33.json create mode 100644 lib/models/action_model.dart create mode 100644 lib/providers/action_timer.dart create mode 100644 lib/widgets/activities/activity_action_editor.dart create mode 100644 test/drift/sendtrain/generated/schema_v23.dart create mode 100644 test/drift/sendtrain/generated/schema_v24.dart create mode 100644 test/drift/sendtrain/generated/schema_v25.dart create mode 100644 test/drift/sendtrain/generated/schema_v26.dart create mode 100644 test/drift/sendtrain/generated/schema_v27.dart create mode 100644 test/drift/sendtrain/generated/schema_v28.dart create mode 100644 test/drift/sendtrain/generated/schema_v29.dart create mode 100644 test/drift/sendtrain/generated/schema_v30.dart create mode 100644 test/drift/sendtrain/generated/schema_v31.dart create mode 100644 test/drift/sendtrain/generated/schema_v32.dart create mode 100644 test/drift/sendtrain/generated/schema_v33.dart diff --git a/lib/daos/actions_dao.dart b/lib/daos/actions_dao.dart index 0911766..dbdbffe 100644 --- a/lib/daos/actions_dao.dart +++ b/lib/daos/actions_dao.dart @@ -32,4 +32,6 @@ class ActionsDao extends DatabaseAccessor with _$ActionsDaoMixin { return actions; } + + Future createOrUpdate(ActionsCompanion action) => into(actions).insertOnConflictUpdate(action); } diff --git a/lib/database/database.dart b/lib/database/database.dart index 4d7bacb..382581a 100644 --- a/lib/database/database.dart +++ b/lib/database/database.dart @@ -35,7 +35,7 @@ class AppDatabase extends _$AppDatabase { AppDatabase() : super(_openConnection()); @override - int get schemaVersion => 22; + int get schemaVersion => 33; @override MigrationStrategy get migration { @@ -165,6 +165,9 @@ class ActivityActions extends Table { } enum RepType { time, count } + +enum ActionStatus { pending, started, paused, complete } + class Actions extends Table { IntColumn get id => integer().autoIncrement()(); TextColumn get title => text().withLength(min: 3, max: 64)(); @@ -181,6 +184,10 @@ class Actions extends Table { TextColumn get setWeights => text().nullable()(); BoolColumn get isAlternating => boolean().withDefault(Variable(false))(); TextColumn get tempo => text().withLength(min: 6, max: 36).nullable()(); + TextColumn get status => + textEnum().withDefault(Variable('pending'))(); + TextColumn get state => text().withDefault(Variable( + "{\"currentSet\": 0, \"currentRep\": 0, \"currentActionType\": 0, \"currentTime\": 0, \"currentAction\": 0}"))(); TextColumn get set => text()(); DateTimeColumn get createdAt => dateTime().withDefault(Variable(DateTime.now()))(); diff --git a/lib/database/database.g.dart b/lib/database/database.g.dart index 8a68ef0..19f07ce 100644 --- a/lib/database/database.g.dart +++ b/lib/database/database.g.dart @@ -1532,6 +1532,22 @@ class $ActionsTable extends Actions with TableInfo<$ActionsTable, Action> { GeneratedColumn.checkTextLength(minTextLength: 6, maxTextLength: 36), type: DriftSqlType.string, requiredDuringInsert: false); + static const VerificationMeta _statusMeta = const VerificationMeta('status'); + @override + late final GeneratedColumnWithTypeConverter status = + GeneratedColumn('status', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: Variable('pending')) + .withConverter($ActionsTable.$converterstatus); + static const VerificationMeta _stateMeta = const VerificationMeta('state'); + @override + late final GeneratedColumn state = GeneratedColumn( + 'state', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: Variable( + "{\"currentSet\": 0, \"currentRep\": 0, \"currentActionType\": 0, \"currentTime\": 0, \"currentAction\": 0}")); static const VerificationMeta _setMeta = const VerificationMeta('set'); @override late final GeneratedColumn set = GeneratedColumn( @@ -1562,6 +1578,8 @@ class $ActionsTable extends Actions with TableInfo<$ActionsTable, Action> { setWeights, isAlternating, tempo, + status, + state, set, createdAt ]; @@ -1653,6 +1671,11 @@ class $ActionsTable extends Actions with TableInfo<$ActionsTable, Action> { context.handle( _tempoMeta, tempo.isAcceptableOrUnknown(data['tempo']!, _tempoMeta)); } + context.handle(_statusMeta, const VerificationResult.success()); + if (data.containsKey('state')) { + context.handle( + _stateMeta, state.isAcceptableOrUnknown(data['state']!, _stateMeta)); + } if (data.containsKey('set')) { context.handle( _setMeta, set.isAcceptableOrUnknown(data['set']!, _setMeta)); @@ -1703,6 +1726,11 @@ class $ActionsTable extends Actions with TableInfo<$ActionsTable, Action> { .read(DriftSqlType.bool, data['${effectivePrefix}is_alternating'])!, tempo: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}tempo']), + status: $ActionsTable.$converterstatus.fromSql(attachedDatabase + .typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}status'])!), + state: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}state'])!, set: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}set'])!, createdAt: attachedDatabase.typeMapping @@ -1717,6 +1745,8 @@ class $ActionsTable extends Actions with TableInfo<$ActionsTable, Action> { static JsonTypeConverter2 $converterrepType = const EnumNameConverter(RepType.values); + static JsonTypeConverter2 $converterstatus = + const EnumNameConverter(ActionStatus.values); } class Action extends DataClass implements Insertable { @@ -1735,6 +1765,8 @@ class Action extends DataClass implements Insertable { final String? setWeights; final bool isAlternating; final String? tempo; + final ActionStatus status; + final String state; final String set; final DateTime createdAt; const Action( @@ -1753,6 +1785,8 @@ class Action extends DataClass implements Insertable { this.setWeights, required this.isAlternating, this.tempo, + required this.status, + required this.state, required this.set, required this.createdAt}); @override @@ -1792,6 +1826,11 @@ class Action extends DataClass implements Insertable { if (!nullToAbsent || tempo != null) { map['tempo'] = Variable(tempo); } + { + map['status'] = + Variable($ActionsTable.$converterstatus.toSql(status)); + } + map['state'] = Variable(state); map['set'] = Variable(set); map['created_at'] = Variable(createdAt); return map; @@ -1829,6 +1868,8 @@ class Action extends DataClass implements Insertable { isAlternating: Value(isAlternating), tempo: tempo == null && nullToAbsent ? const Value.absent() : Value(tempo), + status: Value(status), + state: Value(state), set: Value(set), createdAt: Value(createdAt), ); @@ -1854,6 +1895,9 @@ class Action extends DataClass implements Insertable { setWeights: serializer.fromJson(json['setWeights']), isAlternating: serializer.fromJson(json['isAlternating']), tempo: serializer.fromJson(json['tempo']), + status: $ActionsTable.$converterstatus + .fromJson(serializer.fromJson(json['status'])), + state: serializer.fromJson(json['state']), set: serializer.fromJson(json['set']), createdAt: serializer.fromJson(json['createdAt']), ); @@ -1878,6 +1922,9 @@ class Action extends DataClass implements Insertable { 'setWeights': serializer.toJson(setWeights), 'isAlternating': serializer.toJson(isAlternating), 'tempo': serializer.toJson(tempo), + 'status': serializer + .toJson($ActionsTable.$converterstatus.toJson(status)), + 'state': serializer.toJson(state), 'set': serializer.toJson(set), 'createdAt': serializer.toJson(createdAt), }; @@ -1899,6 +1946,8 @@ class Action extends DataClass implements Insertable { Value setWeights = const Value.absent(), bool? isAlternating, Value tempo = const Value.absent(), + ActionStatus? status, + String? state, String? set, DateTime? createdAt}) => Action( @@ -1923,6 +1972,8 @@ class Action extends DataClass implements Insertable { setWeights: setWeights.present ? setWeights.value : this.setWeights, isAlternating: isAlternating ?? this.isAlternating, tempo: tempo.present ? tempo.value : this.tempo, + status: status ?? this.status, + state: state ?? this.state, set: set ?? this.set, createdAt: createdAt ?? this.createdAt, ); @@ -1956,6 +2007,8 @@ class Action extends DataClass implements Insertable { ? data.isAlternating.value : this.isAlternating, tempo: data.tempo.present ? data.tempo.value : this.tempo, + status: data.status.present ? data.status.value : this.status, + state: data.state.present ? data.state.value : this.state, set: data.set.present ? data.set.value : this.set, createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, ); @@ -1979,6 +2032,8 @@ class Action extends DataClass implements Insertable { ..write('setWeights: $setWeights, ') ..write('isAlternating: $isAlternating, ') ..write('tempo: $tempo, ') + ..write('status: $status, ') + ..write('state: $state, ') ..write('set: $set, ') ..write('createdAt: $createdAt') ..write(')')) @@ -2002,6 +2057,8 @@ class Action extends DataClass implements Insertable { setWeights, isAlternating, tempo, + status, + state, set, createdAt); @override @@ -2023,6 +2080,8 @@ class Action extends DataClass implements Insertable { other.setWeights == this.setWeights && other.isAlternating == this.isAlternating && other.tempo == this.tempo && + other.status == this.status && + other.state == this.state && other.set == this.set && other.createdAt == this.createdAt); } @@ -2043,6 +2102,8 @@ class ActionsCompanion extends UpdateCompanion { final Value setWeights; final Value isAlternating; final Value tempo; + final Value status; + final Value state; final Value set; final Value createdAt; const ActionsCompanion({ @@ -2061,6 +2122,8 @@ class ActionsCompanion extends UpdateCompanion { this.setWeights = const Value.absent(), this.isAlternating = const Value.absent(), this.tempo = const Value.absent(), + this.status = const Value.absent(), + this.state = const Value.absent(), this.set = const Value.absent(), this.createdAt = const Value.absent(), }); @@ -2080,6 +2143,8 @@ class ActionsCompanion extends UpdateCompanion { this.setWeights = const Value.absent(), this.isAlternating = const Value.absent(), this.tempo = const Value.absent(), + this.status = const Value.absent(), + this.state = const Value.absent(), required String set, this.createdAt = const Value.absent(), }) : title = Value(title), @@ -2104,6 +2169,8 @@ class ActionsCompanion extends UpdateCompanion { Expression? setWeights, Expression? isAlternating, Expression? tempo, + Expression? status, + Expression? state, Expression? set, Expression? createdAt, }) { @@ -2123,6 +2190,8 @@ class ActionsCompanion extends UpdateCompanion { if (setWeights != null) 'set_weights': setWeights, if (isAlternating != null) 'is_alternating': isAlternating, if (tempo != null) 'tempo': tempo, + if (status != null) 'status': status, + if (state != null) 'state': state, if (set != null) 'set': set, if (createdAt != null) 'created_at': createdAt, }); @@ -2144,6 +2213,8 @@ class ActionsCompanion extends UpdateCompanion { Value? setWeights, Value? isAlternating, Value? tempo, + Value? status, + Value? state, Value? set, Value? createdAt}) { return ActionsCompanion( @@ -2162,6 +2233,8 @@ class ActionsCompanion extends UpdateCompanion { setWeights: setWeights ?? this.setWeights, isAlternating: isAlternating ?? this.isAlternating, tempo: tempo ?? this.tempo, + status: status ?? this.status, + state: state ?? this.state, set: set ?? this.set, createdAt: createdAt ?? this.createdAt, ); @@ -2216,6 +2289,13 @@ class ActionsCompanion extends UpdateCompanion { if (tempo.present) { map['tempo'] = Variable(tempo.value); } + if (status.present) { + map['status'] = + Variable($ActionsTable.$converterstatus.toSql(status.value)); + } + if (state.present) { + map['state'] = Variable(state.value); + } if (set.present) { map['set'] = Variable(set.value); } @@ -2243,6 +2323,8 @@ class ActionsCompanion extends UpdateCompanion { ..write('setWeights: $setWeights, ') ..write('isAlternating: $isAlternating, ') ..write('tempo: $tempo, ') + ..write('status: $status, ') + ..write('state: $state, ') ..write('set: $set, ') ..write('createdAt: $createdAt') ..write(')')) @@ -4412,6 +4494,8 @@ typedef $$ActionsTableCreateCompanionBuilder = ActionsCompanion Function({ Value setWeights, Value isAlternating, Value tempo, + Value status, + Value state, required String set, Value createdAt, }); @@ -4431,6 +4515,8 @@ typedef $$ActionsTableUpdateCompanionBuilder = ActionsCompanion Function({ Value setWeights, Value isAlternating, Value tempo, + Value status, + Value state, Value set, Value createdAt, }); @@ -4516,6 +4602,14 @@ class $$ActionsTableFilterComposer ColumnFilters get tempo => $composableBuilder( column: $table.tempo, builder: (column) => ColumnFilters(column)); + ColumnWithTypeConverterFilters + get status => $composableBuilder( + column: $table.status, + builder: (column) => ColumnWithTypeConverterFilters(column)); + + ColumnFilters get state => $composableBuilder( + column: $table.state, builder: (column) => ColumnFilters(column)); + ColumnFilters get set => $composableBuilder( column: $table.set, builder: (column) => ColumnFilters(column)); @@ -4603,6 +4697,12 @@ class $$ActionsTableOrderingComposer ColumnOrderings get tempo => $composableBuilder( column: $table.tempo, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get status => $composableBuilder( + column: $table.status, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get state => $composableBuilder( + column: $table.state, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get set => $composableBuilder( column: $table.set, builder: (column) => ColumnOrderings(column)); @@ -4664,6 +4764,12 @@ class $$ActionsTableAnnotationComposer GeneratedColumn get tempo => $composableBuilder(column: $table.tempo, builder: (column) => column); + GeneratedColumnWithTypeConverter get status => + $composableBuilder(column: $table.status, builder: (column) => column); + + GeneratedColumn get state => + $composableBuilder(column: $table.state, builder: (column) => column); + GeneratedColumn get set => $composableBuilder(column: $table.set, builder: (column) => column); @@ -4730,6 +4836,8 @@ class $$ActionsTableTableManager extends RootTableManager< Value setWeights = const Value.absent(), Value isAlternating = const Value.absent(), Value tempo = const Value.absent(), + Value status = const Value.absent(), + Value state = const Value.absent(), Value set = const Value.absent(), Value createdAt = const Value.absent(), }) => @@ -4749,6 +4857,8 @@ class $$ActionsTableTableManager extends RootTableManager< setWeights: setWeights, isAlternating: isAlternating, tempo: tempo, + status: status, + state: state, set: set, createdAt: createdAt, ), @@ -4768,6 +4878,8 @@ class $$ActionsTableTableManager extends RootTableManager< Value setWeights = const Value.absent(), Value isAlternating = const Value.absent(), Value tempo = const Value.absent(), + Value status = const Value.absent(), + Value state = const Value.absent(), required String set, Value createdAt = const Value.absent(), }) => @@ -4787,6 +4899,8 @@ class $$ActionsTableTableManager extends RootTableManager< setWeights: setWeights, isAlternating: isAlternating, tempo: tempo, + status: status, + state: state, set: set, createdAt: createdAt, ), diff --git a/lib/database/database.steps.dart b/lib/database/database.steps.dart index 7f6840a..a3ea27d 100644 --- a/lib/database/database.steps.dart +++ b/lib/database/database.steps.dart @@ -3494,6 +3494,1799 @@ i1.GeneratedColumn _column_53(String aliasedName) => i1.GeneratedColumn _column_54(String aliasedName) => i1.GeneratedColumn('set_weights', aliasedName, true, type: i1.DriftSqlType.string); + +final class Schema23 extends i0.VersionedSchema { + Schema23({required super.database}) : super(version: 23); + @override + late final List entities = [ + sessions, + activities, + sessionActivities, + actions, + activityActions, + mediaItems, + objectMediaItems, + ]; + late final Shape12 sessions = Shape12( + source: i0.VersionedTable( + entityName: 'sessions', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_1, + _column_2, + _column_3, + _column_11, + _column_20, + _column_4, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape17 activities = Shape17( + source: i0.VersionedTable( + entityName: 'activities', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_40, + _column_36, + _column_37, + _column_38, + _column_27, + _column_28, + _column_29, + _column_35, + _column_31, + _column_32, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape13 sessionActivities = Shape13( + source: i0.VersionedTable( + entityName: 'session_activities', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_21, + _column_22, + _column_19, + _column_10, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape20 actions = Shape20( + source: i0.VersionedTable( + entityName: 'actions', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_41, + _column_2, + _column_42, + _column_43, + _column_44, + _column_45, + _column_46, + _column_47, + _column_48, + _column_49, + _column_53, + _column_54, + _column_51, + _column_52, + _column_3, + _column_12, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape10 activityActions = Shape10( + source: i0.VersionedTable( + entityName: 'activity_actions', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_22, + _column_23, + _column_19, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape5 mediaItems = Shape5( + source: i0.VersionedTable( + entityName: 'media_items', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_41, + _column_2, + _column_25, + _column_6, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape6 objectMediaItems = Shape6( + source: i0.VersionedTable( + entityName: 'object_media_items', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_15, + _column_16, + _column_24, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); +} + +class Shape20 extends i0.VersionedTable { + Shape20({required super.source, required super.alias}) : super.aliased(); + i1.GeneratedColumn get id => + columnsByName['id']! as i1.GeneratedColumn; + i1.GeneratedColumn get title => + columnsByName['title']! as i1.GeneratedColumn; + i1.GeneratedColumn get description => + columnsByName['body']! as i1.GeneratedColumn; + i1.GeneratedColumn get totalSets => + columnsByName['total_sets']! as i1.GeneratedColumn; + i1.GeneratedColumn get totalReps => + columnsByName['total_reps']! as i1.GeneratedColumn; + i1.GeneratedColumn get restBeforeSets => + columnsByName['rest_before_sets']! as i1.GeneratedColumn; + i1.GeneratedColumn get restBetweenSets => + columnsByName['rest_between_sets']! as i1.GeneratedColumn; + i1.GeneratedColumn get restBetweenReps => + columnsByName['rest_between_reps']! as i1.GeneratedColumn; + i1.GeneratedColumn get restAfterSets => + columnsByName['rest_after_sets']! as i1.GeneratedColumn; + i1.GeneratedColumn get repType => + columnsByName['rep_type']! as i1.GeneratedColumn; + i1.GeneratedColumn get repLength => + columnsByName['rep_length']! as i1.GeneratedColumn; + i1.GeneratedColumn get repWeights => + columnsByName['rep_weights']! as i1.GeneratedColumn; + i1.GeneratedColumn get setWeights => + columnsByName['set_weights']! as i1.GeneratedColumn; + i1.GeneratedColumn get isAlternating => + columnsByName['is_alternating']! as i1.GeneratedColumn; + i1.GeneratedColumn get tempo => + columnsByName['tempo']! as i1.GeneratedColumn; + i1.GeneratedColumn get status => + columnsByName['status']! as i1.GeneratedColumn; + i1.GeneratedColumn get set => + columnsByName['set']! as i1.GeneratedColumn; + i1.GeneratedColumn get createdAt => + columnsByName['created_at']! as i1.GeneratedColumn; +} + +final class Schema24 extends i0.VersionedSchema { + Schema24({required super.database}) : super(version: 24); + @override + late final List entities = [ + sessions, + activities, + sessionActivities, + actions, + activityActions, + mediaItems, + objectMediaItems, + ]; + late final Shape12 sessions = Shape12( + source: i0.VersionedTable( + entityName: 'sessions', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_1, + _column_2, + _column_3, + _column_11, + _column_20, + _column_4, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape17 activities = Shape17( + source: i0.VersionedTable( + entityName: 'activities', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_40, + _column_36, + _column_37, + _column_38, + _column_27, + _column_28, + _column_29, + _column_35, + _column_31, + _column_32, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape13 sessionActivities = Shape13( + source: i0.VersionedTable( + entityName: 'session_activities', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_21, + _column_22, + _column_19, + _column_10, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape20 actions = Shape20( + source: i0.VersionedTable( + entityName: 'actions', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_41, + _column_2, + _column_42, + _column_43, + _column_44, + _column_45, + _column_46, + _column_47, + _column_48, + _column_49, + _column_53, + _column_54, + _column_51, + _column_52, + _column_55, + _column_12, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape10 activityActions = Shape10( + source: i0.VersionedTable( + entityName: 'activity_actions', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_22, + _column_23, + _column_19, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape5 mediaItems = Shape5( + source: i0.VersionedTable( + entityName: 'media_items', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_41, + _column_2, + _column_25, + _column_6, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape6 objectMediaItems = Shape6( + source: i0.VersionedTable( + entityName: 'object_media_items', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_15, + _column_16, + _column_24, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); +} + +i1.GeneratedColumn _column_55(String aliasedName) => + i1.GeneratedColumn('status', aliasedName, false, + type: i1.DriftSqlType.string, + defaultValue: Variable(ActionStatus.pending.toString())); + +final class Schema25 extends i0.VersionedSchema { + Schema25({required super.database}) : super(version: 25); + @override + late final List entities = [ + sessions, + activities, + sessionActivities, + actions, + activityActions, + mediaItems, + objectMediaItems, + ]; + late final Shape12 sessions = Shape12( + source: i0.VersionedTable( + entityName: 'sessions', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_1, + _column_2, + _column_3, + _column_11, + _column_20, + _column_4, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape17 activities = Shape17( + source: i0.VersionedTable( + entityName: 'activities', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_40, + _column_36, + _column_37, + _column_38, + _column_27, + _column_28, + _column_29, + _column_35, + _column_31, + _column_32, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape13 sessionActivities = Shape13( + source: i0.VersionedTable( + entityName: 'session_activities', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_21, + _column_22, + _column_19, + _column_10, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape21 actions = Shape21( + source: i0.VersionedTable( + entityName: 'actions', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_41, + _column_2, + _column_42, + _column_43, + _column_44, + _column_45, + _column_46, + _column_47, + _column_48, + _column_49, + _column_53, + _column_54, + _column_51, + _column_52, + _column_55, + _column_56, + _column_12, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape10 activityActions = Shape10( + source: i0.VersionedTable( + entityName: 'activity_actions', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_22, + _column_23, + _column_19, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape5 mediaItems = Shape5( + source: i0.VersionedTable( + entityName: 'media_items', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_41, + _column_2, + _column_25, + _column_6, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape6 objectMediaItems = Shape6( + source: i0.VersionedTable( + entityName: 'object_media_items', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_15, + _column_16, + _column_24, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); +} + +class Shape21 extends i0.VersionedTable { + Shape21({required super.source, required super.alias}) : super.aliased(); + i1.GeneratedColumn get id => + columnsByName['id']! as i1.GeneratedColumn; + i1.GeneratedColumn get title => + columnsByName['title']! as i1.GeneratedColumn; + i1.GeneratedColumn get description => + columnsByName['body']! as i1.GeneratedColumn; + i1.GeneratedColumn get totalSets => + columnsByName['total_sets']! as i1.GeneratedColumn; + i1.GeneratedColumn get totalReps => + columnsByName['total_reps']! as i1.GeneratedColumn; + i1.GeneratedColumn get restBeforeSets => + columnsByName['rest_before_sets']! as i1.GeneratedColumn; + i1.GeneratedColumn get restBetweenSets => + columnsByName['rest_between_sets']! as i1.GeneratedColumn; + i1.GeneratedColumn get restBetweenReps => + columnsByName['rest_between_reps']! as i1.GeneratedColumn; + i1.GeneratedColumn get restAfterSets => + columnsByName['rest_after_sets']! as i1.GeneratedColumn; + i1.GeneratedColumn get repType => + columnsByName['rep_type']! as i1.GeneratedColumn; + i1.GeneratedColumn get repLength => + columnsByName['rep_length']! as i1.GeneratedColumn; + i1.GeneratedColumn get repWeights => + columnsByName['rep_weights']! as i1.GeneratedColumn; + i1.GeneratedColumn get setWeights => + columnsByName['set_weights']! as i1.GeneratedColumn; + i1.GeneratedColumn get isAlternating => + columnsByName['is_alternating']! as i1.GeneratedColumn; + i1.GeneratedColumn get tempo => + columnsByName['tempo']! as i1.GeneratedColumn; + i1.GeneratedColumn get status => + columnsByName['status']! as i1.GeneratedColumn; + i1.GeneratedColumn get state => + columnsByName['state']! as i1.GeneratedColumn; + i1.GeneratedColumn get set => + columnsByName['set']! as i1.GeneratedColumn; + i1.GeneratedColumn get createdAt => + columnsByName['created_at']! as i1.GeneratedColumn; +} + +i1.GeneratedColumn _column_56(String aliasedName) => + i1.GeneratedColumn('state', aliasedName, true, + type: i1.DriftSqlType.string); + +final class Schema26 extends i0.VersionedSchema { + Schema26({required super.database}) : super(version: 26); + @override + late final List entities = [ + sessions, + activities, + sessionActivities, + actions, + activityActions, + mediaItems, + objectMediaItems, + ]; + late final Shape12 sessions = Shape12( + source: i0.VersionedTable( + entityName: 'sessions', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_1, + _column_2, + _column_3, + _column_11, + _column_20, + _column_4, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape17 activities = Shape17( + source: i0.VersionedTable( + entityName: 'activities', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_40, + _column_36, + _column_37, + _column_38, + _column_27, + _column_28, + _column_29, + _column_35, + _column_31, + _column_32, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape13 sessionActivities = Shape13( + source: i0.VersionedTable( + entityName: 'session_activities', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_21, + _column_22, + _column_19, + _column_10, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape21 actions = Shape21( + source: i0.VersionedTable( + entityName: 'actions', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_41, + _column_2, + _column_42, + _column_43, + _column_44, + _column_45, + _column_46, + _column_47, + _column_48, + _column_49, + _column_53, + _column_54, + _column_51, + _column_52, + _column_55, + _column_57, + _column_12, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape10 activityActions = Shape10( + source: i0.VersionedTable( + entityName: 'activity_actions', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_22, + _column_23, + _column_19, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape5 mediaItems = Shape5( + source: i0.VersionedTable( + entityName: 'media_items', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_41, + _column_2, + _column_25, + _column_6, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape6 objectMediaItems = Shape6( + source: i0.VersionedTable( + entityName: 'object_media_items', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_15, + _column_16, + _column_24, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); +} + +i1.GeneratedColumn _column_57(String aliasedName) => + i1.GeneratedColumn('state', aliasedName, false, + type: i1.DriftSqlType.string, defaultValue: Variable("{}")); + +final class Schema27 extends i0.VersionedSchema { + Schema27({required super.database}) : super(version: 27); + @override + late final List entities = [ + sessions, + activities, + sessionActivities, + actions, + activityActions, + mediaItems, + objectMediaItems, + ]; + late final Shape12 sessions = Shape12( + source: i0.VersionedTable( + entityName: 'sessions', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_1, + _column_2, + _column_3, + _column_11, + _column_20, + _column_4, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape17 activities = Shape17( + source: i0.VersionedTable( + entityName: 'activities', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_40, + _column_36, + _column_37, + _column_38, + _column_27, + _column_28, + _column_29, + _column_35, + _column_31, + _column_32, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape13 sessionActivities = Shape13( + source: i0.VersionedTable( + entityName: 'session_activities', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_21, + _column_22, + _column_19, + _column_10, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape21 actions = Shape21( + source: i0.VersionedTable( + entityName: 'actions', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_41, + _column_2, + _column_42, + _column_43, + _column_44, + _column_45, + _column_46, + _column_47, + _column_48, + _column_49, + _column_53, + _column_54, + _column_51, + _column_52, + _column_58, + _column_57, + _column_12, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape10 activityActions = Shape10( + source: i0.VersionedTable( + entityName: 'activity_actions', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_22, + _column_23, + _column_19, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape5 mediaItems = Shape5( + source: i0.VersionedTable( + entityName: 'media_items', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_41, + _column_2, + _column_25, + _column_6, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape6 objectMediaItems = Shape6( + source: i0.VersionedTable( + entityName: 'object_media_items', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_15, + _column_16, + _column_24, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); +} + +i1.GeneratedColumn _column_58(String aliasedName) => + i1.GeneratedColumn('status', aliasedName, false, + type: i1.DriftSqlType.string, defaultValue: Variable('pending')); + +final class Schema28 extends i0.VersionedSchema { + Schema28({required super.database}) : super(version: 28); + @override + late final List entities = [ + sessions, + activities, + sessionActivities, + actions, + activityActions, + mediaItems, + objectMediaItems, + ]; + late final Shape12 sessions = Shape12( + source: i0.VersionedTable( + entityName: 'sessions', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_1, + _column_2, + _column_3, + _column_11, + _column_20, + _column_4, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape17 activities = Shape17( + source: i0.VersionedTable( + entityName: 'activities', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_40, + _column_36, + _column_37, + _column_38, + _column_27, + _column_28, + _column_29, + _column_35, + _column_31, + _column_32, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape13 sessionActivities = Shape13( + source: i0.VersionedTable( + entityName: 'session_activities', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_21, + _column_22, + _column_19, + _column_10, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape21 actions = Shape21( + source: i0.VersionedTable( + entityName: 'actions', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_41, + _column_2, + _column_42, + _column_43, + _column_44, + _column_45, + _column_46, + _column_47, + _column_48, + _column_49, + _column_53, + _column_54, + _column_51, + _column_52, + _column_58, + _column_57, + _column_12, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape10 activityActions = Shape10( + source: i0.VersionedTable( + entityName: 'activity_actions', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_22, + _column_23, + _column_19, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape5 mediaItems = Shape5( + source: i0.VersionedTable( + entityName: 'media_items', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_41, + _column_2, + _column_25, + _column_6, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape6 objectMediaItems = Shape6( + source: i0.VersionedTable( + entityName: 'object_media_items', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_15, + _column_16, + _column_24, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); +} + +final class Schema29 extends i0.VersionedSchema { + Schema29({required super.database}) : super(version: 29); + @override + late final List entities = [ + sessions, + activities, + sessionActivities, + actions, + activityActions, + mediaItems, + objectMediaItems, + ]; + late final Shape12 sessions = Shape12( + source: i0.VersionedTable( + entityName: 'sessions', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_1, + _column_2, + _column_3, + _column_11, + _column_20, + _column_4, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape17 activities = Shape17( + source: i0.VersionedTable( + entityName: 'activities', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_40, + _column_36, + _column_37, + _column_38, + _column_27, + _column_28, + _column_29, + _column_35, + _column_31, + _column_32, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape13 sessionActivities = Shape13( + source: i0.VersionedTable( + entityName: 'session_activities', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_21, + _column_22, + _column_19, + _column_10, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape21 actions = Shape21( + source: i0.VersionedTable( + entityName: 'actions', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_41, + _column_2, + _column_42, + _column_43, + _column_44, + _column_45, + _column_46, + _column_47, + _column_48, + _column_49, + _column_53, + _column_54, + _column_51, + _column_52, + _column_58, + _column_59, + _column_12, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape10 activityActions = Shape10( + source: i0.VersionedTable( + entityName: 'activity_actions', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_22, + _column_23, + _column_19, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape5 mediaItems = Shape5( + source: i0.VersionedTable( + entityName: 'media_items', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_41, + _column_2, + _column_25, + _column_6, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape6 objectMediaItems = Shape6( + source: i0.VersionedTable( + entityName: 'object_media_items', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_15, + _column_16, + _column_24, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); +} + +i1.GeneratedColumn _column_59(String aliasedName) => + i1.GeneratedColumn('state', aliasedName, false, + type: i1.DriftSqlType.string, + defaultValue: + Variable("{'currentSet': 1, 'currentRep': 1, 'currentTime': 0}")); + +final class Schema30 extends i0.VersionedSchema { + Schema30({required super.database}) : super(version: 30); + @override + late final List entities = [ + sessions, + activities, + sessionActivities, + actions, + activityActions, + mediaItems, + objectMediaItems, + ]; + late final Shape12 sessions = Shape12( + source: i0.VersionedTable( + entityName: 'sessions', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_1, + _column_2, + _column_3, + _column_11, + _column_20, + _column_4, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape17 activities = Shape17( + source: i0.VersionedTable( + entityName: 'activities', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_40, + _column_36, + _column_37, + _column_38, + _column_27, + _column_28, + _column_29, + _column_35, + _column_31, + _column_32, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape13 sessionActivities = Shape13( + source: i0.VersionedTable( + entityName: 'session_activities', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_21, + _column_22, + _column_19, + _column_10, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape21 actions = Shape21( + source: i0.VersionedTable( + entityName: 'actions', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_41, + _column_2, + _column_42, + _column_43, + _column_44, + _column_45, + _column_46, + _column_47, + _column_48, + _column_49, + _column_53, + _column_54, + _column_51, + _column_52, + _column_58, + _column_59, + _column_12, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape10 activityActions = Shape10( + source: i0.VersionedTable( + entityName: 'activity_actions', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_22, + _column_23, + _column_19, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape5 mediaItems = Shape5( + source: i0.VersionedTable( + entityName: 'media_items', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_41, + _column_2, + _column_25, + _column_6, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape6 objectMediaItems = Shape6( + source: i0.VersionedTable( + entityName: 'object_media_items', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_15, + _column_16, + _column_24, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); +} + +final class Schema31 extends i0.VersionedSchema { + Schema31({required super.database}) : super(version: 31); + @override + late final List entities = [ + sessions, + activities, + sessionActivities, + actions, + activityActions, + mediaItems, + objectMediaItems, + ]; + late final Shape12 sessions = Shape12( + source: i0.VersionedTable( + entityName: 'sessions', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_1, + _column_2, + _column_3, + _column_11, + _column_20, + _column_4, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape17 activities = Shape17( + source: i0.VersionedTable( + entityName: 'activities', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_40, + _column_36, + _column_37, + _column_38, + _column_27, + _column_28, + _column_29, + _column_35, + _column_31, + _column_32, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape13 sessionActivities = Shape13( + source: i0.VersionedTable( + entityName: 'session_activities', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_21, + _column_22, + _column_19, + _column_10, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape21 actions = Shape21( + source: i0.VersionedTable( + entityName: 'actions', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_41, + _column_2, + _column_42, + _column_43, + _column_44, + _column_45, + _column_46, + _column_47, + _column_48, + _column_49, + _column_53, + _column_54, + _column_51, + _column_52, + _column_58, + _column_60, + _column_12, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape10 activityActions = Shape10( + source: i0.VersionedTable( + entityName: 'activity_actions', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_22, + _column_23, + _column_19, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape5 mediaItems = Shape5( + source: i0.VersionedTable( + entityName: 'media_items', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_41, + _column_2, + _column_25, + _column_6, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape6 objectMediaItems = Shape6( + source: i0.VersionedTable( + entityName: 'object_media_items', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_15, + _column_16, + _column_24, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); +} + +i1.GeneratedColumn _column_60(String aliasedName) => + i1.GeneratedColumn('state', aliasedName, false, + type: i1.DriftSqlType.string, + defaultValue: Variable( + "{\"currentSet\": 1, \"currentRep\": 1, \"currentTime\": 0}")); + +final class Schema32 extends i0.VersionedSchema { + Schema32({required super.database}) : super(version: 32); + @override + late final List entities = [ + sessions, + activities, + sessionActivities, + actions, + activityActions, + mediaItems, + objectMediaItems, + ]; + late final Shape12 sessions = Shape12( + source: i0.VersionedTable( + entityName: 'sessions', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_1, + _column_2, + _column_3, + _column_11, + _column_20, + _column_4, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape17 activities = Shape17( + source: i0.VersionedTable( + entityName: 'activities', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_40, + _column_36, + _column_37, + _column_38, + _column_27, + _column_28, + _column_29, + _column_35, + _column_31, + _column_32, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape13 sessionActivities = Shape13( + source: i0.VersionedTable( + entityName: 'session_activities', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_21, + _column_22, + _column_19, + _column_10, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape21 actions = Shape21( + source: i0.VersionedTable( + entityName: 'actions', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_41, + _column_2, + _column_42, + _column_43, + _column_44, + _column_45, + _column_46, + _column_47, + _column_48, + _column_49, + _column_53, + _column_54, + _column_51, + _column_52, + _column_58, + _column_61, + _column_12, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape10 activityActions = Shape10( + source: i0.VersionedTable( + entityName: 'activity_actions', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_22, + _column_23, + _column_19, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape5 mediaItems = Shape5( + source: i0.VersionedTable( + entityName: 'media_items', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_41, + _column_2, + _column_25, + _column_6, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape6 objectMediaItems = Shape6( + source: i0.VersionedTable( + entityName: 'object_media_items', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_15, + _column_16, + _column_24, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); +} + +i1.GeneratedColumn _column_61(String aliasedName) => i1.GeneratedColumn< + String>('state', aliasedName, false, + type: i1.DriftSqlType.string, + defaultValue: Variable( + "{\"currentSet\": 1, \"currentRep\": 1, \"currentTime\": 0, \"currentAction\": 0}")); + +final class Schema33 extends i0.VersionedSchema { + Schema33({required super.database}) : super(version: 33); + @override + late final List entities = [ + sessions, + activities, + sessionActivities, + actions, + activityActions, + mediaItems, + objectMediaItems, + ]; + late final Shape12 sessions = Shape12( + source: i0.VersionedTable( + entityName: 'sessions', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_1, + _column_2, + _column_3, + _column_11, + _column_20, + _column_4, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape17 activities = Shape17( + source: i0.VersionedTable( + entityName: 'activities', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_40, + _column_36, + _column_37, + _column_38, + _column_27, + _column_28, + _column_29, + _column_35, + _column_31, + _column_32, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape13 sessionActivities = Shape13( + source: i0.VersionedTable( + entityName: 'session_activities', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_21, + _column_22, + _column_19, + _column_10, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape21 actions = Shape21( + source: i0.VersionedTable( + entityName: 'actions', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_41, + _column_2, + _column_42, + _column_43, + _column_44, + _column_45, + _column_46, + _column_47, + _column_48, + _column_49, + _column_53, + _column_54, + _column_51, + _column_52, + _column_58, + _column_62, + _column_12, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape10 activityActions = Shape10( + source: i0.VersionedTable( + entityName: 'activity_actions', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_22, + _column_23, + _column_19, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape5 mediaItems = Shape5( + source: i0.VersionedTable( + entityName: 'media_items', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_41, + _column_2, + _column_25, + _column_6, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape6 objectMediaItems = Shape6( + source: i0.VersionedTable( + entityName: 'object_media_items', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_15, + _column_16, + _column_24, + _column_5, + ], + attachedDatabase: database, + ), + alias: null); +} + +i1.GeneratedColumn _column_62(String aliasedName) => i1.GeneratedColumn< + String>('state', aliasedName, false, + type: i1.DriftSqlType.string, + defaultValue: Variable( + "{\"currentSet\": 0, \"currentRep\": 0, \"currentActionType\": 0, \"currentTime\": 0, \"currentAction\": 0}")); i0.MigrationStepWithVersion migrationSteps({ required Future Function(i1.Migrator m, Schema2 schema) from1To2, required Future Function(i1.Migrator m, Schema3 schema) from2To3, @@ -3516,6 +5309,17 @@ i0.MigrationStepWithVersion migrationSteps({ required Future Function(i1.Migrator m, Schema20 schema) from19To20, required Future Function(i1.Migrator m, Schema21 schema) from20To21, required Future Function(i1.Migrator m, Schema22 schema) from21To22, + required Future Function(i1.Migrator m, Schema23 schema) from22To23, + required Future Function(i1.Migrator m, Schema24 schema) from23To24, + required Future Function(i1.Migrator m, Schema25 schema) from24To25, + required Future Function(i1.Migrator m, Schema26 schema) from25To26, + required Future Function(i1.Migrator m, Schema27 schema) from26To27, + required Future Function(i1.Migrator m, Schema28 schema) from27To28, + required Future Function(i1.Migrator m, Schema29 schema) from28To29, + required Future Function(i1.Migrator m, Schema30 schema) from29To30, + required Future Function(i1.Migrator m, Schema31 schema) from30To31, + required Future Function(i1.Migrator m, Schema32 schema) from31To32, + required Future Function(i1.Migrator m, Schema33 schema) from32To33, }) { return (currentVersion, database) async { switch (currentVersion) { @@ -3624,6 +5428,61 @@ i0.MigrationStepWithVersion migrationSteps({ final migrator = i1.Migrator(database, schema); await from21To22(migrator, schema); return 22; + case 22: + final schema = Schema23(database: database); + final migrator = i1.Migrator(database, schema); + await from22To23(migrator, schema); + return 23; + case 23: + final schema = Schema24(database: database); + final migrator = i1.Migrator(database, schema); + await from23To24(migrator, schema); + return 24; + case 24: + final schema = Schema25(database: database); + final migrator = i1.Migrator(database, schema); + await from24To25(migrator, schema); + return 25; + case 25: + final schema = Schema26(database: database); + final migrator = i1.Migrator(database, schema); + await from25To26(migrator, schema); + return 26; + case 26: + final schema = Schema27(database: database); + final migrator = i1.Migrator(database, schema); + await from26To27(migrator, schema); + return 27; + case 27: + final schema = Schema28(database: database); + final migrator = i1.Migrator(database, schema); + await from27To28(migrator, schema); + return 28; + case 28: + final schema = Schema29(database: database); + final migrator = i1.Migrator(database, schema); + await from28To29(migrator, schema); + return 29; + case 29: + final schema = Schema30(database: database); + final migrator = i1.Migrator(database, schema); + await from29To30(migrator, schema); + return 30; + case 30: + final schema = Schema31(database: database); + final migrator = i1.Migrator(database, schema); + await from30To31(migrator, schema); + return 31; + case 31: + final schema = Schema32(database: database); + final migrator = i1.Migrator(database, schema); + await from31To32(migrator, schema); + return 32; + case 32: + final schema = Schema33(database: database); + final migrator = i1.Migrator(database, schema); + await from32To33(migrator, schema); + return 33; default: throw ArgumentError.value('Unknown migration from $currentVersion'); } @@ -3652,6 +5511,17 @@ i1.OnUpgrade stepByStep({ required Future Function(i1.Migrator m, Schema20 schema) from19To20, required Future Function(i1.Migrator m, Schema21 schema) from20To21, required Future Function(i1.Migrator m, Schema22 schema) from21To22, + required Future Function(i1.Migrator m, Schema23 schema) from22To23, + required Future Function(i1.Migrator m, Schema24 schema) from23To24, + required Future Function(i1.Migrator m, Schema25 schema) from24To25, + required Future Function(i1.Migrator m, Schema26 schema) from25To26, + required Future Function(i1.Migrator m, Schema27 schema) from26To27, + required Future Function(i1.Migrator m, Schema28 schema) from27To28, + required Future Function(i1.Migrator m, Schema29 schema) from28To29, + required Future Function(i1.Migrator m, Schema30 schema) from29To30, + required Future Function(i1.Migrator m, Schema31 schema) from30To31, + required Future Function(i1.Migrator m, Schema32 schema) from31To32, + required Future Function(i1.Migrator m, Schema33 schema) from32To33, }) => i0.VersionedSchema.stepByStepHelper( step: migrationSteps( @@ -3676,4 +5546,15 @@ i1.OnUpgrade stepByStep({ from19To20: from19To20, from20To21: from20To21, from21To22: from21To22, + from22To23: from22To23, + from23To24: from23To24, + from24To25: from24To25, + from25To26: from25To26, + from26To27: from26To27, + from27To28: from27To28, + from28To29: from28To29, + from29To30: from29To30, + from30To31: from30To31, + from31To32: from31To32, + from32To33: from32To33, )); diff --git a/lib/database/drift_schemas/sendtrain/drift_schema_v23.json b/lib/database/drift_schemas/sendtrain/drift_schema_v23.json new file mode 100644 index 0000000..b184cbd --- /dev/null +++ b/lib/database/drift_schemas/sendtrain/drift_schema_v23.json @@ -0,0 +1 @@ +{"_meta":{"description":"This file contains a serialized version of schema entities for drift.","version":"1.2.0"},"options":{"store_date_time_values_as_text":false},"entities":[{"id":0,"references":[],"type":"table","data":{"name":"sessions","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":32}}]},{"name":"body","getter_name":"content","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"status","getter_name":"status","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(SessionStatus.values)","dart_type_name":"SessionStatus"}},{"name":"achievements","getter_name":"achievements","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"address","getter_name":"address","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":256}}]},{"name":"date","getter_name":"date","moor_type":"dateTime","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":1,"references":[],"type":"table","data":{"name":"activities","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":100}}]},{"name":"type","getter_name":"type","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityType.values)","dart_type_name":"ActivityType"}},{"name":"body","getter_name":"description","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"category","getter_name":"category","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityCategories.values)","dart_type_name":"ActivityCategories"}},{"name":"force","getter_name":"force","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"level","getter_name":"level","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityLevel.values)","dart_type_name":"ActivityLevel"}},{"name":"mechanic","getter_name":"mechanic","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityMechanic.values)","dart_type_name":"ActivityMechanic"}},{"name":"equipment","getter_name":"equipment","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityEquipment.values)","dart_type_name":"ActivityEquipment"}},{"name":"primary_muscles","getter_name":"primaryMuscles","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityMuscle.values)","dart_type_name":"ActivityMuscle"}},{"name":"secondary_muscles","getter_name":"secondaryMuscles","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityMuscle.values)","dart_type_name":"ActivityMuscle"}},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":2,"references":[0,1],"type":"table","data":{"name":"session_activities","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"session_id","getter_name":"sessionId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES sessions (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES sessions (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"activity_id","getter_name":"activityId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES activities (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES activities (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"position","getter_name":"position","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"results","getter_name":"results","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":3,"references":[],"type":"table","data":{"name":"actions","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":64}}]},{"name":"body","getter_name":"description","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"total_sets","getter_name":"totalSets","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"total_reps","getter_name":"totalReps","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":1,"max":32}}]},{"name":"rest_before_sets","getter_name":"restBeforeSets","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rest_between_sets","getter_name":"restBetweenSets","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rest_between_reps","getter_name":"restBetweenReps","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rest_after_sets","getter_name":"restAfterSets","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rep_type","getter_name":"repType","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(RepType.values)","dart_type_name":"RepType"}},{"name":"rep_length","getter_name":"repLength","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rep_weights","getter_name":"repWeights","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"set_weights","getter_name":"setWeights","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"is_alternating","getter_name":"isAlternating","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"is_alternating\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"is_alternating\" IN (0, 1))"},"default_dart":"Variable(false)","default_client_dart":null,"dsl_features":[]},{"name":"tempo","getter_name":"tempo","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":6,"max":36}}]},{"name":"status","getter_name":"status","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActionStatus.values)","dart_type_name":"ActionStatus"}},{"name":"set","getter_name":"set","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":4,"references":[1,3],"type":"table","data":{"name":"activity_actions","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"activity_id","getter_name":"activityId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES activities (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES activities (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"action_id","getter_name":"actionId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES actions (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES actions (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"position","getter_name":"position","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":5,"references":[],"type":"table","data":{"name":"media_items","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":64}}]},{"name":"body","getter_name":"description","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"reference","getter_name":"reference","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"type","getter_name":"type","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(MediaType.values)","dart_type_name":"MediaType"}},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":6,"references":[5],"type":"table","data":{"name":"object_media_items","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"object_id","getter_name":"objectId","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"object_type","getter_name":"objectType","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ObjectType.values)","dart_type_name":"ObjectType"}},{"name":"media_id","getter_name":"mediaId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES media_items (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES media_items (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}}]} \ No newline at end of file diff --git a/lib/database/drift_schemas/sendtrain/drift_schema_v24.json b/lib/database/drift_schemas/sendtrain/drift_schema_v24.json new file mode 100644 index 0000000..7c541e0 --- /dev/null +++ b/lib/database/drift_schemas/sendtrain/drift_schema_v24.json @@ -0,0 +1 @@ +{"_meta":{"description":"This file contains a serialized version of schema entities for drift.","version":"1.2.0"},"options":{"store_date_time_values_as_text":false},"entities":[{"id":0,"references":[],"type":"table","data":{"name":"sessions","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":32}}]},{"name":"body","getter_name":"content","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"status","getter_name":"status","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(SessionStatus.values)","dart_type_name":"SessionStatus"}},{"name":"achievements","getter_name":"achievements","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"address","getter_name":"address","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":256}}]},{"name":"date","getter_name":"date","moor_type":"dateTime","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":1,"references":[],"type":"table","data":{"name":"activities","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":100}}]},{"name":"type","getter_name":"type","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityType.values)","dart_type_name":"ActivityType"}},{"name":"body","getter_name":"description","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"category","getter_name":"category","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityCategories.values)","dart_type_name":"ActivityCategories"}},{"name":"force","getter_name":"force","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"level","getter_name":"level","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityLevel.values)","dart_type_name":"ActivityLevel"}},{"name":"mechanic","getter_name":"mechanic","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityMechanic.values)","dart_type_name":"ActivityMechanic"}},{"name":"equipment","getter_name":"equipment","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityEquipment.values)","dart_type_name":"ActivityEquipment"}},{"name":"primary_muscles","getter_name":"primaryMuscles","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityMuscle.values)","dart_type_name":"ActivityMuscle"}},{"name":"secondary_muscles","getter_name":"secondaryMuscles","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityMuscle.values)","dart_type_name":"ActivityMuscle"}},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":2,"references":[0,1],"type":"table","data":{"name":"session_activities","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"session_id","getter_name":"sessionId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES sessions (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES sessions (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"activity_id","getter_name":"activityId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES activities (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES activities (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"position","getter_name":"position","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"results","getter_name":"results","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":3,"references":[],"type":"table","data":{"name":"actions","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":64}}]},{"name":"body","getter_name":"description","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"total_sets","getter_name":"totalSets","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"total_reps","getter_name":"totalReps","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":1,"max":32}}]},{"name":"rest_before_sets","getter_name":"restBeforeSets","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rest_between_sets","getter_name":"restBetweenSets","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rest_between_reps","getter_name":"restBetweenReps","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rest_after_sets","getter_name":"restAfterSets","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rep_type","getter_name":"repType","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(RepType.values)","dart_type_name":"RepType"}},{"name":"rep_length","getter_name":"repLength","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rep_weights","getter_name":"repWeights","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"set_weights","getter_name":"setWeights","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"is_alternating","getter_name":"isAlternating","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"is_alternating\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"is_alternating\" IN (0, 1))"},"default_dart":"Variable(false)","default_client_dart":null,"dsl_features":[]},{"name":"tempo","getter_name":"tempo","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":6,"max":36}}]},{"name":"status","getter_name":"status","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"Variable(ActionStatus.pending.toString())","default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActionStatus.values)","dart_type_name":"ActionStatus"}},{"name":"set","getter_name":"set","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":4,"references":[1,3],"type":"table","data":{"name":"activity_actions","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"activity_id","getter_name":"activityId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES activities (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES activities (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"action_id","getter_name":"actionId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES actions (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES actions (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"position","getter_name":"position","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":5,"references":[],"type":"table","data":{"name":"media_items","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":64}}]},{"name":"body","getter_name":"description","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"reference","getter_name":"reference","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"type","getter_name":"type","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(MediaType.values)","dart_type_name":"MediaType"}},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":6,"references":[5],"type":"table","data":{"name":"object_media_items","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"object_id","getter_name":"objectId","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"object_type","getter_name":"objectType","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ObjectType.values)","dart_type_name":"ObjectType"}},{"name":"media_id","getter_name":"mediaId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES media_items (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES media_items (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}}]} \ No newline at end of file diff --git a/lib/database/drift_schemas/sendtrain/drift_schema_v25.json b/lib/database/drift_schemas/sendtrain/drift_schema_v25.json new file mode 100644 index 0000000..aef1999 --- /dev/null +++ b/lib/database/drift_schemas/sendtrain/drift_schema_v25.json @@ -0,0 +1 @@ +{"_meta":{"description":"This file contains a serialized version of schema entities for drift.","version":"1.2.0"},"options":{"store_date_time_values_as_text":false},"entities":[{"id":0,"references":[],"type":"table","data":{"name":"sessions","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":32}}]},{"name":"body","getter_name":"content","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"status","getter_name":"status","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(SessionStatus.values)","dart_type_name":"SessionStatus"}},{"name":"achievements","getter_name":"achievements","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"address","getter_name":"address","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":256}}]},{"name":"date","getter_name":"date","moor_type":"dateTime","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":1,"references":[],"type":"table","data":{"name":"activities","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":100}}]},{"name":"type","getter_name":"type","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityType.values)","dart_type_name":"ActivityType"}},{"name":"body","getter_name":"description","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"category","getter_name":"category","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityCategories.values)","dart_type_name":"ActivityCategories"}},{"name":"force","getter_name":"force","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"level","getter_name":"level","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityLevel.values)","dart_type_name":"ActivityLevel"}},{"name":"mechanic","getter_name":"mechanic","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityMechanic.values)","dart_type_name":"ActivityMechanic"}},{"name":"equipment","getter_name":"equipment","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityEquipment.values)","dart_type_name":"ActivityEquipment"}},{"name":"primary_muscles","getter_name":"primaryMuscles","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityMuscle.values)","dart_type_name":"ActivityMuscle"}},{"name":"secondary_muscles","getter_name":"secondaryMuscles","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityMuscle.values)","dart_type_name":"ActivityMuscle"}},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":2,"references":[0,1],"type":"table","data":{"name":"session_activities","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"session_id","getter_name":"sessionId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES sessions (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES sessions (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"activity_id","getter_name":"activityId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES activities (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES activities (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"position","getter_name":"position","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"results","getter_name":"results","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":3,"references":[],"type":"table","data":{"name":"actions","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":64}}]},{"name":"body","getter_name":"description","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"total_sets","getter_name":"totalSets","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"total_reps","getter_name":"totalReps","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":1,"max":32}}]},{"name":"rest_before_sets","getter_name":"restBeforeSets","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rest_between_sets","getter_name":"restBetweenSets","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rest_between_reps","getter_name":"restBetweenReps","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rest_after_sets","getter_name":"restAfterSets","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rep_type","getter_name":"repType","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(RepType.values)","dart_type_name":"RepType"}},{"name":"rep_length","getter_name":"repLength","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rep_weights","getter_name":"repWeights","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"set_weights","getter_name":"setWeights","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"is_alternating","getter_name":"isAlternating","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"is_alternating\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"is_alternating\" IN (0, 1))"},"default_dart":"Variable(false)","default_client_dart":null,"dsl_features":[]},{"name":"tempo","getter_name":"tempo","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":6,"max":36}}]},{"name":"status","getter_name":"status","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"Variable(ActionStatus.pending.toString())","default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActionStatus.values)","dart_type_name":"ActionStatus"}},{"name":"state","getter_name":"state","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"set","getter_name":"set","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":4,"references":[1,3],"type":"table","data":{"name":"activity_actions","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"activity_id","getter_name":"activityId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES activities (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES activities (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"action_id","getter_name":"actionId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES actions (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES actions (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"position","getter_name":"position","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":5,"references":[],"type":"table","data":{"name":"media_items","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":64}}]},{"name":"body","getter_name":"description","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"reference","getter_name":"reference","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"type","getter_name":"type","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(MediaType.values)","dart_type_name":"MediaType"}},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":6,"references":[5],"type":"table","data":{"name":"object_media_items","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"object_id","getter_name":"objectId","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"object_type","getter_name":"objectType","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ObjectType.values)","dart_type_name":"ObjectType"}},{"name":"media_id","getter_name":"mediaId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES media_items (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES media_items (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}}]} \ No newline at end of file diff --git a/lib/database/drift_schemas/sendtrain/drift_schema_v26.json b/lib/database/drift_schemas/sendtrain/drift_schema_v26.json new file mode 100644 index 0000000..94060a6 --- /dev/null +++ b/lib/database/drift_schemas/sendtrain/drift_schema_v26.json @@ -0,0 +1 @@ +{"_meta":{"description":"This file contains a serialized version of schema entities for drift.","version":"1.2.0"},"options":{"store_date_time_values_as_text":false},"entities":[{"id":0,"references":[],"type":"table","data":{"name":"sessions","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":32}}]},{"name":"body","getter_name":"content","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"status","getter_name":"status","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(SessionStatus.values)","dart_type_name":"SessionStatus"}},{"name":"achievements","getter_name":"achievements","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"address","getter_name":"address","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":256}}]},{"name":"date","getter_name":"date","moor_type":"dateTime","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":1,"references":[],"type":"table","data":{"name":"activities","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":100}}]},{"name":"type","getter_name":"type","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityType.values)","dart_type_name":"ActivityType"}},{"name":"body","getter_name":"description","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"category","getter_name":"category","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityCategories.values)","dart_type_name":"ActivityCategories"}},{"name":"force","getter_name":"force","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"level","getter_name":"level","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityLevel.values)","dart_type_name":"ActivityLevel"}},{"name":"mechanic","getter_name":"mechanic","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityMechanic.values)","dart_type_name":"ActivityMechanic"}},{"name":"equipment","getter_name":"equipment","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityEquipment.values)","dart_type_name":"ActivityEquipment"}},{"name":"primary_muscles","getter_name":"primaryMuscles","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityMuscle.values)","dart_type_name":"ActivityMuscle"}},{"name":"secondary_muscles","getter_name":"secondaryMuscles","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityMuscle.values)","dart_type_name":"ActivityMuscle"}},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":2,"references":[0,1],"type":"table","data":{"name":"session_activities","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"session_id","getter_name":"sessionId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES sessions (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES sessions (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"activity_id","getter_name":"activityId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES activities (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES activities (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"position","getter_name":"position","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"results","getter_name":"results","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":3,"references":[],"type":"table","data":{"name":"actions","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":64}}]},{"name":"body","getter_name":"description","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"total_sets","getter_name":"totalSets","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"total_reps","getter_name":"totalReps","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":1,"max":32}}]},{"name":"rest_before_sets","getter_name":"restBeforeSets","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rest_between_sets","getter_name":"restBetweenSets","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rest_between_reps","getter_name":"restBetweenReps","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rest_after_sets","getter_name":"restAfterSets","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rep_type","getter_name":"repType","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(RepType.values)","dart_type_name":"RepType"}},{"name":"rep_length","getter_name":"repLength","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rep_weights","getter_name":"repWeights","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"set_weights","getter_name":"setWeights","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"is_alternating","getter_name":"isAlternating","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"is_alternating\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"is_alternating\" IN (0, 1))"},"default_dart":"Variable(false)","default_client_dart":null,"dsl_features":[]},{"name":"tempo","getter_name":"tempo","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":6,"max":36}}]},{"name":"status","getter_name":"status","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"Variable(ActionStatus.pending.toString())","default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActionStatus.values)","dart_type_name":"ActionStatus"}},{"name":"state","getter_name":"state","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"Variable(\"{}\")","default_client_dart":null,"dsl_features":[]},{"name":"set","getter_name":"set","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":4,"references":[1,3],"type":"table","data":{"name":"activity_actions","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"activity_id","getter_name":"activityId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES activities (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES activities (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"action_id","getter_name":"actionId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES actions (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES actions (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"position","getter_name":"position","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":5,"references":[],"type":"table","data":{"name":"media_items","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":64}}]},{"name":"body","getter_name":"description","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"reference","getter_name":"reference","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"type","getter_name":"type","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(MediaType.values)","dart_type_name":"MediaType"}},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":6,"references":[5],"type":"table","data":{"name":"object_media_items","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"object_id","getter_name":"objectId","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"object_type","getter_name":"objectType","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ObjectType.values)","dart_type_name":"ObjectType"}},{"name":"media_id","getter_name":"mediaId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES media_items (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES media_items (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}}]} \ No newline at end of file diff --git a/lib/database/drift_schemas/sendtrain/drift_schema_v27.json b/lib/database/drift_schemas/sendtrain/drift_schema_v27.json new file mode 100644 index 0000000..675545c --- /dev/null +++ b/lib/database/drift_schemas/sendtrain/drift_schema_v27.json @@ -0,0 +1 @@ +{"_meta":{"description":"This file contains a serialized version of schema entities for drift.","version":"1.2.0"},"options":{"store_date_time_values_as_text":false},"entities":[{"id":0,"references":[],"type":"table","data":{"name":"sessions","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":32}}]},{"name":"body","getter_name":"content","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"status","getter_name":"status","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(SessionStatus.values)","dart_type_name":"SessionStatus"}},{"name":"achievements","getter_name":"achievements","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"address","getter_name":"address","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":256}}]},{"name":"date","getter_name":"date","moor_type":"dateTime","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":1,"references":[],"type":"table","data":{"name":"activities","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":100}}]},{"name":"type","getter_name":"type","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityType.values)","dart_type_name":"ActivityType"}},{"name":"body","getter_name":"description","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"category","getter_name":"category","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityCategories.values)","dart_type_name":"ActivityCategories"}},{"name":"force","getter_name":"force","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"level","getter_name":"level","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityLevel.values)","dart_type_name":"ActivityLevel"}},{"name":"mechanic","getter_name":"mechanic","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityMechanic.values)","dart_type_name":"ActivityMechanic"}},{"name":"equipment","getter_name":"equipment","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityEquipment.values)","dart_type_name":"ActivityEquipment"}},{"name":"primary_muscles","getter_name":"primaryMuscles","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityMuscle.values)","dart_type_name":"ActivityMuscle"}},{"name":"secondary_muscles","getter_name":"secondaryMuscles","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityMuscle.values)","dart_type_name":"ActivityMuscle"}},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":2,"references":[0,1],"type":"table","data":{"name":"session_activities","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"session_id","getter_name":"sessionId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES sessions (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES sessions (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"activity_id","getter_name":"activityId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES activities (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES activities (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"position","getter_name":"position","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"results","getter_name":"results","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":3,"references":[],"type":"table","data":{"name":"actions","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":64}}]},{"name":"body","getter_name":"description","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"total_sets","getter_name":"totalSets","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"total_reps","getter_name":"totalReps","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":1,"max":32}}]},{"name":"rest_before_sets","getter_name":"restBeforeSets","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rest_between_sets","getter_name":"restBetweenSets","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rest_between_reps","getter_name":"restBetweenReps","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rest_after_sets","getter_name":"restAfterSets","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rep_type","getter_name":"repType","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(RepType.values)","dart_type_name":"RepType"}},{"name":"rep_length","getter_name":"repLength","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rep_weights","getter_name":"repWeights","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"set_weights","getter_name":"setWeights","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"is_alternating","getter_name":"isAlternating","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"is_alternating\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"is_alternating\" IN (0, 1))"},"default_dart":"Variable(false)","default_client_dart":null,"dsl_features":[]},{"name":"tempo","getter_name":"tempo","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":6,"max":36}}]},{"name":"status","getter_name":"status","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"Variable('pending')","default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActionStatus.values)","dart_type_name":"ActionStatus"}},{"name":"state","getter_name":"state","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"Variable(\"{}\")","default_client_dart":null,"dsl_features":[]},{"name":"set","getter_name":"set","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":4,"references":[1,3],"type":"table","data":{"name":"activity_actions","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"activity_id","getter_name":"activityId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES activities (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES activities (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"action_id","getter_name":"actionId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES actions (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES actions (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"position","getter_name":"position","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":5,"references":[],"type":"table","data":{"name":"media_items","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":64}}]},{"name":"body","getter_name":"description","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"reference","getter_name":"reference","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"type","getter_name":"type","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(MediaType.values)","dart_type_name":"MediaType"}},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":6,"references":[5],"type":"table","data":{"name":"object_media_items","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"object_id","getter_name":"objectId","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"object_type","getter_name":"objectType","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ObjectType.values)","dart_type_name":"ObjectType"}},{"name":"media_id","getter_name":"mediaId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES media_items (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES media_items (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}}]} \ No newline at end of file diff --git a/lib/database/drift_schemas/sendtrain/drift_schema_v28.json b/lib/database/drift_schemas/sendtrain/drift_schema_v28.json new file mode 100644 index 0000000..675545c --- /dev/null +++ b/lib/database/drift_schemas/sendtrain/drift_schema_v28.json @@ -0,0 +1 @@ +{"_meta":{"description":"This file contains a serialized version of schema entities for drift.","version":"1.2.0"},"options":{"store_date_time_values_as_text":false},"entities":[{"id":0,"references":[],"type":"table","data":{"name":"sessions","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":32}}]},{"name":"body","getter_name":"content","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"status","getter_name":"status","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(SessionStatus.values)","dart_type_name":"SessionStatus"}},{"name":"achievements","getter_name":"achievements","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"address","getter_name":"address","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":256}}]},{"name":"date","getter_name":"date","moor_type":"dateTime","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":1,"references":[],"type":"table","data":{"name":"activities","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":100}}]},{"name":"type","getter_name":"type","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityType.values)","dart_type_name":"ActivityType"}},{"name":"body","getter_name":"description","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"category","getter_name":"category","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityCategories.values)","dart_type_name":"ActivityCategories"}},{"name":"force","getter_name":"force","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"level","getter_name":"level","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityLevel.values)","dart_type_name":"ActivityLevel"}},{"name":"mechanic","getter_name":"mechanic","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityMechanic.values)","dart_type_name":"ActivityMechanic"}},{"name":"equipment","getter_name":"equipment","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityEquipment.values)","dart_type_name":"ActivityEquipment"}},{"name":"primary_muscles","getter_name":"primaryMuscles","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityMuscle.values)","dart_type_name":"ActivityMuscle"}},{"name":"secondary_muscles","getter_name":"secondaryMuscles","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityMuscle.values)","dart_type_name":"ActivityMuscle"}},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":2,"references":[0,1],"type":"table","data":{"name":"session_activities","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"session_id","getter_name":"sessionId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES sessions (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES sessions (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"activity_id","getter_name":"activityId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES activities (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES activities (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"position","getter_name":"position","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"results","getter_name":"results","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":3,"references":[],"type":"table","data":{"name":"actions","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":64}}]},{"name":"body","getter_name":"description","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"total_sets","getter_name":"totalSets","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"total_reps","getter_name":"totalReps","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":1,"max":32}}]},{"name":"rest_before_sets","getter_name":"restBeforeSets","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rest_between_sets","getter_name":"restBetweenSets","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rest_between_reps","getter_name":"restBetweenReps","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rest_after_sets","getter_name":"restAfterSets","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rep_type","getter_name":"repType","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(RepType.values)","dart_type_name":"RepType"}},{"name":"rep_length","getter_name":"repLength","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rep_weights","getter_name":"repWeights","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"set_weights","getter_name":"setWeights","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"is_alternating","getter_name":"isAlternating","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"is_alternating\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"is_alternating\" IN (0, 1))"},"default_dart":"Variable(false)","default_client_dart":null,"dsl_features":[]},{"name":"tempo","getter_name":"tempo","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":6,"max":36}}]},{"name":"status","getter_name":"status","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"Variable('pending')","default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActionStatus.values)","dart_type_name":"ActionStatus"}},{"name":"state","getter_name":"state","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"Variable(\"{}\")","default_client_dart":null,"dsl_features":[]},{"name":"set","getter_name":"set","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":4,"references":[1,3],"type":"table","data":{"name":"activity_actions","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"activity_id","getter_name":"activityId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES activities (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES activities (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"action_id","getter_name":"actionId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES actions (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES actions (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"position","getter_name":"position","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":5,"references":[],"type":"table","data":{"name":"media_items","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":64}}]},{"name":"body","getter_name":"description","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"reference","getter_name":"reference","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"type","getter_name":"type","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(MediaType.values)","dart_type_name":"MediaType"}},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":6,"references":[5],"type":"table","data":{"name":"object_media_items","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"object_id","getter_name":"objectId","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"object_type","getter_name":"objectType","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ObjectType.values)","dart_type_name":"ObjectType"}},{"name":"media_id","getter_name":"mediaId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES media_items (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES media_items (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}}]} \ No newline at end of file diff --git a/lib/database/drift_schemas/sendtrain/drift_schema_v29.json b/lib/database/drift_schemas/sendtrain/drift_schema_v29.json new file mode 100644 index 0000000..69d38bb --- /dev/null +++ b/lib/database/drift_schemas/sendtrain/drift_schema_v29.json @@ -0,0 +1 @@ +{"_meta":{"description":"This file contains a serialized version of schema entities for drift.","version":"1.2.0"},"options":{"store_date_time_values_as_text":false},"entities":[{"id":0,"references":[],"type":"table","data":{"name":"sessions","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":32}}]},{"name":"body","getter_name":"content","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"status","getter_name":"status","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(SessionStatus.values)","dart_type_name":"SessionStatus"}},{"name":"achievements","getter_name":"achievements","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"address","getter_name":"address","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":256}}]},{"name":"date","getter_name":"date","moor_type":"dateTime","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":1,"references":[],"type":"table","data":{"name":"activities","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":100}}]},{"name":"type","getter_name":"type","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityType.values)","dart_type_name":"ActivityType"}},{"name":"body","getter_name":"description","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"category","getter_name":"category","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityCategories.values)","dart_type_name":"ActivityCategories"}},{"name":"force","getter_name":"force","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"level","getter_name":"level","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityLevel.values)","dart_type_name":"ActivityLevel"}},{"name":"mechanic","getter_name":"mechanic","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityMechanic.values)","dart_type_name":"ActivityMechanic"}},{"name":"equipment","getter_name":"equipment","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityEquipment.values)","dart_type_name":"ActivityEquipment"}},{"name":"primary_muscles","getter_name":"primaryMuscles","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityMuscle.values)","dart_type_name":"ActivityMuscle"}},{"name":"secondary_muscles","getter_name":"secondaryMuscles","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityMuscle.values)","dart_type_name":"ActivityMuscle"}},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":2,"references":[0,1],"type":"table","data":{"name":"session_activities","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"session_id","getter_name":"sessionId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES sessions (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES sessions (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"activity_id","getter_name":"activityId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES activities (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES activities (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"position","getter_name":"position","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"results","getter_name":"results","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":3,"references":[],"type":"table","data":{"name":"actions","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":64}}]},{"name":"body","getter_name":"description","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"total_sets","getter_name":"totalSets","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"total_reps","getter_name":"totalReps","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":1,"max":32}}]},{"name":"rest_before_sets","getter_name":"restBeforeSets","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rest_between_sets","getter_name":"restBetweenSets","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rest_between_reps","getter_name":"restBetweenReps","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rest_after_sets","getter_name":"restAfterSets","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rep_type","getter_name":"repType","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(RepType.values)","dart_type_name":"RepType"}},{"name":"rep_length","getter_name":"repLength","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rep_weights","getter_name":"repWeights","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"set_weights","getter_name":"setWeights","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"is_alternating","getter_name":"isAlternating","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"is_alternating\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"is_alternating\" IN (0, 1))"},"default_dart":"Variable(false)","default_client_dart":null,"dsl_features":[]},{"name":"tempo","getter_name":"tempo","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":6,"max":36}}]},{"name":"status","getter_name":"status","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"Variable('pending')","default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActionStatus.values)","dart_type_name":"ActionStatus"}},{"name":"state","getter_name":"state","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"Variable(\"{'currentSet': 1, 'currentRep': 1, 'currentTime': 0}\")","default_client_dart":null,"dsl_features":[]},{"name":"set","getter_name":"set","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":4,"references":[1,3],"type":"table","data":{"name":"activity_actions","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"activity_id","getter_name":"activityId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES activities (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES activities (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"action_id","getter_name":"actionId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES actions (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES actions (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"position","getter_name":"position","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":5,"references":[],"type":"table","data":{"name":"media_items","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":64}}]},{"name":"body","getter_name":"description","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"reference","getter_name":"reference","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"type","getter_name":"type","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(MediaType.values)","dart_type_name":"MediaType"}},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":6,"references":[5],"type":"table","data":{"name":"object_media_items","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"object_id","getter_name":"objectId","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"object_type","getter_name":"objectType","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ObjectType.values)","dart_type_name":"ObjectType"}},{"name":"media_id","getter_name":"mediaId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES media_items (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES media_items (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}}]} \ No newline at end of file diff --git a/lib/database/drift_schemas/sendtrain/drift_schema_v30.json b/lib/database/drift_schemas/sendtrain/drift_schema_v30.json new file mode 100644 index 0000000..69d38bb --- /dev/null +++ b/lib/database/drift_schemas/sendtrain/drift_schema_v30.json @@ -0,0 +1 @@ +{"_meta":{"description":"This file contains a serialized version of schema entities for drift.","version":"1.2.0"},"options":{"store_date_time_values_as_text":false},"entities":[{"id":0,"references":[],"type":"table","data":{"name":"sessions","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":32}}]},{"name":"body","getter_name":"content","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"status","getter_name":"status","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(SessionStatus.values)","dart_type_name":"SessionStatus"}},{"name":"achievements","getter_name":"achievements","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"address","getter_name":"address","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":256}}]},{"name":"date","getter_name":"date","moor_type":"dateTime","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":1,"references":[],"type":"table","data":{"name":"activities","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":100}}]},{"name":"type","getter_name":"type","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityType.values)","dart_type_name":"ActivityType"}},{"name":"body","getter_name":"description","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"category","getter_name":"category","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityCategories.values)","dart_type_name":"ActivityCategories"}},{"name":"force","getter_name":"force","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"level","getter_name":"level","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityLevel.values)","dart_type_name":"ActivityLevel"}},{"name":"mechanic","getter_name":"mechanic","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityMechanic.values)","dart_type_name":"ActivityMechanic"}},{"name":"equipment","getter_name":"equipment","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityEquipment.values)","dart_type_name":"ActivityEquipment"}},{"name":"primary_muscles","getter_name":"primaryMuscles","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityMuscle.values)","dart_type_name":"ActivityMuscle"}},{"name":"secondary_muscles","getter_name":"secondaryMuscles","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityMuscle.values)","dart_type_name":"ActivityMuscle"}},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":2,"references":[0,1],"type":"table","data":{"name":"session_activities","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"session_id","getter_name":"sessionId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES sessions (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES sessions (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"activity_id","getter_name":"activityId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES activities (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES activities (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"position","getter_name":"position","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"results","getter_name":"results","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":3,"references":[],"type":"table","data":{"name":"actions","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":64}}]},{"name":"body","getter_name":"description","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"total_sets","getter_name":"totalSets","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"total_reps","getter_name":"totalReps","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":1,"max":32}}]},{"name":"rest_before_sets","getter_name":"restBeforeSets","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rest_between_sets","getter_name":"restBetweenSets","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rest_between_reps","getter_name":"restBetweenReps","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rest_after_sets","getter_name":"restAfterSets","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rep_type","getter_name":"repType","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(RepType.values)","dart_type_name":"RepType"}},{"name":"rep_length","getter_name":"repLength","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rep_weights","getter_name":"repWeights","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"set_weights","getter_name":"setWeights","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"is_alternating","getter_name":"isAlternating","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"is_alternating\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"is_alternating\" IN (0, 1))"},"default_dart":"Variable(false)","default_client_dart":null,"dsl_features":[]},{"name":"tempo","getter_name":"tempo","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":6,"max":36}}]},{"name":"status","getter_name":"status","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"Variable('pending')","default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActionStatus.values)","dart_type_name":"ActionStatus"}},{"name":"state","getter_name":"state","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"Variable(\"{'currentSet': 1, 'currentRep': 1, 'currentTime': 0}\")","default_client_dart":null,"dsl_features":[]},{"name":"set","getter_name":"set","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":4,"references":[1,3],"type":"table","data":{"name":"activity_actions","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"activity_id","getter_name":"activityId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES activities (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES activities (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"action_id","getter_name":"actionId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES actions (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES actions (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"position","getter_name":"position","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":5,"references":[],"type":"table","data":{"name":"media_items","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":64}}]},{"name":"body","getter_name":"description","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"reference","getter_name":"reference","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"type","getter_name":"type","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(MediaType.values)","dart_type_name":"MediaType"}},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":6,"references":[5],"type":"table","data":{"name":"object_media_items","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"object_id","getter_name":"objectId","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"object_type","getter_name":"objectType","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ObjectType.values)","dart_type_name":"ObjectType"}},{"name":"media_id","getter_name":"mediaId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES media_items (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES media_items (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}}]} \ No newline at end of file diff --git a/lib/database/drift_schemas/sendtrain/drift_schema_v31.json b/lib/database/drift_schemas/sendtrain/drift_schema_v31.json new file mode 100644 index 0000000..bd770cb --- /dev/null +++ b/lib/database/drift_schemas/sendtrain/drift_schema_v31.json @@ -0,0 +1 @@ +{"_meta":{"description":"This file contains a serialized version of schema entities for drift.","version":"1.2.0"},"options":{"store_date_time_values_as_text":false},"entities":[{"id":0,"references":[],"type":"table","data":{"name":"sessions","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":32}}]},{"name":"body","getter_name":"content","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"status","getter_name":"status","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(SessionStatus.values)","dart_type_name":"SessionStatus"}},{"name":"achievements","getter_name":"achievements","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"address","getter_name":"address","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":256}}]},{"name":"date","getter_name":"date","moor_type":"dateTime","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":1,"references":[],"type":"table","data":{"name":"activities","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":100}}]},{"name":"type","getter_name":"type","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityType.values)","dart_type_name":"ActivityType"}},{"name":"body","getter_name":"description","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"category","getter_name":"category","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityCategories.values)","dart_type_name":"ActivityCategories"}},{"name":"force","getter_name":"force","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"level","getter_name":"level","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityLevel.values)","dart_type_name":"ActivityLevel"}},{"name":"mechanic","getter_name":"mechanic","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityMechanic.values)","dart_type_name":"ActivityMechanic"}},{"name":"equipment","getter_name":"equipment","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityEquipment.values)","dart_type_name":"ActivityEquipment"}},{"name":"primary_muscles","getter_name":"primaryMuscles","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityMuscle.values)","dart_type_name":"ActivityMuscle"}},{"name":"secondary_muscles","getter_name":"secondaryMuscles","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityMuscle.values)","dart_type_name":"ActivityMuscle"}},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":2,"references":[0,1],"type":"table","data":{"name":"session_activities","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"session_id","getter_name":"sessionId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES sessions (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES sessions (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"activity_id","getter_name":"activityId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES activities (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES activities (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"position","getter_name":"position","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"results","getter_name":"results","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":3,"references":[],"type":"table","data":{"name":"actions","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":64}}]},{"name":"body","getter_name":"description","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"total_sets","getter_name":"totalSets","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"total_reps","getter_name":"totalReps","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":1,"max":32}}]},{"name":"rest_before_sets","getter_name":"restBeforeSets","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rest_between_sets","getter_name":"restBetweenSets","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rest_between_reps","getter_name":"restBetweenReps","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rest_after_sets","getter_name":"restAfterSets","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rep_type","getter_name":"repType","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(RepType.values)","dart_type_name":"RepType"}},{"name":"rep_length","getter_name":"repLength","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rep_weights","getter_name":"repWeights","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"set_weights","getter_name":"setWeights","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"is_alternating","getter_name":"isAlternating","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"is_alternating\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"is_alternating\" IN (0, 1))"},"default_dart":"Variable(false)","default_client_dart":null,"dsl_features":[]},{"name":"tempo","getter_name":"tempo","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":6,"max":36}}]},{"name":"status","getter_name":"status","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"Variable('pending')","default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActionStatus.values)","dart_type_name":"ActionStatus"}},{"name":"state","getter_name":"state","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"Variable(\"{\\\"currentSet\\\": 1, \\\"currentRep\\\": 1, \\\"currentTime\\\": 0}\")","default_client_dart":null,"dsl_features":[]},{"name":"set","getter_name":"set","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":4,"references":[1,3],"type":"table","data":{"name":"activity_actions","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"activity_id","getter_name":"activityId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES activities (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES activities (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"action_id","getter_name":"actionId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES actions (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES actions (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"position","getter_name":"position","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":5,"references":[],"type":"table","data":{"name":"media_items","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":64}}]},{"name":"body","getter_name":"description","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"reference","getter_name":"reference","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"type","getter_name":"type","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(MediaType.values)","dart_type_name":"MediaType"}},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":6,"references":[5],"type":"table","data":{"name":"object_media_items","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"object_id","getter_name":"objectId","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"object_type","getter_name":"objectType","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ObjectType.values)","dart_type_name":"ObjectType"}},{"name":"media_id","getter_name":"mediaId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES media_items (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES media_items (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}}]} \ No newline at end of file diff --git a/lib/database/drift_schemas/sendtrain/drift_schema_v32.json b/lib/database/drift_schemas/sendtrain/drift_schema_v32.json new file mode 100644 index 0000000..e8da237 --- /dev/null +++ b/lib/database/drift_schemas/sendtrain/drift_schema_v32.json @@ -0,0 +1 @@ +{"_meta":{"description":"This file contains a serialized version of schema entities for drift.","version":"1.2.0"},"options":{"store_date_time_values_as_text":false},"entities":[{"id":0,"references":[],"type":"table","data":{"name":"sessions","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":32}}]},{"name":"body","getter_name":"content","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"status","getter_name":"status","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(SessionStatus.values)","dart_type_name":"SessionStatus"}},{"name":"achievements","getter_name":"achievements","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"address","getter_name":"address","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":256}}]},{"name":"date","getter_name":"date","moor_type":"dateTime","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":1,"references":[],"type":"table","data":{"name":"activities","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":100}}]},{"name":"type","getter_name":"type","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityType.values)","dart_type_name":"ActivityType"}},{"name":"body","getter_name":"description","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"category","getter_name":"category","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityCategories.values)","dart_type_name":"ActivityCategories"}},{"name":"force","getter_name":"force","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"level","getter_name":"level","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityLevel.values)","dart_type_name":"ActivityLevel"}},{"name":"mechanic","getter_name":"mechanic","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityMechanic.values)","dart_type_name":"ActivityMechanic"}},{"name":"equipment","getter_name":"equipment","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityEquipment.values)","dart_type_name":"ActivityEquipment"}},{"name":"primary_muscles","getter_name":"primaryMuscles","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityMuscle.values)","dart_type_name":"ActivityMuscle"}},{"name":"secondary_muscles","getter_name":"secondaryMuscles","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityMuscle.values)","dart_type_name":"ActivityMuscle"}},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":2,"references":[0,1],"type":"table","data":{"name":"session_activities","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"session_id","getter_name":"sessionId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES sessions (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES sessions (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"activity_id","getter_name":"activityId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES activities (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES activities (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"position","getter_name":"position","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"results","getter_name":"results","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":3,"references":[],"type":"table","data":{"name":"actions","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":64}}]},{"name":"body","getter_name":"description","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"total_sets","getter_name":"totalSets","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"total_reps","getter_name":"totalReps","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":1,"max":32}}]},{"name":"rest_before_sets","getter_name":"restBeforeSets","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rest_between_sets","getter_name":"restBetweenSets","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rest_between_reps","getter_name":"restBetweenReps","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rest_after_sets","getter_name":"restAfterSets","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rep_type","getter_name":"repType","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(RepType.values)","dart_type_name":"RepType"}},{"name":"rep_length","getter_name":"repLength","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rep_weights","getter_name":"repWeights","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"set_weights","getter_name":"setWeights","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"is_alternating","getter_name":"isAlternating","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"is_alternating\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"is_alternating\" IN (0, 1))"},"default_dart":"Variable(false)","default_client_dart":null,"dsl_features":[]},{"name":"tempo","getter_name":"tempo","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":6,"max":36}}]},{"name":"status","getter_name":"status","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"Variable('pending')","default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActionStatus.values)","dart_type_name":"ActionStatus"}},{"name":"state","getter_name":"state","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"Variable(\"{\\\"currentSet\\\": 1, \\\"currentRep\\\": 1, \\\"currentTime\\\": 0, \\\"currentAction\\\": 0}\")","default_client_dart":null,"dsl_features":[]},{"name":"set","getter_name":"set","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":4,"references":[1,3],"type":"table","data":{"name":"activity_actions","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"activity_id","getter_name":"activityId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES activities (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES activities (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"action_id","getter_name":"actionId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES actions (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES actions (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"position","getter_name":"position","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":5,"references":[],"type":"table","data":{"name":"media_items","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":64}}]},{"name":"body","getter_name":"description","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"reference","getter_name":"reference","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"type","getter_name":"type","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(MediaType.values)","dart_type_name":"MediaType"}},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":6,"references":[5],"type":"table","data":{"name":"object_media_items","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"object_id","getter_name":"objectId","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"object_type","getter_name":"objectType","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ObjectType.values)","dart_type_name":"ObjectType"}},{"name":"media_id","getter_name":"mediaId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES media_items (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES media_items (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}}]} \ No newline at end of file diff --git a/lib/database/drift_schemas/sendtrain/drift_schema_v33.json b/lib/database/drift_schemas/sendtrain/drift_schema_v33.json new file mode 100644 index 0000000..d5cb7b9 --- /dev/null +++ b/lib/database/drift_schemas/sendtrain/drift_schema_v33.json @@ -0,0 +1 @@ +{"_meta":{"description":"This file contains a serialized version of schema entities for drift.","version":"1.2.0"},"options":{"store_date_time_values_as_text":false},"entities":[{"id":0,"references":[],"type":"table","data":{"name":"sessions","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":32}}]},{"name":"body","getter_name":"content","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"status","getter_name":"status","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(SessionStatus.values)","dart_type_name":"SessionStatus"}},{"name":"achievements","getter_name":"achievements","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"address","getter_name":"address","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":256}}]},{"name":"date","getter_name":"date","moor_type":"dateTime","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":1,"references":[],"type":"table","data":{"name":"activities","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":100}}]},{"name":"type","getter_name":"type","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityType.values)","dart_type_name":"ActivityType"}},{"name":"body","getter_name":"description","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"category","getter_name":"category","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityCategories.values)","dart_type_name":"ActivityCategories"}},{"name":"force","getter_name":"force","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"level","getter_name":"level","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityLevel.values)","dart_type_name":"ActivityLevel"}},{"name":"mechanic","getter_name":"mechanic","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityMechanic.values)","dart_type_name":"ActivityMechanic"}},{"name":"equipment","getter_name":"equipment","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityEquipment.values)","dart_type_name":"ActivityEquipment"}},{"name":"primary_muscles","getter_name":"primaryMuscles","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityMuscle.values)","dart_type_name":"ActivityMuscle"}},{"name":"secondary_muscles","getter_name":"secondaryMuscles","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActivityMuscle.values)","dart_type_name":"ActivityMuscle"}},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":2,"references":[0,1],"type":"table","data":{"name":"session_activities","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"session_id","getter_name":"sessionId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES sessions (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES sessions (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"activity_id","getter_name":"activityId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES activities (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES activities (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"position","getter_name":"position","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"results","getter_name":"results","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":3,"references":[],"type":"table","data":{"name":"actions","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":64}}]},{"name":"body","getter_name":"description","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"total_sets","getter_name":"totalSets","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"total_reps","getter_name":"totalReps","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":1,"max":32}}]},{"name":"rest_before_sets","getter_name":"restBeforeSets","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rest_between_sets","getter_name":"restBetweenSets","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rest_between_reps","getter_name":"restBetweenReps","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rest_after_sets","getter_name":"restAfterSets","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rep_type","getter_name":"repType","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(RepType.values)","dart_type_name":"RepType"}},{"name":"rep_length","getter_name":"repLength","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rep_weights","getter_name":"repWeights","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"set_weights","getter_name":"setWeights","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"is_alternating","getter_name":"isAlternating","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"is_alternating\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"is_alternating\" IN (0, 1))"},"default_dart":"Variable(false)","default_client_dart":null,"dsl_features":[]},{"name":"tempo","getter_name":"tempo","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":6,"max":36}}]},{"name":"status","getter_name":"status","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"Variable('pending')","default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ActionStatus.values)","dart_type_name":"ActionStatus"}},{"name":"state","getter_name":"state","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"Variable(\"{\\\"currentSet\\\": 0, \\\"currentRep\\\": 0, \\\"currentActionType\\\": 0, \\\"currentTime\\\": 0, \\\"currentAction\\\": 0}\")","default_client_dart":null,"dsl_features":[]},{"name":"set","getter_name":"set","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":4,"references":[1,3],"type":"table","data":{"name":"activity_actions","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"activity_id","getter_name":"activityId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES activities (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES activities (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"action_id","getter_name":"actionId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES actions (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES actions (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"position","getter_name":"position","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":5,"references":[],"type":"table","data":{"name":"media_items","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"title","getter_name":"title","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":3,"max":64}}]},{"name":"body","getter_name":"description","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"reference","getter_name":"reference","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"type","getter_name":"type","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(MediaType.values)","dart_type_name":"MediaType"}},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":6,"references":[5],"type":"table","data":{"name":"object_media_items","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"object_id","getter_name":"objectId","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"object_type","getter_name":"objectType","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ObjectType.values)","dart_type_name":"ObjectType"}},{"name":"media_id","getter_name":"mediaId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES media_items (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES media_items (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"Variable(DateTime.now())","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}}]} \ No newline at end of file diff --git a/lib/database/seed.dart b/lib/database/seed.dart index 142e5bc..cccc790 100644 --- a/lib/database/seed.dart +++ b/lib/database/seed.dart @@ -183,7 +183,7 @@ Future seedDb(AppDatabase database) async { description: '$k Beta pully beta beta pinch one arm crimpy. Futuristic pinch, dyno dynamic drop knee climb. Climbing ondra slopey onsight beta ondra power endurance.', totalSets: 5, - totalReps: "[5]", + totalReps: "[1]", restBeforeSets: Value(30000), restBetweenSets: Value(300000), restBetweenReps: Value(15000), diff --git a/lib/helpers/date_time_helpers.dart b/lib/helpers/date_time_helpers.dart index 14422f3..980c871 100644 --- a/lib/helpers/date_time_helpers.dart +++ b/lib/helpers/date_time_helpers.dart @@ -9,3 +9,8 @@ String formattedTime(int timeInSecond) { String second = sec.toString().length <= 1 ? "0$sec" : "$sec"; return "$minute:$second"; } + +int toSeconds(int milliseconds) { + int sec = (milliseconds / 1000).floor(); + return sec; +} diff --git a/lib/helpers/widget_helpers.dart b/lib/helpers/widget_helpers.dart index bb6483f..9eb87b8 100644 --- a/lib/helpers/widget_helpers.dart +++ b/lib/helpers/widget_helpers.dart @@ -6,8 +6,12 @@ showMediaDetailWidget(BuildContext context, MediaItem media) { showEditorSheet(context, MediaDetails(media: media)); } -showGenericSheet(BuildContext context, Widget widget) { +showGenericSheet(BuildContext context, Widget widget, + [Color? backgroundColor]) { + backgroundColor ??= Theme.of(context).colorScheme.surfaceBright; + showModalBottomSheet( + backgroundColor: backgroundColor, shape: RoundedRectangleBorder( borderRadius: BorderRadius.only( topLeft: Radius.circular(10.0), topRight: Radius.circular(10.0)), @@ -26,15 +30,15 @@ showEditorSheet(BuildContext context, Widget widget) { } String jsonToDescription(List text) { - String content = ''; + String content = ''; - for (int i = 0; i < text.length; i++) { - if (content.isEmpty) { - content = text[i]; - } else { - content = "$content\n\n${text[i]}"; - } + for (int i = 0; i < text.length; i++) { + if (content.isEmpty) { + content = text[i]; + } else { + content = "$content\n\n${text[i]}"; } - - return content; } + + return content; +} diff --git a/lib/main.dart b/lib/main.dart index f354271..6ffd377 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -3,6 +3,7 @@ import 'package:provider/provider.dart'; import 'package:sendtrain/database/database.dart'; import 'package:sendtrain/helpers/widget_helpers.dart'; import 'package:sendtrain/models/activity_timer_model.dart'; +import 'package:sendtrain/providers/action_timer.dart'; import 'package:sendtrain/widgets/screens/activities_screen.dart'; import 'package:sendtrain/widgets/screens/sessions_screen.dart'; // ignore: unused_import @@ -111,12 +112,14 @@ class _AppState extends State { } void main() { + var db = AppDatabase(); runApp(MultiProvider( providers: [ - ChangeNotifierProvider(create: (context) => ActivityTimerModel()), Provider( - create: (context) => AppDatabase(), + create: (context) => db, dispose: (context, db) => db.close()), + ChangeNotifierProvider(create: (context) => ActivityTimerModel()), + ChangeNotifierProvider(create: (context) => ActionTimer()), ], child: const SendTrain(), )); diff --git a/lib/models/action_model.dart b/lib/models/action_model.dart new file mode 100644 index 0000000..733ea1d --- /dev/null +++ b/lib/models/action_model.dart @@ -0,0 +1,259 @@ +import 'dart:convert'; + +import 'package:sendtrain/daos/actions_dao.dart'; +import 'package:sendtrain/database/database.dart'; +import 'package:sendtrain/helpers/date_time_helpers.dart'; + +class ActionModel { + final ActionsDao dao; + List items; + Action action; + + ActionModel({required this.action, required AppDatabase db}) + : dao = ActionsDao(db), + items = _generateItems(action); + + int get id => action.id; + ActionStatus get status => action.status; + Map get state => json.decode(action.state); + List get sets => items.whereType().toList(); + List get allItems => _flattenedItems(); + int get totalTime { + int time = 0; + for (int i = 0; i < allItems.length; i++) { + Item item = allItems[i]; + time += item.time ?? 0; + } + + return toSeconds(time); + } + + List _flattenedItems() { + List items = []; + + for (int i = 0; i < this.items.length; i++) { + Item item = this.items[i]; + if (item.runtimeType == Set) { + Set setItem = item as Set; + for (int j = 0; j < setItem.items.length; j++) { + items.add(setItem.items[j]); + } + } else { + items.add(item); + } + } + + return items; + } + + static List _generateItems(Action action) { + int totalItems = 0; + int setItems = 0; + List items = []; + final List setReps = json.decode(action.totalReps); + + if (action.restBeforeSets != null) { + items.add(Rest( + id: totalItems, + position: totalItems, + action: action, + time: action.restBeforeSets!, + name: 'prepare')); + } + + for (int i = 0; i < action.totalSets; i++) { + final int totalReps; + + if (setReps.length == 1) { + totalReps = setReps.first; + } else { + totalReps = setReps[i]; + } + + totalItems += 1; + items.add(Set( + id: totalItems, + setOrder: setItems++, + position: totalItems, + action: action, + totalReps: totalReps)); + + if (action.restBetweenSets != null && i < action.totalSets - 1) { + totalItems += 1; + items.add(Rest( + id: totalItems, + position: totalItems, + action: action, + time: action.restBetweenSets!, + name: 'rest')); + } + } + + if (action.restAfterSets != null && totalItems != items.length) { + totalItems += 1; + items.add(Rest( + id: totalItems, + position: totalItems, + action: action, + time: action.restAfterSets!, + name: 'rest')); + } + + return items; + } + + Future updateStatus(ActionStatus status) async { + Action newAction = action.copyWith(id: action.id, status: status); + await dao.createOrUpdate(newAction.toCompanion(true)); + action = newAction; + return newAction; + } + + Future updateState(String state) async { + Action newAction = action.copyWith(id: action.id, state: state); + await dao.createOrUpdate(newAction.toCompanion(true)); + action = newAction; + return newAction; + } +} + +class Item { + final int id; + final Action action; + int position; + List items = []; + dynamic value; + final String name; + int? parentId; + int? time; + + Item( + {required this.id, + required this.position, + required this.action, + this.parentId, + this.time}) + : name = action.title; + + RepType get valueType => action.repType; + String get humanValueType => valueType == RepType.time ? 'seconds' : 'reps'; +} + +class Set extends Item { + final int totalReps; + int? setOrder; + + Set( + {required super.id, + required super.action, + required super.position, + required this.totalReps, + this.setOrder}) { + items = _generateItems(action, id, totalReps); + } + + int? get weightMultiplyer => + action.setWeights != null ? json.decode(action.setWeights!)[id] : null; + List get reps => items.whereType().toList(); + + static List _generateItems(action, id, totalReps) { + List items = []; + // add item for exercise + int position = 0; + + if (action.repType == RepType.time) { + for (int i = 0; i < totalReps; i++) { + position = position > 0 ? position + 1 : position; + items.add(Reps( + id: position, position: position, parentId: id, action: action)); + + if (action.isAlternating) { + items.add(Rest( + id: ++position, + position: position, + parentId: id, + action: action, + time: action.restBetweenReps, + name: 'alternate')); + items.add(Reps( + id: ++position, + position: position, + parentId: id, + action: action)); + + // don't show a rest after the last rep + if (i < totalReps - 1) { + items.add(Rest( + id: ++position, + position: position, + parentId: id, + action: action, + time: action.restBetweenReps, + name: 'prepare')); + } + } + } + } else { + items.add(Reps(id: id, position: position, action: action)); + + if (action.isAlternating) { + items.add(Rest( + id: ++position, + position: position, + parentId: id, + action: action, + time: action.restBetweenReps, + name: 'alternate')); + items.add(Reps(id: id, position: ++position, action: action)); + } + } + + return items; + } +} + +class Reps extends Item { + Reps( + {required super.id, + required super.position, + required super.action, + super.parentId}); + + @override + dynamic get value => type == RepType.time ? time : count; + + RepType get type => action.repType; + @override + int? get time => toSeconds(action.repLength!); + int? get count => getReps(id, json.decode(action.totalReps)); + int? get weight => + action.repWeights != null ? json.decode(action.repWeights!)[id] : null; + + static int getReps(setId, reps) { + if (reps.length > 1) { + return reps[setId]; + } else { + return reps.first; + } + } +} + +class Rest extends Item { + @override + String name; + + Rest( + {required super.id, + required super.position, + required super.action, + super.parentId, + required super.time, + required this.name}); + + // @override + // String get name => 'Rest'; + @override + int get value => toSeconds(time ?? 0); + @override + RepType get valueType => RepType.time; +} diff --git a/lib/providers/action_timer.dart b/lib/providers/action_timer.dart new file mode 100644 index 0000000..39d577f --- /dev/null +++ b/lib/providers/action_timer.dart @@ -0,0 +1,173 @@ +import 'dart:async'; +import 'dart:convert'; + +import 'package:flutter/material.dart'; +import 'package:scrollable_positioned_list/scrollable_positioned_list.dart'; +import 'package:sendtrain/database/database.dart'; +import 'package:sendtrain/models/action_model.dart'; + +class ActionTimer with ChangeNotifier { + ActionModel? actionModel; + double _progress = 0; + int _currentTime = 0; + final List _scrollControllers = []; + + ActionTimer(); + + Map get state => actionModel?.state ?? _stateConstructor(); + ActionStatus get status => actionModel?.status ?? ActionStatus.pending; + bool get started => status == ActionStatus.started; + bool get paused => status == ActionStatus.paused; + bool get pending => status == ActionStatus.pending; + bool get complete => status == ActionStatus.complete; + bool get available => paused | pending; + List get sets => actionModel!.sets; + List get items => actionModel!.items; + Set get currentSet => sets[state['currentSet']]; + Reps get currentRep => currentSet.reps[state['currentRep']]; + Item get currentAction => allActions[state['currentAction']]; + int get currentTime => _currentTime; + dynamic get currentValue => currentAction.valueType == RepType.time + ? currentTime + : currentAction.value; + List get allActions => actionModel?.allItems ?? []; + String get repType => + actionModel!.action.repType == RepType.time ? 'Seconds' : 'Reps'; + int? get repLength => currentRep.value; + int? get repCount => currentRep.count; + dynamic get repValue => + actionModel!.action.repType == RepType.time ? repLength : repCount; + double get progress => _progress; + int get totalTime => actionModel!.totalTime; + Timer? _periodicTimer; + + Map _stateConstructor() { + return { + 'currentSet': 0, + 'currentRep': 0, + 'currentTime': 0, + 'currentAction': 0 + }; + } + + void setup(ActionModel actionModel, ItemScrollController scrollController, + [bool resetOnLoad = true]) { + if (resetOnLoad) { + if (this.actionModel == actionModel) { + reset(); + } + + this.actionModel = actionModel; + setAction(currentAction.id); + } + + _scrollControllers.add(scrollController); + } + + Future pause() async => + await actionModel?.updateStatus(ActionStatus.paused).whenComplete(() { + _periodicTimer?.cancel(); + notifyListeners(); + }); + + Future start() async { + await actionModel!.updateStatus(ActionStatus.started); + + // start timer + if (_periodicTimer == null || _periodicTimer!.isActive == false) { + _periodicTimer = + Timer.periodic(const Duration(seconds: 1), (Timer timer) async { + switch (currentAction.valueType) { + case RepType.count: + break; + case RepType.time: + _currentTime--; + + if (_currentTime == 0) { + // move to next action + await setAction(state['currentAction'] + 1); + } + + await updateProgress(); + notifyListeners(); + } + }); + } + + notifyListeners(); + } + + Future close() async => + await actionModel!.updateStatus(ActionStatus.complete).whenComplete(() { + _periodicTimer!.cancel(); + notifyListeners(); + }); + + Future reset() async { + await actionModel!.updateStatus(ActionStatus.pending); + await actionModel!.updateState(json.encode(_stateConstructor())); + _periodicTimer?.cancel(); + _progress = 0; + _scrollControllers.clear(); + notifyListeners(); + } + + Future clear() async { + await reset(); + } + + double timeUsed() { + Iterable usedItems = allActions.getRange(0, state['currentAction']); + return usedItems.fold(0.0, (p, c) => p + c.value!); + } + + double totalComplete() { + Iterable usedItems = allActions.getRange(0, state['currentAction']); + return usedItems.length / allActions.length; + } + + updateProgress() { + double repUsed = (currentAction.value - currentTime) / currentAction.value; + _progress = + totalComplete() + ((repUsed < 0 ? 0 : repUsed) / allActions.length); + notifyListeners(); + } + + setAction(int actionNum, [bool isManual = false]) async { + Item item = allActions[actionNum]; + Map newState = state; + + newState['currentAction'] = actionNum; + newState['currentSet'] = item.parentId; + newState['currentRep'] = item.id; + newState['currentTime'] = _currentTime = item.value!; + + await actionModel! + .updateState(json.encode(newState)) + .whenComplete(() async { + if (isManual) { + await pause(); + await updateProgress(); + } + + int index = currentAction.parentId != null + ? currentAction.parentId! + : currentAction.id; + + for (int i = 0; i < _scrollControllers.length; i++) { + ItemScrollController sc = _scrollControllers[i]; + + sc.scrollTo( + index: index, + duration: Duration(milliseconds: 500), + curve: Curves.easeInOutCubic); + } + // _scrollController?.scrollTo( + // index: index, + // duration: Duration(milliseconds: 500), + // curve: Curves.easeInOutCubic); + }); + + notifyListeners(); + } +} diff --git a/lib/widgets/activities/activity_action_editor.dart b/lib/widgets/activities/activity_action_editor.dart new file mode 100644 index 0000000..9422bfd --- /dev/null +++ b/lib/widgets/activities/activity_action_editor.dart @@ -0,0 +1,39 @@ +import 'package:flutter/material.dart' hide Action; +import 'package:sendtrain/database/database.dart'; +import 'package:sendtrain/widgets/generic/elements/form_text_input.dart'; + +class ActivityActionEditor extends StatelessWidget { + ActivityActionEditor({super.key, required this.action, this.callback}); + + final Action action; + final Function? callback; + final GlobalKey _formKey = GlobalKey(); + + final Map actionEditController = { + 'sets': TextEditingController(), + 'reps': TextEditingController(), + 'weight': TextEditingController(), + }; + + @override + Widget build(BuildContext context) { + String editorType = 'Create'; + + return Padding( + padding: EdgeInsets.fromLTRB(15, 0, 15, 15), + child: Form( + key: _formKey, + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Padding( + padding: EdgeInsets.only(top: 10, bottom: 10), + child: Text('$editorType Action', + textAlign: TextAlign.center, + style: Theme.of(context).textTheme.titleLarge)), + FormTextInput( + controller: actionEditController['sets']!, + title: 'Total Sets'),]))); + } +} \ No newline at end of file diff --git a/lib/widgets/activities/activity_action_view.dart b/lib/widgets/activities/activity_action_view.dart index 73d965d..14b7255 100644 --- a/lib/widgets/activities/activity_action_view.dart +++ b/lib/widgets/activities/activity_action_view.dart @@ -1,20 +1,26 @@ -import 'dart:convert'; - import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:scrollable_positioned_list/scrollable_positioned_list.dart'; +import 'package:sendtrain/database/database.dart'; import 'package:sendtrain/extensions/string_extensions.dart'; -import 'package:sendtrain/models/activity_timer_model.dart'; +import 'package:sendtrain/models/action_model.dart'; +import 'package:sendtrain/providers/action_timer.dart'; +import 'package:sendtrain/widgets/generic/elements/add_card_generic.dart'; class ActivityActionView extends StatefulWidget { - const ActivityActionView({super.key, required this.actions}); + const ActivityActionView({super.key, required this.actions, this.resetOnLoad = true}); final List actions; + final bool resetOnLoad; @override State createState() => ActivityActionViewState(); } class ActivityActionViewState extends State { +// class ActivityActionView extends StatelessWidget { + // ActivityActionView({super.key, required this.actions}); + + // final List actions; final ItemScrollController itemScrollController = ItemScrollController(); final ScrollOffsetController scrollOffsetController = ScrollOffsetController(); @@ -23,88 +29,199 @@ class ActivityActionViewState extends State { final ScrollOffsetListener scrollOffsetListener = ScrollOffsetListener.create(); + late final ActionTimer at; + int actionCount = 0; + + GestureDetector gtBuild( + ActionTimer at, Item item, int actionNum, int selectedIndex, + {int? order}) { + // default, for rests + String setItemRef = '-'; + + // non rests decimal reference to item + if (order != null) { + setItemRef = '${order + 1}.${item.position + 1}'; + } + + return GestureDetector(onTap: () { + at.setAction(actionNum, true); + }, child: Consumer(builder: (context, at, child) { + return Row(children: [ + Ink( + width: 70, + padding: const EdgeInsets.all(15), + color: item == at.currentAction + ? Theme.of(context).colorScheme.primaryContainer + : Theme.of(context).colorScheme.onPrimary, + child: Text(textAlign: TextAlign.center, setItemRef)), + Expanded( + child: Ink( + padding: const EdgeInsets.all(15), + color: item == at.currentAction + ? Theme.of(context).colorScheme.surfaceBright + : Theme.of(context).colorScheme.surfaceContainerLow, + child: Text( + textAlign: TextAlign.center, + '${item.name}: ${item.value} ${item.humanValueType}' + .toTitleCase()))) + ]); + })); + } + + @override + void initState() { + super.initState(); + at = Provider.of(context, listen: false); + } + @override Widget build(BuildContext context) { - ActivityTimerModel atm = - Provider.of(context, listen: true); - List sets = json.decode(widget.actions[0].set); + if (widget.actions.isNotEmpty) { + at.setup(ActionModel( + action: widget.actions.first, db: Provider.of(context)), itemScrollController, widget.resetOnLoad); - // we need to set the scroll controller - // so we can update the selected item position - atm.setScrollController(itemScrollController); + // WidgetsBinding.instance.addPostFrameCallback((_) { + // if (itemScrollController.isAttached) { + // itemScrollController.scrollTo( + // index: at.currentAction.parentId != null + // ? at.currentAction.parentId! + // : at.currentAction.id, + // duration: Duration(milliseconds: 500), + // curve: Curves.easeInOutCubic); + // } + // }); - return Expanded( - child: ScrollablePositionedList.builder( - padding: const EdgeInsets.fromLTRB(10, 0, 10, 20), - itemCount: sets.length, - itemScrollController: itemScrollController, - scrollOffsetController: scrollOffsetController, - itemPositionsListener: itemPositionsListener, - scrollOffsetListener: scrollOffsetListener, - itemBuilder: (BuildContext context, int setNum) { - List content = []; - List set = sets[setNum]; + return Expanded( + child: Column(children: [ + Padding( + padding: const EdgeInsets.only(left: 10, right: 10), + child: Card( + clipBehavior: Clip.antiAlias, + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(10), + topRight: Radius.circular(10)), + ), + color: Theme.of(context).colorScheme.onPrimary, + child: Row(children: [ + Ink( + width: 70, + color: Theme.of(context).colorScheme.primaryContainer, + child: Consumer( + builder: (context, at, child) { + return IconButton( + alignment: AlignmentDirectional.center, + icon: at.available + ? const Icon(Icons.play_arrow_rounded) + : const Icon(Icons.pause_rounded), + onPressed: () => { + if (at.started) + {at.pause()} + else if (at.available) + {at.start()} + }); + }, + )), + Expanded( + flex: 1, + child: Stack(alignment: Alignment.center, children: [ + Container( + alignment: Alignment.center, + child: Consumer( + builder: (context, at, child) { + return Text( + style: const TextStyle(fontSize: 20), + textAlign: TextAlign.center, + '${at.currentValue} ${at.currentAction.humanValueType}' + .toTitleCase()); + }, + ), + ), + Container( + alignment: Alignment.centerRight, + padding: EdgeInsets.only(right: 15), + child: Consumer( + builder: (context, at, child) { + return Text( + style: const TextStyle(fontSize: 12), + textAlign: TextAlign.right, + '${at.state['currentAction'] + 1} of ${at.allActions.length}'); + })), + ])), + ]))), + Padding( + padding: EdgeInsets.only(left: 14, right: 14), + child: Consumer(builder: (context, at, child) { + return LinearProgressIndicator( + value: at.progress, + semanticsLabel: 'Activity Progress', + ); + })), + Expanded( + child: ScrollablePositionedList.builder( + padding: const EdgeInsets.fromLTRB(10, 0, 10, 20), + itemCount: at.items.length, + // initialScrollIndex: at.currentAction.parentId != null + // ? at.currentAction.parentId! + // : at.currentAction.id, + itemScrollController: itemScrollController, + scrollOffsetController: scrollOffsetController, + itemPositionsListener: itemPositionsListener, + scrollOffsetListener: scrollOffsetListener, + itemBuilder: (BuildContext context, int itemNum) { + if (itemNum == 0) { + actionCount = 0; + } - for (int actionNum = 0; actionNum < set.length; actionNum++) { - Map setItem = set[actionNum]; + List content = []; + Item item = at.items[itemNum]; + if (item.runtimeType == Rest) { + content.add(gtBuild(at, item, actionCount++, itemNum)); + } else if (item.runtimeType == Set) { + List setItems = item.items; - content.add(GestureDetector( - onTap: () { - atm.setAction(setNum, actionNum, 'manual'); - atm.setActionCount(); + for (int setItemNum = 0; + setItemNum < setItems.length; + setItemNum++) { + Item setItem = setItems[setItemNum]; + content.add(gtBuild(at, setItem, actionCount++, itemNum, + order: (item as Set).setOrder)); + } + } - itemScrollController.scrollTo( - index: setNum, - duration: Duration(milliseconds: 500), - curve: Curves.easeInOutCubic); - }, - child: Row(children: [ - Ink( - width: 70, - padding: const EdgeInsets.all(15), - color: atm.isCurrentItem(setNum, actionNum) - ? Theme.of(context).colorScheme.primaryContainer - : Theme.of(context).colorScheme.onPrimary, - child: Text( - textAlign: TextAlign.center, - '${setNum + 1}.${actionNum + 1} ')), - Expanded( - child: Ink( - padding: const EdgeInsets.all(15), - color: atm.isCurrentItem(setNum, actionNum) - ? Theme.of(context).colorScheme.surfaceBright - : Theme.of(context).colorScheme.surfaceContainerLow, - child: Text( - textAlign: TextAlign.center, - '${setItem['name']}: ${setItem['amount']} ${setItem['type']}'.toTitleCase()))) - ]))); - } - - if (setNum == 0) { - return Card( - shape: const RoundedRectangleBorder( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(0), - topRight: Radius.circular(0), - bottomLeft: Radius.circular(10), - bottomRight: Radius.circular(10)), - ), - clipBehavior: Clip.antiAlias, - child: Column(children: content)); - } else { - return Card( - shape: const RoundedRectangleBorder( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(10), - topRight: Radius.circular(10), - bottomLeft: Radius.circular(10), - bottomRight: Radius.circular(10)), - ), - clipBehavior: Clip.antiAlias, - child: Column(children: content)); - } - // return Column(children: contents); - }, - )); + if (itemNum == 0) { + return Card( + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(0), + topRight: Radius.circular(0), + bottomLeft: Radius.circular(10), + bottomRight: Radius.circular(10)), + ), + clipBehavior: Clip.antiAlias, + child: Column(children: content)); + } else { + return Card( + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(10), + topRight: Radius.circular(10), + bottomLeft: Radius.circular(10), + bottomRight: Radius.circular(10)), + ), + clipBehavior: Clip.antiAlias, + child: Column(children: content)); + } + })) + ])); + } else { + return AddCardGeneric( + title: 'Add an Action!', + description: + 'Click here to create an exercise template (sets and reps, etc) for your activity!', + action: () { + print('teset'); + }); + } } } diff --git a/lib/widgets/activities/activity_view.dart b/lib/widgets/activities/activity_view.dart index d1c5d94..be0c517 100644 --- a/lib/widgets/activities/activity_view.dart +++ b/lib/widgets/activities/activity_view.dart @@ -1,17 +1,17 @@ import 'dart:convert'; -import 'package:flutter/material.dart'; +import 'package:flutter/material.dart' hide Action; import 'package:flutter_expandable_fab/flutter_expandable_fab.dart'; import 'package:provider/provider.dart'; import 'package:sendtrain/daos/actions_dao.dart'; import 'package:sendtrain/database/database.dart'; import 'package:sendtrain/extensions/string_extensions.dart'; import 'package:sendtrain/helpers/widget_helpers.dart'; -import 'package:sendtrain/models/activity_timer_model.dart'; +import 'package:sendtrain/widgets/activities/activity_action_editor.dart'; import 'package:sendtrain/widgets/activities/activity_action_view.dart'; import 'package:sendtrain/widgets/activities/activity_view_categories.dart'; import 'package:sendtrain/widgets/activities/activity_view_media.dart'; -import 'package:sendtrain/widgets/generic/elements/add_card_generic.dart'; +import 'package:sendtrain/widgets/builders/dialogs.dart'; class ActivityView extends StatefulWidget { const ActivityView({super.key, required this.activity}); @@ -22,7 +22,7 @@ class ActivityView extends StatefulWidget { } class _ActivityViewState extends State { - List activity_muscle(Activity activity) { + List activityMuscle(Activity activity) { List muscles = []; if (activity.primaryMuscles != null) { @@ -36,132 +36,72 @@ class _ActivityViewState extends State { return muscles; } - List action(actions) { - if (actions.isNotEmpty) { - return [ - Padding( - padding: const EdgeInsets.only(left: 10, right: 10), - child: Card( - clipBehavior: Clip.antiAlias, - shape: const RoundedRectangleBorder( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(10), - topRight: Radius.circular(10)), - ), - color: Theme.of(context).colorScheme.onPrimary, - child: Row(children: [ - Ink( - width: 70, - color: Theme.of(context).colorScheme.primaryContainer, - child: Consumer( - builder: (context, atm, child) { - return IconButton( - alignment: AlignmentDirectional.center, - icon: atm.isActive - ? const Icon(Icons.pause_rounded) - : const Icon(Icons.play_arrow_rounded), - onPressed: () => - {atm.isActive ? atm.pause() : atm.start()}); - }, - )), - Expanded( - flex: 1, - child: Stack(alignment: Alignment.center, children: [ - Container( - alignment: Alignment.center, - child: Consumer( - builder: (context, atm, child) { - return Text( - style: const TextStyle(fontSize: 20), - textAlign: TextAlign.center, - '${atm.actionCount} ${atm.currentAction['type']}' - .toTitleCase()); - }, - ), - ), - Container( - alignment: Alignment.centerRight, - padding: EdgeInsets.only(right: 15), - child: Consumer( - builder: (context, atm, child) { - return Text( - style: const TextStyle(fontSize: 12), - textAlign: TextAlign.right, - '${atm.currentAction['actionID'] + 1} of ${atm.totalActions()}'); - })), - ])), - ]))), - Padding( - padding: EdgeInsets.only(left: 14, right: 14), - child: Consumer(builder: (context, atm, child) { - return LinearProgressIndicator( - value: atm.progress, - semanticsLabel: 'Activity Progress', - ); - })), - ActivityActionView(actions: actions) - ]; - } else { - return [ - AddCardGeneric( - title: 'Add an Action!', - description: - 'Click here to create an exercise template (sets and reps, etc) for your activity!', - action: () { - print('teset'); - }) - ]; - } - } - @override Widget build(BuildContext context) { final Activity activity = widget.activity; - ActivityTimerModel atm = - Provider.of(context, listen: false); return FutureBuilder( future: ActionsDao(Provider.of(context)) .fromActivity(activity), builder: (context, snapshot) { if (snapshot.hasData) { - List actions = snapshot.data!; - atm.setup(activity, actions); + List actions = snapshot.data! as List; - return Scaffold( - floatingActionButtonLocation: ExpandableFab.location, - floatingActionButton: ExpandableFab( - distance: 70, - type: ExpandableFabType.up, - overlayStyle: ExpandableFabOverlayStyle( - color: Colors.black.withOpacity(0.5), - blur: 10, - ), - children: [ - // FloatingActionButton.extended( - // icon: const Icon(Icons.upload_outlined), - // label: Text('Upload Media'), - // onPressed: () {}, - // ), - FloatingActionButton.extended( - icon: const Icon(Icons.note_add_outlined), - label: Text('Add Note'), - onPressed: () {}, - ), - FloatingActionButton.extended( - icon: const Icon(Icons.history_outlined), - label: Text('Restart'), - onPressed: () {}, - ), - FloatingActionButton.extended( - icon: const Icon(Icons.done_all_outlined), - label: Text('Done'), - onPressed: () {}, - ), - ]), - body: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ + return PopScope( + canPop: false, + onPopInvokedWithResult: (didPop, result) async { + if (didPop) { + return; + } + final bool shouldPop = await showBackDialog(context) ?? false; + if (context.mounted && shouldPop) { + Navigator.pop(context); + } + }, + child: Scaffold( + floatingActionButtonLocation: ExpandableFab.location, + floatingActionButton: ExpandableFab( + distance: 70, + type: ExpandableFabType.up, + overlayStyle: ExpandableFabOverlayStyle( + color: Colors.black.withOpacity(0.5), + blur: 10, + ), + children: [ + // FloatingActionButton.extended( + // icon: const Icon(Icons.upload_outlined), + // label: Text('Upload Media'), + // onPressed: () {}, + // ), + FloatingActionButton.extended( + icon: const Icon(Icons.done_all_outlined), + label: Text('Edit Action'), + onPressed: () { + showEditorSheet( + context, + ActivityActionEditor( + action: actions.first, callback: () {})); + }, + ), + FloatingActionButton.extended( + icon: const Icon(Icons.note_add_outlined), + label: Text('Add Note'), + onPressed: () {}, + ), + FloatingActionButton.extended( + icon: const Icon(Icons.history_outlined), + label: Text('Restart'), + onPressed: () {}, + ), + FloatingActionButton.extended( + icon: const Icon(Icons.done_all_outlined), + label: Text('Done'), + onPressed: () {}, + ), + ]), + body: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ AppBar( titleSpacing: 0, centerTitle: true, @@ -215,7 +155,7 @@ class _ActivityViewState extends State { List>( icon: Icon(Icons.person), text: 'Muscles used', - object: activity_muscle(activity)) + object: activityMuscle(activity)) ])), Padding( padding: const EdgeInsets.only( @@ -272,16 +212,35 @@ class _ActivityViewState extends State { fontWeight: FontWeight.bold), 'Media:')), ActivityViewMedia(activity: activity), - const Padding( - padding: EdgeInsets.fromLTRB(15, 30, 0, 10), - child: Text( - textAlign: TextAlign.left, - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.bold), - 'Actions')), - ] + - action(actions))); + Padding( + padding: const EdgeInsets.fromLTRB(15, 20, 5, 0), + child: Row(children: [ + Expanded( + child: const Text( + textAlign: TextAlign.left, + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold), + 'Actions')), + IconButton( + onPressed: () { + showGenericSheet( + context, + Column(children: [ + ActivityActionView( + actions: actions, + resetOnLoad: false) + ]), + Theme.of(context).colorScheme.surface); + }, + icon: Icon(Icons.expand), + alignment: Alignment.bottomCenter, + ) + ])), + ActivityActionView(actions: actions) + ]))); + // ] + + // action(actions, context))); } else { return Container( alignment: Alignment.center, diff --git a/lib/widgets/builders/dialogs.dart b/lib/widgets/builders/dialogs.dart index 72cb411..a8078a1 100644 --- a/lib/widgets/builders/dialogs.dart +++ b/lib/widgets/builders/dialogs.dart @@ -1,4 +1,6 @@ import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:sendtrain/providers/action_timer.dart'; Future showGenericDialog(dynamic object, BuildContext parentContext) { return showGeneralDialog( @@ -55,3 +57,51 @@ Future showUpdateDialog(String title, String content, BuildContext context, [Function? callback]) { return showCrudDialog(title, content, context, callback); } + +// TODO - factor out, this should be more generic +Future showBackDialog(BuildContext context) async { + ActionTimer at = Provider.of(context, listen: false); + + if (at.pending || at.complete) { + await at.clear(); + return true; + } else { + return await showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: const Text('Are you sure?'), + content: const Text( + 'Leaving will stop the current activity. Are you sure you want to leave?', + ), + actions: [ + TextButton( + style: TextButton.styleFrom( + textStyle: Theme.of(context).textTheme.labelLarge, + ), + child: const Text('Nevermind'), + onPressed: () async { + Navigator.pop(context, false); + }, + ), + TextButton( + style: TextButton.styleFrom( + textStyle: Theme.of(context).textTheme.labelLarge, + ), + child: const Text('Leave'), + onPressed: () async { + ActionTimer at = + Provider.of(context, listen: false); + await at.clear(); + + if (context.mounted) { + Navigator.pop(context, true); + } + }, + ), + ], + ); + }, + ); + } +} diff --git a/lib/widgets/generic/elements/form_search_input.dart b/lib/widgets/generic/elements/form_search_input.dart index 1836f25..a3ae776 100644 --- a/lib/widgets/generic/elements/form_search_input.dart +++ b/lib/widgets/generic/elements/form_search_input.dart @@ -82,33 +82,35 @@ class _FormSearchInputState extends State { @override Widget build(BuildContext context) { return SearchAnchor( + isFullScreen: false, builder: (BuildContext context, SearchController controller) { - return FormTextInput( - controller: widget.controller, - title: widget.title ?? "", - icon: Icon(Icons.search_rounded), - maxLines: 2, - requiresValidation: false, - onTap: () { - controller.openView(); - }); - }, suggestionsBuilder: + return FormTextInput( + controller: widget.controller, + title: widget.title ?? "", + icon: Icon(Icons.search_rounded), + maxLines: 2, + requiresValidation: false, + onTap: () { + controller.openView(); + }); + }, + suggestionsBuilder: (BuildContext context, SearchController controller) async { - final List? options = - (await debouncer.process(controller.text))?.toList(); - if (options == null) { - return _lastOptions; - } - _lastOptions = List.generate(options.length, (int index) { - final Suggestion item = options[index]; - final dynamic content = item.content; - return service.resultWidget(content, () { - resultHandler(content, service); - controller.closeView(null); - }); - }); + final List? options = + (await debouncer.process(controller.text))?.toList(); + if (options == null) { + return _lastOptions; + } + _lastOptions = List.generate(options.length, (int index) { + final Suggestion item = options[index]; + final dynamic content = item.content; + return service.resultWidget(content, () { + resultHandler(content, service); + controller.closeView(null); + }); + }); - return _lastOptions; - }); + return _lastOptions; + }); } } diff --git a/pubspec.yaml b/pubspec.yaml index a4c09d8..2748ab5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -51,6 +51,7 @@ dependencies: mime: ^2.0.0 video_player: ^2.9.2 dart_casing: ^3.0.1 + collection: ^1.18.0 flutter_launcher_name: name: "SendTrain" diff --git a/test/drift/sendtrain/generated/schema.dart b/test/drift/sendtrain/generated/schema.dart index 3333477..2ad4626 100644 --- a/test/drift/sendtrain/generated/schema.dart +++ b/test/drift/sendtrain/generated/schema.dart @@ -25,6 +25,17 @@ import 'schema_v9.dart' as v9; import 'schema_v20.dart' as v20; import 'schema_v21.dart' as v21; import 'schema_v22.dart' as v22; +import 'schema_v23.dart' as v23; +import 'schema_v24.dart' as v24; +import 'schema_v25.dart' as v25; +import 'schema_v26.dart' as v26; +import 'schema_v27.dart' as v27; +import 'schema_v28.dart' as v28; +import 'schema_v29.dart' as v29; +import 'schema_v30.dart' as v30; +import 'schema_v31.dart' as v31; +import 'schema_v32.dart' as v32; +import 'schema_v33.dart' as v33; class GeneratedHelper implements SchemaInstantiationHelper { @override @@ -74,6 +85,28 @@ class GeneratedHelper implements SchemaInstantiationHelper { return v21.DatabaseAtV21(db); case 22: return v22.DatabaseAtV22(db); + case 23: + return v23.DatabaseAtV23(db); + case 24: + return v24.DatabaseAtV24(db); + case 25: + return v25.DatabaseAtV25(db); + case 26: + return v26.DatabaseAtV26(db); + case 27: + return v27.DatabaseAtV27(db); + case 28: + return v28.DatabaseAtV28(db); + case 29: + return v29.DatabaseAtV29(db); + case 30: + return v30.DatabaseAtV30(db); + case 31: + return v31.DatabaseAtV31(db); + case 32: + return v32.DatabaseAtV32(db); + case 33: + return v33.DatabaseAtV33(db); default: throw MissingSchemaException(version, versions); } @@ -101,6 +134,17 @@ class GeneratedHelper implements SchemaInstantiationHelper { 19, 20, 21, - 22 + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33 ]; } diff --git a/test/drift/sendtrain/generated/schema_v23.dart b/test/drift/sendtrain/generated/schema_v23.dart new file mode 100644 index 0000000..1a26b69 --- /dev/null +++ b/test/drift/sendtrain/generated/schema_v23.dart @@ -0,0 +1,2669 @@ +// dart format width=80 +// GENERATED CODE, DO NOT EDIT BY HAND. +// ignore_for_file: type=lint +import 'package:drift/drift.dart'; + +class Sessions extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + Sessions(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 32), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn content = GeneratedColumn( + 'body', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn status = GeneratedColumn( + 'status', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn achievements = GeneratedColumn( + 'achievements', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn address = GeneratedColumn( + 'address', aliasedName, true, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 256), + type: DriftSqlType.string, + requiredDuringInsert: false); + late final GeneratedColumn date = GeneratedColumn( + 'date', aliasedName, true, + type: DriftSqlType.dateTime, requiredDuringInsert: false); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, title, content, status, achievements, address, date, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'sessions'; + @override + Set get $primaryKey => {id}; + @override + SessionsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return SessionsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + content: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body'])!, + status: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}status'])!, + achievements: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}achievements']), + address: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}address']), + date: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}date']), + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + Sessions createAlias(String alias) { + return Sessions(attachedDatabase, alias); + } +} + +class SessionsData extends DataClass implements Insertable { + final int id; + final String title; + final String content; + final String status; + final String? achievements; + final String? address; + final DateTime? date; + final DateTime createdAt; + const SessionsData( + {required this.id, + required this.title, + required this.content, + required this.status, + this.achievements, + this.address, + this.date, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + map['body'] = Variable(content); + map['status'] = Variable(status); + if (!nullToAbsent || achievements != null) { + map['achievements'] = Variable(achievements); + } + if (!nullToAbsent || address != null) { + map['address'] = Variable(address); + } + if (!nullToAbsent || date != null) { + map['date'] = Variable(date); + } + map['created_at'] = Variable(createdAt); + return map; + } + + SessionsCompanion toCompanion(bool nullToAbsent) { + return SessionsCompanion( + id: Value(id), + title: Value(title), + content: Value(content), + status: Value(status), + achievements: achievements == null && nullToAbsent + ? const Value.absent() + : Value(achievements), + address: address == null && nullToAbsent + ? const Value.absent() + : Value(address), + date: date == null && nullToAbsent ? const Value.absent() : Value(date), + createdAt: Value(createdAt), + ); + } + + factory SessionsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return SessionsData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + content: serializer.fromJson(json['content']), + status: serializer.fromJson(json['status']), + achievements: serializer.fromJson(json['achievements']), + address: serializer.fromJson(json['address']), + date: serializer.fromJson(json['date']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'content': serializer.toJson(content), + 'status': serializer.toJson(status), + 'achievements': serializer.toJson(achievements), + 'address': serializer.toJson(address), + 'date': serializer.toJson(date), + 'createdAt': serializer.toJson(createdAt), + }; + } + + SessionsData copyWith( + {int? id, + String? title, + String? content, + String? status, + Value achievements = const Value.absent(), + Value address = const Value.absent(), + Value date = const Value.absent(), + DateTime? createdAt}) => + SessionsData( + id: id ?? this.id, + title: title ?? this.title, + content: content ?? this.content, + status: status ?? this.status, + achievements: + achievements.present ? achievements.value : this.achievements, + address: address.present ? address.value : this.address, + date: date.present ? date.value : this.date, + createdAt: createdAt ?? this.createdAt, + ); + SessionsData copyWithCompanion(SessionsCompanion data) { + return SessionsData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + content: data.content.present ? data.content.value : this.content, + status: data.status.present ? data.status.value : this.status, + achievements: data.achievements.present + ? data.achievements.value + : this.achievements, + address: data.address.present ? data.address.value : this.address, + date: data.date.present ? data.date.value : this.date, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('SessionsData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('content: $content, ') + ..write('status: $status, ') + ..write('achievements: $achievements, ') + ..write('address: $address, ') + ..write('date: $date, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash( + id, title, content, status, achievements, address, date, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is SessionsData && + other.id == this.id && + other.title == this.title && + other.content == this.content && + other.status == this.status && + other.achievements == this.achievements && + other.address == this.address && + other.date == this.date && + other.createdAt == this.createdAt); +} + +class SessionsCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value content; + final Value status; + final Value achievements; + final Value address; + final Value date; + final Value createdAt; + const SessionsCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.content = const Value.absent(), + this.status = const Value.absent(), + this.achievements = const Value.absent(), + this.address = const Value.absent(), + this.date = const Value.absent(), + this.createdAt = const Value.absent(), + }); + SessionsCompanion.insert({ + this.id = const Value.absent(), + required String title, + required String content, + required String status, + this.achievements = const Value.absent(), + this.address = const Value.absent(), + this.date = const Value.absent(), + this.createdAt = const Value.absent(), + }) : title = Value(title), + content = Value(content), + status = Value(status); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? content, + Expression? status, + Expression? achievements, + Expression? address, + Expression? date, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (content != null) 'body': content, + if (status != null) 'status': status, + if (achievements != null) 'achievements': achievements, + if (address != null) 'address': address, + if (date != null) 'date': date, + if (createdAt != null) 'created_at': createdAt, + }); + } + + SessionsCompanion copyWith( + {Value? id, + Value? title, + Value? content, + Value? status, + Value? achievements, + Value? address, + Value? date, + Value? createdAt}) { + return SessionsCompanion( + id: id ?? this.id, + title: title ?? this.title, + content: content ?? this.content, + status: status ?? this.status, + achievements: achievements ?? this.achievements, + address: address ?? this.address, + date: date ?? this.date, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (content.present) { + map['body'] = Variable(content.value); + } + if (status.present) { + map['status'] = Variable(status.value); + } + if (achievements.present) { + map['achievements'] = Variable(achievements.value); + } + if (address.present) { + map['address'] = Variable(address.value); + } + if (date.present) { + map['date'] = Variable(date.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('SessionsCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('content: $content, ') + ..write('status: $status, ') + ..write('achievements: $achievements, ') + ..write('address: $address, ') + ..write('date: $date, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class Activities extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + Activities(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 100), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn type = GeneratedColumn( + 'type', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn description = GeneratedColumn( + 'body', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn category = GeneratedColumn( + 'category', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn force = GeneratedColumn( + 'force', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn level = GeneratedColumn( + 'level', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn mechanic = GeneratedColumn( + 'mechanic', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn equipment = GeneratedColumn( + 'equipment', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn primaryMuscles = GeneratedColumn( + 'primary_muscles', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn secondaryMuscles = GeneratedColumn( + 'secondary_muscles', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => [ + id, + title, + type, + description, + category, + force, + level, + mechanic, + equipment, + primaryMuscles, + secondaryMuscles, + createdAt + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'activities'; + @override + Set get $primaryKey => {id}; + @override + ActivitiesData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ActivitiesData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + type: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}type']), + description: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body']), + category: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}category']), + force: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}force']), + level: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}level']), + mechanic: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}mechanic']), + equipment: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}equipment']), + primaryMuscles: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}primary_muscles']), + secondaryMuscles: attachedDatabase.typeMapping.read( + DriftSqlType.string, data['${effectivePrefix}secondary_muscles']), + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + Activities createAlias(String alias) { + return Activities(attachedDatabase, alias); + } +} + +class ActivitiesData extends DataClass implements Insertable { + final int id; + final String title; + final String? type; + final String? description; + final String? category; + final String? force; + final String? level; + final String? mechanic; + final String? equipment; + final String? primaryMuscles; + final String? secondaryMuscles; + final DateTime createdAt; + const ActivitiesData( + {required this.id, + required this.title, + this.type, + this.description, + this.category, + this.force, + this.level, + this.mechanic, + this.equipment, + this.primaryMuscles, + this.secondaryMuscles, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + if (!nullToAbsent || type != null) { + map['type'] = Variable(type); + } + if (!nullToAbsent || description != null) { + map['body'] = Variable(description); + } + if (!nullToAbsent || category != null) { + map['category'] = Variable(category); + } + if (!nullToAbsent || force != null) { + map['force'] = Variable(force); + } + if (!nullToAbsent || level != null) { + map['level'] = Variable(level); + } + if (!nullToAbsent || mechanic != null) { + map['mechanic'] = Variable(mechanic); + } + if (!nullToAbsent || equipment != null) { + map['equipment'] = Variable(equipment); + } + if (!nullToAbsent || primaryMuscles != null) { + map['primary_muscles'] = Variable(primaryMuscles); + } + if (!nullToAbsent || secondaryMuscles != null) { + map['secondary_muscles'] = Variable(secondaryMuscles); + } + map['created_at'] = Variable(createdAt); + return map; + } + + ActivitiesCompanion toCompanion(bool nullToAbsent) { + return ActivitiesCompanion( + id: Value(id), + title: Value(title), + type: type == null && nullToAbsent ? const Value.absent() : Value(type), + description: description == null && nullToAbsent + ? const Value.absent() + : Value(description), + category: category == null && nullToAbsent + ? const Value.absent() + : Value(category), + force: + force == null && nullToAbsent ? const Value.absent() : Value(force), + level: + level == null && nullToAbsent ? const Value.absent() : Value(level), + mechanic: mechanic == null && nullToAbsent + ? const Value.absent() + : Value(mechanic), + equipment: equipment == null && nullToAbsent + ? const Value.absent() + : Value(equipment), + primaryMuscles: primaryMuscles == null && nullToAbsent + ? const Value.absent() + : Value(primaryMuscles), + secondaryMuscles: secondaryMuscles == null && nullToAbsent + ? const Value.absent() + : Value(secondaryMuscles), + createdAt: Value(createdAt), + ); + } + + factory ActivitiesData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ActivitiesData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + type: serializer.fromJson(json['type']), + description: serializer.fromJson(json['description']), + category: serializer.fromJson(json['category']), + force: serializer.fromJson(json['force']), + level: serializer.fromJson(json['level']), + mechanic: serializer.fromJson(json['mechanic']), + equipment: serializer.fromJson(json['equipment']), + primaryMuscles: serializer.fromJson(json['primaryMuscles']), + secondaryMuscles: serializer.fromJson(json['secondaryMuscles']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'type': serializer.toJson(type), + 'description': serializer.toJson(description), + 'category': serializer.toJson(category), + 'force': serializer.toJson(force), + 'level': serializer.toJson(level), + 'mechanic': serializer.toJson(mechanic), + 'equipment': serializer.toJson(equipment), + 'primaryMuscles': serializer.toJson(primaryMuscles), + 'secondaryMuscles': serializer.toJson(secondaryMuscles), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ActivitiesData copyWith( + {int? id, + String? title, + Value type = const Value.absent(), + Value description = const Value.absent(), + Value category = const Value.absent(), + Value force = const Value.absent(), + Value level = const Value.absent(), + Value mechanic = const Value.absent(), + Value equipment = const Value.absent(), + Value primaryMuscles = const Value.absent(), + Value secondaryMuscles = const Value.absent(), + DateTime? createdAt}) => + ActivitiesData( + id: id ?? this.id, + title: title ?? this.title, + type: type.present ? type.value : this.type, + description: description.present ? description.value : this.description, + category: category.present ? category.value : this.category, + force: force.present ? force.value : this.force, + level: level.present ? level.value : this.level, + mechanic: mechanic.present ? mechanic.value : this.mechanic, + equipment: equipment.present ? equipment.value : this.equipment, + primaryMuscles: + primaryMuscles.present ? primaryMuscles.value : this.primaryMuscles, + secondaryMuscles: secondaryMuscles.present + ? secondaryMuscles.value + : this.secondaryMuscles, + createdAt: createdAt ?? this.createdAt, + ); + ActivitiesData copyWithCompanion(ActivitiesCompanion data) { + return ActivitiesData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + type: data.type.present ? data.type.value : this.type, + description: + data.description.present ? data.description.value : this.description, + category: data.category.present ? data.category.value : this.category, + force: data.force.present ? data.force.value : this.force, + level: data.level.present ? data.level.value : this.level, + mechanic: data.mechanic.present ? data.mechanic.value : this.mechanic, + equipment: data.equipment.present ? data.equipment.value : this.equipment, + primaryMuscles: data.primaryMuscles.present + ? data.primaryMuscles.value + : this.primaryMuscles, + secondaryMuscles: data.secondaryMuscles.present + ? data.secondaryMuscles.value + : this.secondaryMuscles, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ActivitiesData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('type: $type, ') + ..write('description: $description, ') + ..write('category: $category, ') + ..write('force: $force, ') + ..write('level: $level, ') + ..write('mechanic: $mechanic, ') + ..write('equipment: $equipment, ') + ..write('primaryMuscles: $primaryMuscles, ') + ..write('secondaryMuscles: $secondaryMuscles, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(id, title, type, description, category, force, + level, mechanic, equipment, primaryMuscles, secondaryMuscles, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ActivitiesData && + other.id == this.id && + other.title == this.title && + other.type == this.type && + other.description == this.description && + other.category == this.category && + other.force == this.force && + other.level == this.level && + other.mechanic == this.mechanic && + other.equipment == this.equipment && + other.primaryMuscles == this.primaryMuscles && + other.secondaryMuscles == this.secondaryMuscles && + other.createdAt == this.createdAt); +} + +class ActivitiesCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value type; + final Value description; + final Value category; + final Value force; + final Value level; + final Value mechanic; + final Value equipment; + final Value primaryMuscles; + final Value secondaryMuscles; + final Value createdAt; + const ActivitiesCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.type = const Value.absent(), + this.description = const Value.absent(), + this.category = const Value.absent(), + this.force = const Value.absent(), + this.level = const Value.absent(), + this.mechanic = const Value.absent(), + this.equipment = const Value.absent(), + this.primaryMuscles = const Value.absent(), + this.secondaryMuscles = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ActivitiesCompanion.insert({ + this.id = const Value.absent(), + required String title, + this.type = const Value.absent(), + this.description = const Value.absent(), + this.category = const Value.absent(), + this.force = const Value.absent(), + this.level = const Value.absent(), + this.mechanic = const Value.absent(), + this.equipment = const Value.absent(), + this.primaryMuscles = const Value.absent(), + this.secondaryMuscles = const Value.absent(), + this.createdAt = const Value.absent(), + }) : title = Value(title); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? type, + Expression? description, + Expression? category, + Expression? force, + Expression? level, + Expression? mechanic, + Expression? equipment, + Expression? primaryMuscles, + Expression? secondaryMuscles, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (type != null) 'type': type, + if (description != null) 'body': description, + if (category != null) 'category': category, + if (force != null) 'force': force, + if (level != null) 'level': level, + if (mechanic != null) 'mechanic': mechanic, + if (equipment != null) 'equipment': equipment, + if (primaryMuscles != null) 'primary_muscles': primaryMuscles, + if (secondaryMuscles != null) 'secondary_muscles': secondaryMuscles, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ActivitiesCompanion copyWith( + {Value? id, + Value? title, + Value? type, + Value? description, + Value? category, + Value? force, + Value? level, + Value? mechanic, + Value? equipment, + Value? primaryMuscles, + Value? secondaryMuscles, + Value? createdAt}) { + return ActivitiesCompanion( + id: id ?? this.id, + title: title ?? this.title, + type: type ?? this.type, + description: description ?? this.description, + category: category ?? this.category, + force: force ?? this.force, + level: level ?? this.level, + mechanic: mechanic ?? this.mechanic, + equipment: equipment ?? this.equipment, + primaryMuscles: primaryMuscles ?? this.primaryMuscles, + secondaryMuscles: secondaryMuscles ?? this.secondaryMuscles, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (type.present) { + map['type'] = Variable(type.value); + } + if (description.present) { + map['body'] = Variable(description.value); + } + if (category.present) { + map['category'] = Variable(category.value); + } + if (force.present) { + map['force'] = Variable(force.value); + } + if (level.present) { + map['level'] = Variable(level.value); + } + if (mechanic.present) { + map['mechanic'] = Variable(mechanic.value); + } + if (equipment.present) { + map['equipment'] = Variable(equipment.value); + } + if (primaryMuscles.present) { + map['primary_muscles'] = Variable(primaryMuscles.value); + } + if (secondaryMuscles.present) { + map['secondary_muscles'] = Variable(secondaryMuscles.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ActivitiesCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('type: $type, ') + ..write('description: $description, ') + ..write('category: $category, ') + ..write('force: $force, ') + ..write('level: $level, ') + ..write('mechanic: $mechanic, ') + ..write('equipment: $equipment, ') + ..write('primaryMuscles: $primaryMuscles, ') + ..write('secondaryMuscles: $secondaryMuscles, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class SessionActivities extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + SessionActivities(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn sessionId = GeneratedColumn( + 'session_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES sessions (id) ON DELETE CASCADE')); + late final GeneratedColumn activityId = GeneratedColumn( + 'activity_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES activities (id) ON DELETE CASCADE')); + late final GeneratedColumn position = GeneratedColumn( + 'position', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn results = GeneratedColumn( + 'results', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, sessionId, activityId, position, results, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'session_activities'; + @override + Set get $primaryKey => {id}; + @override + SessionActivitiesData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return SessionActivitiesData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + sessionId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}session_id'])!, + activityId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}activity_id'])!, + position: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}position'])!, + results: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}results']), + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + SessionActivities createAlias(String alias) { + return SessionActivities(attachedDatabase, alias); + } +} + +class SessionActivitiesData extends DataClass + implements Insertable { + final int id; + final int sessionId; + final int activityId; + final int position; + final String? results; + final DateTime createdAt; + const SessionActivitiesData( + {required this.id, + required this.sessionId, + required this.activityId, + required this.position, + this.results, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['session_id'] = Variable(sessionId); + map['activity_id'] = Variable(activityId); + map['position'] = Variable(position); + if (!nullToAbsent || results != null) { + map['results'] = Variable(results); + } + map['created_at'] = Variable(createdAt); + return map; + } + + SessionActivitiesCompanion toCompanion(bool nullToAbsent) { + return SessionActivitiesCompanion( + id: Value(id), + sessionId: Value(sessionId), + activityId: Value(activityId), + position: Value(position), + results: results == null && nullToAbsent + ? const Value.absent() + : Value(results), + createdAt: Value(createdAt), + ); + } + + factory SessionActivitiesData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return SessionActivitiesData( + id: serializer.fromJson(json['id']), + sessionId: serializer.fromJson(json['sessionId']), + activityId: serializer.fromJson(json['activityId']), + position: serializer.fromJson(json['position']), + results: serializer.fromJson(json['results']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'sessionId': serializer.toJson(sessionId), + 'activityId': serializer.toJson(activityId), + 'position': serializer.toJson(position), + 'results': serializer.toJson(results), + 'createdAt': serializer.toJson(createdAt), + }; + } + + SessionActivitiesData copyWith( + {int? id, + int? sessionId, + int? activityId, + int? position, + Value results = const Value.absent(), + DateTime? createdAt}) => + SessionActivitiesData( + id: id ?? this.id, + sessionId: sessionId ?? this.sessionId, + activityId: activityId ?? this.activityId, + position: position ?? this.position, + results: results.present ? results.value : this.results, + createdAt: createdAt ?? this.createdAt, + ); + SessionActivitiesData copyWithCompanion(SessionActivitiesCompanion data) { + return SessionActivitiesData( + id: data.id.present ? data.id.value : this.id, + sessionId: data.sessionId.present ? data.sessionId.value : this.sessionId, + activityId: + data.activityId.present ? data.activityId.value : this.activityId, + position: data.position.present ? data.position.value : this.position, + results: data.results.present ? data.results.value : this.results, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('SessionActivitiesData(') + ..write('id: $id, ') + ..write('sessionId: $sessionId, ') + ..write('activityId: $activityId, ') + ..write('position: $position, ') + ..write('results: $results, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(id, sessionId, activityId, position, results, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is SessionActivitiesData && + other.id == this.id && + other.sessionId == this.sessionId && + other.activityId == this.activityId && + other.position == this.position && + other.results == this.results && + other.createdAt == this.createdAt); +} + +class SessionActivitiesCompanion + extends UpdateCompanion { + final Value id; + final Value sessionId; + final Value activityId; + final Value position; + final Value results; + final Value createdAt; + const SessionActivitiesCompanion({ + this.id = const Value.absent(), + this.sessionId = const Value.absent(), + this.activityId = const Value.absent(), + this.position = const Value.absent(), + this.results = const Value.absent(), + this.createdAt = const Value.absent(), + }); + SessionActivitiesCompanion.insert({ + this.id = const Value.absent(), + required int sessionId, + required int activityId, + required int position, + this.results = const Value.absent(), + this.createdAt = const Value.absent(), + }) : sessionId = Value(sessionId), + activityId = Value(activityId), + position = Value(position); + static Insertable custom({ + Expression? id, + Expression? sessionId, + Expression? activityId, + Expression? position, + Expression? results, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (sessionId != null) 'session_id': sessionId, + if (activityId != null) 'activity_id': activityId, + if (position != null) 'position': position, + if (results != null) 'results': results, + if (createdAt != null) 'created_at': createdAt, + }); + } + + SessionActivitiesCompanion copyWith( + {Value? id, + Value? sessionId, + Value? activityId, + Value? position, + Value? results, + Value? createdAt}) { + return SessionActivitiesCompanion( + id: id ?? this.id, + sessionId: sessionId ?? this.sessionId, + activityId: activityId ?? this.activityId, + position: position ?? this.position, + results: results ?? this.results, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (sessionId.present) { + map['session_id'] = Variable(sessionId.value); + } + if (activityId.present) { + map['activity_id'] = Variable(activityId.value); + } + if (position.present) { + map['position'] = Variable(position.value); + } + if (results.present) { + map['results'] = Variable(results.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('SessionActivitiesCompanion(') + ..write('id: $id, ') + ..write('sessionId: $sessionId, ') + ..write('activityId: $activityId, ') + ..write('position: $position, ') + ..write('results: $results, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class Actions extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + Actions(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 64), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn description = GeneratedColumn( + 'body', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn totalSets = GeneratedColumn( + 'total_sets', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn totalReps = GeneratedColumn( + 'total_reps', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 1, maxTextLength: 32), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn restBeforeSets = GeneratedColumn( + 'rest_before_sets', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn restBetweenSets = GeneratedColumn( + 'rest_between_sets', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn restBetweenReps = GeneratedColumn( + 'rest_between_reps', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn restAfterSets = GeneratedColumn( + 'rest_after_sets', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn repType = GeneratedColumn( + 'rep_type', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn repLength = GeneratedColumn( + 'rep_length', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn repWeights = GeneratedColumn( + 'rep_weights', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn setWeights = GeneratedColumn( + 'set_weights', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn isAlternating = GeneratedColumn( + 'is_alternating', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("is_alternating" IN (0, 1))'), + defaultValue: Variable(false)); + late final GeneratedColumn tempo = GeneratedColumn( + 'tempo', aliasedName, true, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 6, maxTextLength: 36), + type: DriftSqlType.string, + requiredDuringInsert: false); + late final GeneratedColumn status = GeneratedColumn( + 'status', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn set = GeneratedColumn( + 'set', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => [ + id, + title, + description, + totalSets, + totalReps, + restBeforeSets, + restBetweenSets, + restBetweenReps, + restAfterSets, + repType, + repLength, + repWeights, + setWeights, + isAlternating, + tempo, + status, + set, + createdAt + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'actions'; + @override + Set get $primaryKey => {id}; + @override + ActionsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ActionsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + description: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body'])!, + totalSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}total_sets'])!, + totalReps: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}total_reps'])!, + restBeforeSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_before_sets']), + restBetweenSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_between_sets']), + restBetweenReps: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_between_reps']), + restAfterSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_after_sets']), + repType: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}rep_type'])!, + repLength: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rep_length']), + repWeights: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}rep_weights']), + setWeights: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}set_weights']), + isAlternating: attachedDatabase.typeMapping + .read(DriftSqlType.bool, data['${effectivePrefix}is_alternating'])!, + tempo: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}tempo']), + status: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}status'])!, + set: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}set'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + Actions createAlias(String alias) { + return Actions(attachedDatabase, alias); + } +} + +class ActionsData extends DataClass implements Insertable { + final int id; + final String title; + final String description; + final int totalSets; + final String totalReps; + final int? restBeforeSets; + final int? restBetweenSets; + final int? restBetweenReps; + final int? restAfterSets; + final String repType; + final int? repLength; + final String? repWeights; + final String? setWeights; + final bool isAlternating; + final String? tempo; + final String status; + final String set; + final DateTime createdAt; + const ActionsData( + {required this.id, + required this.title, + required this.description, + required this.totalSets, + required this.totalReps, + this.restBeforeSets, + this.restBetweenSets, + this.restBetweenReps, + this.restAfterSets, + required this.repType, + this.repLength, + this.repWeights, + this.setWeights, + required this.isAlternating, + this.tempo, + required this.status, + required this.set, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + map['body'] = Variable(description); + map['total_sets'] = Variable(totalSets); + map['total_reps'] = Variable(totalReps); + if (!nullToAbsent || restBeforeSets != null) { + map['rest_before_sets'] = Variable(restBeforeSets); + } + if (!nullToAbsent || restBetweenSets != null) { + map['rest_between_sets'] = Variable(restBetweenSets); + } + if (!nullToAbsent || restBetweenReps != null) { + map['rest_between_reps'] = Variable(restBetweenReps); + } + if (!nullToAbsent || restAfterSets != null) { + map['rest_after_sets'] = Variable(restAfterSets); + } + map['rep_type'] = Variable(repType); + if (!nullToAbsent || repLength != null) { + map['rep_length'] = Variable(repLength); + } + if (!nullToAbsent || repWeights != null) { + map['rep_weights'] = Variable(repWeights); + } + if (!nullToAbsent || setWeights != null) { + map['set_weights'] = Variable(setWeights); + } + map['is_alternating'] = Variable(isAlternating); + if (!nullToAbsent || tempo != null) { + map['tempo'] = Variable(tempo); + } + map['status'] = Variable(status); + map['set'] = Variable(set); + map['created_at'] = Variable(createdAt); + return map; + } + + ActionsCompanion toCompanion(bool nullToAbsent) { + return ActionsCompanion( + id: Value(id), + title: Value(title), + description: Value(description), + totalSets: Value(totalSets), + totalReps: Value(totalReps), + restBeforeSets: restBeforeSets == null && nullToAbsent + ? const Value.absent() + : Value(restBeforeSets), + restBetweenSets: restBetweenSets == null && nullToAbsent + ? const Value.absent() + : Value(restBetweenSets), + restBetweenReps: restBetweenReps == null && nullToAbsent + ? const Value.absent() + : Value(restBetweenReps), + restAfterSets: restAfterSets == null && nullToAbsent + ? const Value.absent() + : Value(restAfterSets), + repType: Value(repType), + repLength: repLength == null && nullToAbsent + ? const Value.absent() + : Value(repLength), + repWeights: repWeights == null && nullToAbsent + ? const Value.absent() + : Value(repWeights), + setWeights: setWeights == null && nullToAbsent + ? const Value.absent() + : Value(setWeights), + isAlternating: Value(isAlternating), + tempo: + tempo == null && nullToAbsent ? const Value.absent() : Value(tempo), + status: Value(status), + set: Value(set), + createdAt: Value(createdAt), + ); + } + + factory ActionsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ActionsData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + description: serializer.fromJson(json['description']), + totalSets: serializer.fromJson(json['totalSets']), + totalReps: serializer.fromJson(json['totalReps']), + restBeforeSets: serializer.fromJson(json['restBeforeSets']), + restBetweenSets: serializer.fromJson(json['restBetweenSets']), + restBetweenReps: serializer.fromJson(json['restBetweenReps']), + restAfterSets: serializer.fromJson(json['restAfterSets']), + repType: serializer.fromJson(json['repType']), + repLength: serializer.fromJson(json['repLength']), + repWeights: serializer.fromJson(json['repWeights']), + setWeights: serializer.fromJson(json['setWeights']), + isAlternating: serializer.fromJson(json['isAlternating']), + tempo: serializer.fromJson(json['tempo']), + status: serializer.fromJson(json['status']), + set: serializer.fromJson(json['set']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'description': serializer.toJson(description), + 'totalSets': serializer.toJson(totalSets), + 'totalReps': serializer.toJson(totalReps), + 'restBeforeSets': serializer.toJson(restBeforeSets), + 'restBetweenSets': serializer.toJson(restBetweenSets), + 'restBetweenReps': serializer.toJson(restBetweenReps), + 'restAfterSets': serializer.toJson(restAfterSets), + 'repType': serializer.toJson(repType), + 'repLength': serializer.toJson(repLength), + 'repWeights': serializer.toJson(repWeights), + 'setWeights': serializer.toJson(setWeights), + 'isAlternating': serializer.toJson(isAlternating), + 'tempo': serializer.toJson(tempo), + 'status': serializer.toJson(status), + 'set': serializer.toJson(set), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ActionsData copyWith( + {int? id, + String? title, + String? description, + int? totalSets, + String? totalReps, + Value restBeforeSets = const Value.absent(), + Value restBetweenSets = const Value.absent(), + Value restBetweenReps = const Value.absent(), + Value restAfterSets = const Value.absent(), + String? repType, + Value repLength = const Value.absent(), + Value repWeights = const Value.absent(), + Value setWeights = const Value.absent(), + bool? isAlternating, + Value tempo = const Value.absent(), + String? status, + String? set, + DateTime? createdAt}) => + ActionsData( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + totalSets: totalSets ?? this.totalSets, + totalReps: totalReps ?? this.totalReps, + restBeforeSets: + restBeforeSets.present ? restBeforeSets.value : this.restBeforeSets, + restBetweenSets: restBetweenSets.present + ? restBetweenSets.value + : this.restBetweenSets, + restBetweenReps: restBetweenReps.present + ? restBetweenReps.value + : this.restBetweenReps, + restAfterSets: + restAfterSets.present ? restAfterSets.value : this.restAfterSets, + repType: repType ?? this.repType, + repLength: repLength.present ? repLength.value : this.repLength, + repWeights: repWeights.present ? repWeights.value : this.repWeights, + setWeights: setWeights.present ? setWeights.value : this.setWeights, + isAlternating: isAlternating ?? this.isAlternating, + tempo: tempo.present ? tempo.value : this.tempo, + status: status ?? this.status, + set: set ?? this.set, + createdAt: createdAt ?? this.createdAt, + ); + ActionsData copyWithCompanion(ActionsCompanion data) { + return ActionsData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + description: + data.description.present ? data.description.value : this.description, + totalSets: data.totalSets.present ? data.totalSets.value : this.totalSets, + totalReps: data.totalReps.present ? data.totalReps.value : this.totalReps, + restBeforeSets: data.restBeforeSets.present + ? data.restBeforeSets.value + : this.restBeforeSets, + restBetweenSets: data.restBetweenSets.present + ? data.restBetweenSets.value + : this.restBetweenSets, + restBetweenReps: data.restBetweenReps.present + ? data.restBetweenReps.value + : this.restBetweenReps, + restAfterSets: data.restAfterSets.present + ? data.restAfterSets.value + : this.restAfterSets, + repType: data.repType.present ? data.repType.value : this.repType, + repLength: data.repLength.present ? data.repLength.value : this.repLength, + repWeights: + data.repWeights.present ? data.repWeights.value : this.repWeights, + setWeights: + data.setWeights.present ? data.setWeights.value : this.setWeights, + isAlternating: data.isAlternating.present + ? data.isAlternating.value + : this.isAlternating, + tempo: data.tempo.present ? data.tempo.value : this.tempo, + status: data.status.present ? data.status.value : this.status, + set: data.set.present ? data.set.value : this.set, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ActionsData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('totalSets: $totalSets, ') + ..write('totalReps: $totalReps, ') + ..write('restBeforeSets: $restBeforeSets, ') + ..write('restBetweenSets: $restBetweenSets, ') + ..write('restBetweenReps: $restBetweenReps, ') + ..write('restAfterSets: $restAfterSets, ') + ..write('repType: $repType, ') + ..write('repLength: $repLength, ') + ..write('repWeights: $repWeights, ') + ..write('setWeights: $setWeights, ') + ..write('isAlternating: $isAlternating, ') + ..write('tempo: $tempo, ') + ..write('status: $status, ') + ..write('set: $set, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash( + id, + title, + description, + totalSets, + totalReps, + restBeforeSets, + restBetweenSets, + restBetweenReps, + restAfterSets, + repType, + repLength, + repWeights, + setWeights, + isAlternating, + tempo, + status, + set, + createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ActionsData && + other.id == this.id && + other.title == this.title && + other.description == this.description && + other.totalSets == this.totalSets && + other.totalReps == this.totalReps && + other.restBeforeSets == this.restBeforeSets && + other.restBetweenSets == this.restBetweenSets && + other.restBetweenReps == this.restBetweenReps && + other.restAfterSets == this.restAfterSets && + other.repType == this.repType && + other.repLength == this.repLength && + other.repWeights == this.repWeights && + other.setWeights == this.setWeights && + other.isAlternating == this.isAlternating && + other.tempo == this.tempo && + other.status == this.status && + other.set == this.set && + other.createdAt == this.createdAt); +} + +class ActionsCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value description; + final Value totalSets; + final Value totalReps; + final Value restBeforeSets; + final Value restBetweenSets; + final Value restBetweenReps; + final Value restAfterSets; + final Value repType; + final Value repLength; + final Value repWeights; + final Value setWeights; + final Value isAlternating; + final Value tempo; + final Value status; + final Value set; + final Value createdAt; + const ActionsCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.description = const Value.absent(), + this.totalSets = const Value.absent(), + this.totalReps = const Value.absent(), + this.restBeforeSets = const Value.absent(), + this.restBetweenSets = const Value.absent(), + this.restBetweenReps = const Value.absent(), + this.restAfterSets = const Value.absent(), + this.repType = const Value.absent(), + this.repLength = const Value.absent(), + this.repWeights = const Value.absent(), + this.setWeights = const Value.absent(), + this.isAlternating = const Value.absent(), + this.tempo = const Value.absent(), + this.status = const Value.absent(), + this.set = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ActionsCompanion.insert({ + this.id = const Value.absent(), + required String title, + required String description, + required int totalSets, + required String totalReps, + this.restBeforeSets = const Value.absent(), + this.restBetweenSets = const Value.absent(), + this.restBetweenReps = const Value.absent(), + this.restAfterSets = const Value.absent(), + required String repType, + this.repLength = const Value.absent(), + this.repWeights = const Value.absent(), + this.setWeights = const Value.absent(), + this.isAlternating = const Value.absent(), + this.tempo = const Value.absent(), + required String status, + required String set, + this.createdAt = const Value.absent(), + }) : title = Value(title), + description = Value(description), + totalSets = Value(totalSets), + totalReps = Value(totalReps), + repType = Value(repType), + status = Value(status), + set = Value(set); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? description, + Expression? totalSets, + Expression? totalReps, + Expression? restBeforeSets, + Expression? restBetweenSets, + Expression? restBetweenReps, + Expression? restAfterSets, + Expression? repType, + Expression? repLength, + Expression? repWeights, + Expression? setWeights, + Expression? isAlternating, + Expression? tempo, + Expression? status, + Expression? set, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (description != null) 'body': description, + if (totalSets != null) 'total_sets': totalSets, + if (totalReps != null) 'total_reps': totalReps, + if (restBeforeSets != null) 'rest_before_sets': restBeforeSets, + if (restBetweenSets != null) 'rest_between_sets': restBetweenSets, + if (restBetweenReps != null) 'rest_between_reps': restBetweenReps, + if (restAfterSets != null) 'rest_after_sets': restAfterSets, + if (repType != null) 'rep_type': repType, + if (repLength != null) 'rep_length': repLength, + if (repWeights != null) 'rep_weights': repWeights, + if (setWeights != null) 'set_weights': setWeights, + if (isAlternating != null) 'is_alternating': isAlternating, + if (tempo != null) 'tempo': tempo, + if (status != null) 'status': status, + if (set != null) 'set': set, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ActionsCompanion copyWith( + {Value? id, + Value? title, + Value? description, + Value? totalSets, + Value? totalReps, + Value? restBeforeSets, + Value? restBetweenSets, + Value? restBetweenReps, + Value? restAfterSets, + Value? repType, + Value? repLength, + Value? repWeights, + Value? setWeights, + Value? isAlternating, + Value? tempo, + Value? status, + Value? set, + Value? createdAt}) { + return ActionsCompanion( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + totalSets: totalSets ?? this.totalSets, + totalReps: totalReps ?? this.totalReps, + restBeforeSets: restBeforeSets ?? this.restBeforeSets, + restBetweenSets: restBetweenSets ?? this.restBetweenSets, + restBetweenReps: restBetweenReps ?? this.restBetweenReps, + restAfterSets: restAfterSets ?? this.restAfterSets, + repType: repType ?? this.repType, + repLength: repLength ?? this.repLength, + repWeights: repWeights ?? this.repWeights, + setWeights: setWeights ?? this.setWeights, + isAlternating: isAlternating ?? this.isAlternating, + tempo: tempo ?? this.tempo, + status: status ?? this.status, + set: set ?? this.set, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (description.present) { + map['body'] = Variable(description.value); + } + if (totalSets.present) { + map['total_sets'] = Variable(totalSets.value); + } + if (totalReps.present) { + map['total_reps'] = Variable(totalReps.value); + } + if (restBeforeSets.present) { + map['rest_before_sets'] = Variable(restBeforeSets.value); + } + if (restBetweenSets.present) { + map['rest_between_sets'] = Variable(restBetweenSets.value); + } + if (restBetweenReps.present) { + map['rest_between_reps'] = Variable(restBetweenReps.value); + } + if (restAfterSets.present) { + map['rest_after_sets'] = Variable(restAfterSets.value); + } + if (repType.present) { + map['rep_type'] = Variable(repType.value); + } + if (repLength.present) { + map['rep_length'] = Variable(repLength.value); + } + if (repWeights.present) { + map['rep_weights'] = Variable(repWeights.value); + } + if (setWeights.present) { + map['set_weights'] = Variable(setWeights.value); + } + if (isAlternating.present) { + map['is_alternating'] = Variable(isAlternating.value); + } + if (tempo.present) { + map['tempo'] = Variable(tempo.value); + } + if (status.present) { + map['status'] = Variable(status.value); + } + if (set.present) { + map['set'] = Variable(set.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ActionsCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('totalSets: $totalSets, ') + ..write('totalReps: $totalReps, ') + ..write('restBeforeSets: $restBeforeSets, ') + ..write('restBetweenSets: $restBetweenSets, ') + ..write('restBetweenReps: $restBetweenReps, ') + ..write('restAfterSets: $restAfterSets, ') + ..write('repType: $repType, ') + ..write('repLength: $repLength, ') + ..write('repWeights: $repWeights, ') + ..write('setWeights: $setWeights, ') + ..write('isAlternating: $isAlternating, ') + ..write('tempo: $tempo, ') + ..write('status: $status, ') + ..write('set: $set, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class ActivityActions extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + ActivityActions(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn activityId = GeneratedColumn( + 'activity_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES activities (id) ON DELETE CASCADE')); + late final GeneratedColumn actionId = GeneratedColumn( + 'action_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES actions (id) ON DELETE CASCADE')); + late final GeneratedColumn position = GeneratedColumn( + 'position', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, activityId, actionId, position, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'activity_actions'; + @override + Set get $primaryKey => {id}; + @override + ActivityActionsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ActivityActionsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + activityId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}activity_id'])!, + actionId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}action_id'])!, + position: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}position'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + ActivityActions createAlias(String alias) { + return ActivityActions(attachedDatabase, alias); + } +} + +class ActivityActionsData extends DataClass + implements Insertable { + final int id; + final int activityId; + final int actionId; + final int position; + final DateTime createdAt; + const ActivityActionsData( + {required this.id, + required this.activityId, + required this.actionId, + required this.position, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['activity_id'] = Variable(activityId); + map['action_id'] = Variable(actionId); + map['position'] = Variable(position); + map['created_at'] = Variable(createdAt); + return map; + } + + ActivityActionsCompanion toCompanion(bool nullToAbsent) { + return ActivityActionsCompanion( + id: Value(id), + activityId: Value(activityId), + actionId: Value(actionId), + position: Value(position), + createdAt: Value(createdAt), + ); + } + + factory ActivityActionsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ActivityActionsData( + id: serializer.fromJson(json['id']), + activityId: serializer.fromJson(json['activityId']), + actionId: serializer.fromJson(json['actionId']), + position: serializer.fromJson(json['position']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'activityId': serializer.toJson(activityId), + 'actionId': serializer.toJson(actionId), + 'position': serializer.toJson(position), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ActivityActionsData copyWith( + {int? id, + int? activityId, + int? actionId, + int? position, + DateTime? createdAt}) => + ActivityActionsData( + id: id ?? this.id, + activityId: activityId ?? this.activityId, + actionId: actionId ?? this.actionId, + position: position ?? this.position, + createdAt: createdAt ?? this.createdAt, + ); + ActivityActionsData copyWithCompanion(ActivityActionsCompanion data) { + return ActivityActionsData( + id: data.id.present ? data.id.value : this.id, + activityId: + data.activityId.present ? data.activityId.value : this.activityId, + actionId: data.actionId.present ? data.actionId.value : this.actionId, + position: data.position.present ? data.position.value : this.position, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ActivityActionsData(') + ..write('id: $id, ') + ..write('activityId: $activityId, ') + ..write('actionId: $actionId, ') + ..write('position: $position, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(id, activityId, actionId, position, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ActivityActionsData && + other.id == this.id && + other.activityId == this.activityId && + other.actionId == this.actionId && + other.position == this.position && + other.createdAt == this.createdAt); +} + +class ActivityActionsCompanion extends UpdateCompanion { + final Value id; + final Value activityId; + final Value actionId; + final Value position; + final Value createdAt; + const ActivityActionsCompanion({ + this.id = const Value.absent(), + this.activityId = const Value.absent(), + this.actionId = const Value.absent(), + this.position = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ActivityActionsCompanion.insert({ + this.id = const Value.absent(), + required int activityId, + required int actionId, + required int position, + this.createdAt = const Value.absent(), + }) : activityId = Value(activityId), + actionId = Value(actionId), + position = Value(position); + static Insertable custom({ + Expression? id, + Expression? activityId, + Expression? actionId, + Expression? position, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (activityId != null) 'activity_id': activityId, + if (actionId != null) 'action_id': actionId, + if (position != null) 'position': position, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ActivityActionsCompanion copyWith( + {Value? id, + Value? activityId, + Value? actionId, + Value? position, + Value? createdAt}) { + return ActivityActionsCompanion( + id: id ?? this.id, + activityId: activityId ?? this.activityId, + actionId: actionId ?? this.actionId, + position: position ?? this.position, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (activityId.present) { + map['activity_id'] = Variable(activityId.value); + } + if (actionId.present) { + map['action_id'] = Variable(actionId.value); + } + if (position.present) { + map['position'] = Variable(position.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ActivityActionsCompanion(') + ..write('id: $id, ') + ..write('activityId: $activityId, ') + ..write('actionId: $actionId, ') + ..write('position: $position, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class MediaItems extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + MediaItems(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 64), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn description = GeneratedColumn( + 'body', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn reference = GeneratedColumn( + 'reference', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn type = GeneratedColumn( + 'type', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, title, description, reference, type, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'media_items'; + @override + Set get $primaryKey => {id}; + @override + MediaItemsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return MediaItemsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + description: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body'])!, + reference: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}reference'])!, + type: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}type'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + MediaItems createAlias(String alias) { + return MediaItems(attachedDatabase, alias); + } +} + +class MediaItemsData extends DataClass implements Insertable { + final int id; + final String title; + final String description; + final String reference; + final String type; + final DateTime createdAt; + const MediaItemsData( + {required this.id, + required this.title, + required this.description, + required this.reference, + required this.type, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + map['body'] = Variable(description); + map['reference'] = Variable(reference); + map['type'] = Variable(type); + map['created_at'] = Variable(createdAt); + return map; + } + + MediaItemsCompanion toCompanion(bool nullToAbsent) { + return MediaItemsCompanion( + id: Value(id), + title: Value(title), + description: Value(description), + reference: Value(reference), + type: Value(type), + createdAt: Value(createdAt), + ); + } + + factory MediaItemsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return MediaItemsData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + description: serializer.fromJson(json['description']), + reference: serializer.fromJson(json['reference']), + type: serializer.fromJson(json['type']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'description': serializer.toJson(description), + 'reference': serializer.toJson(reference), + 'type': serializer.toJson(type), + 'createdAt': serializer.toJson(createdAt), + }; + } + + MediaItemsData copyWith( + {int? id, + String? title, + String? description, + String? reference, + String? type, + DateTime? createdAt}) => + MediaItemsData( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + reference: reference ?? this.reference, + type: type ?? this.type, + createdAt: createdAt ?? this.createdAt, + ); + MediaItemsData copyWithCompanion(MediaItemsCompanion data) { + return MediaItemsData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + description: + data.description.present ? data.description.value : this.description, + reference: data.reference.present ? data.reference.value : this.reference, + type: data.type.present ? data.type.value : this.type, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('MediaItemsData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('reference: $reference, ') + ..write('type: $type, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(id, title, description, reference, type, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is MediaItemsData && + other.id == this.id && + other.title == this.title && + other.description == this.description && + other.reference == this.reference && + other.type == this.type && + other.createdAt == this.createdAt); +} + +class MediaItemsCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value description; + final Value reference; + final Value type; + final Value createdAt; + const MediaItemsCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.description = const Value.absent(), + this.reference = const Value.absent(), + this.type = const Value.absent(), + this.createdAt = const Value.absent(), + }); + MediaItemsCompanion.insert({ + this.id = const Value.absent(), + required String title, + required String description, + required String reference, + required String type, + this.createdAt = const Value.absent(), + }) : title = Value(title), + description = Value(description), + reference = Value(reference), + type = Value(type); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? description, + Expression? reference, + Expression? type, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (description != null) 'body': description, + if (reference != null) 'reference': reference, + if (type != null) 'type': type, + if (createdAt != null) 'created_at': createdAt, + }); + } + + MediaItemsCompanion copyWith( + {Value? id, + Value? title, + Value? description, + Value? reference, + Value? type, + Value? createdAt}) { + return MediaItemsCompanion( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + reference: reference ?? this.reference, + type: type ?? this.type, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (description.present) { + map['body'] = Variable(description.value); + } + if (reference.present) { + map['reference'] = Variable(reference.value); + } + if (type.present) { + map['type'] = Variable(type.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('MediaItemsCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('reference: $reference, ') + ..write('type: $type, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class ObjectMediaItems extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + ObjectMediaItems(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn objectId = GeneratedColumn( + 'object_id', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn objectType = GeneratedColumn( + 'object_type', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn mediaId = GeneratedColumn( + 'media_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES media_items (id) ON DELETE CASCADE')); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, objectId, objectType, mediaId, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'object_media_items'; + @override + Set get $primaryKey => {id}; + @override + ObjectMediaItemsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ObjectMediaItemsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + objectId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}object_id'])!, + objectType: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}object_type'])!, + mediaId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}media_id'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + ObjectMediaItems createAlias(String alias) { + return ObjectMediaItems(attachedDatabase, alias); + } +} + +class ObjectMediaItemsData extends DataClass + implements Insertable { + final int id; + final int objectId; + final String objectType; + final int mediaId; + final DateTime createdAt; + const ObjectMediaItemsData( + {required this.id, + required this.objectId, + required this.objectType, + required this.mediaId, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['object_id'] = Variable(objectId); + map['object_type'] = Variable(objectType); + map['media_id'] = Variable(mediaId); + map['created_at'] = Variable(createdAt); + return map; + } + + ObjectMediaItemsCompanion toCompanion(bool nullToAbsent) { + return ObjectMediaItemsCompanion( + id: Value(id), + objectId: Value(objectId), + objectType: Value(objectType), + mediaId: Value(mediaId), + createdAt: Value(createdAt), + ); + } + + factory ObjectMediaItemsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ObjectMediaItemsData( + id: serializer.fromJson(json['id']), + objectId: serializer.fromJson(json['objectId']), + objectType: serializer.fromJson(json['objectType']), + mediaId: serializer.fromJson(json['mediaId']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'objectId': serializer.toJson(objectId), + 'objectType': serializer.toJson(objectType), + 'mediaId': serializer.toJson(mediaId), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ObjectMediaItemsData copyWith( + {int? id, + int? objectId, + String? objectType, + int? mediaId, + DateTime? createdAt}) => + ObjectMediaItemsData( + id: id ?? this.id, + objectId: objectId ?? this.objectId, + objectType: objectType ?? this.objectType, + mediaId: mediaId ?? this.mediaId, + createdAt: createdAt ?? this.createdAt, + ); + ObjectMediaItemsData copyWithCompanion(ObjectMediaItemsCompanion data) { + return ObjectMediaItemsData( + id: data.id.present ? data.id.value : this.id, + objectId: data.objectId.present ? data.objectId.value : this.objectId, + objectType: + data.objectType.present ? data.objectType.value : this.objectType, + mediaId: data.mediaId.present ? data.mediaId.value : this.mediaId, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ObjectMediaItemsData(') + ..write('id: $id, ') + ..write('objectId: $objectId, ') + ..write('objectType: $objectType, ') + ..write('mediaId: $mediaId, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(id, objectId, objectType, mediaId, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ObjectMediaItemsData && + other.id == this.id && + other.objectId == this.objectId && + other.objectType == this.objectType && + other.mediaId == this.mediaId && + other.createdAt == this.createdAt); +} + +class ObjectMediaItemsCompanion extends UpdateCompanion { + final Value id; + final Value objectId; + final Value objectType; + final Value mediaId; + final Value createdAt; + const ObjectMediaItemsCompanion({ + this.id = const Value.absent(), + this.objectId = const Value.absent(), + this.objectType = const Value.absent(), + this.mediaId = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ObjectMediaItemsCompanion.insert({ + this.id = const Value.absent(), + required int objectId, + required String objectType, + required int mediaId, + this.createdAt = const Value.absent(), + }) : objectId = Value(objectId), + objectType = Value(objectType), + mediaId = Value(mediaId); + static Insertable custom({ + Expression? id, + Expression? objectId, + Expression? objectType, + Expression? mediaId, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (objectId != null) 'object_id': objectId, + if (objectType != null) 'object_type': objectType, + if (mediaId != null) 'media_id': mediaId, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ObjectMediaItemsCompanion copyWith( + {Value? id, + Value? objectId, + Value? objectType, + Value? mediaId, + Value? createdAt}) { + return ObjectMediaItemsCompanion( + id: id ?? this.id, + objectId: objectId ?? this.objectId, + objectType: objectType ?? this.objectType, + mediaId: mediaId ?? this.mediaId, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (objectId.present) { + map['object_id'] = Variable(objectId.value); + } + if (objectType.present) { + map['object_type'] = Variable(objectType.value); + } + if (mediaId.present) { + map['media_id'] = Variable(mediaId.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ObjectMediaItemsCompanion(') + ..write('id: $id, ') + ..write('objectId: $objectId, ') + ..write('objectType: $objectType, ') + ..write('mediaId: $mediaId, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class DatabaseAtV23 extends GeneratedDatabase { + DatabaseAtV23(QueryExecutor e) : super(e); + late final Sessions sessions = Sessions(this); + late final Activities activities = Activities(this); + late final SessionActivities sessionActivities = SessionActivities(this); + late final Actions actions = Actions(this); + late final ActivityActions activityActions = ActivityActions(this); + late final MediaItems mediaItems = MediaItems(this); + late final ObjectMediaItems objectMediaItems = ObjectMediaItems(this); + @override + Iterable> get allTables => + allSchemaEntities.whereType>(); + @override + List get allSchemaEntities => [ + sessions, + activities, + sessionActivities, + actions, + activityActions, + mediaItems, + objectMediaItems + ]; + @override + int get schemaVersion => 23; +} diff --git a/test/drift/sendtrain/generated/schema_v24.dart b/test/drift/sendtrain/generated/schema_v24.dart new file mode 100644 index 0000000..843fcf6 --- /dev/null +++ b/test/drift/sendtrain/generated/schema_v24.dart @@ -0,0 +1,2670 @@ +// dart format width=80 +// GENERATED CODE, DO NOT EDIT BY HAND. +// ignore_for_file: type=lint +import 'package:drift/drift.dart'; + +class Sessions extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + Sessions(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 32), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn content = GeneratedColumn( + 'body', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn status = GeneratedColumn( + 'status', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn achievements = GeneratedColumn( + 'achievements', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn address = GeneratedColumn( + 'address', aliasedName, true, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 256), + type: DriftSqlType.string, + requiredDuringInsert: false); + late final GeneratedColumn date = GeneratedColumn( + 'date', aliasedName, true, + type: DriftSqlType.dateTime, requiredDuringInsert: false); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, title, content, status, achievements, address, date, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'sessions'; + @override + Set get $primaryKey => {id}; + @override + SessionsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return SessionsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + content: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body'])!, + status: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}status'])!, + achievements: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}achievements']), + address: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}address']), + date: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}date']), + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + Sessions createAlias(String alias) { + return Sessions(attachedDatabase, alias); + } +} + +class SessionsData extends DataClass implements Insertable { + final int id; + final String title; + final String content; + final String status; + final String? achievements; + final String? address; + final DateTime? date; + final DateTime createdAt; + const SessionsData( + {required this.id, + required this.title, + required this.content, + required this.status, + this.achievements, + this.address, + this.date, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + map['body'] = Variable(content); + map['status'] = Variable(status); + if (!nullToAbsent || achievements != null) { + map['achievements'] = Variable(achievements); + } + if (!nullToAbsent || address != null) { + map['address'] = Variable(address); + } + if (!nullToAbsent || date != null) { + map['date'] = Variable(date); + } + map['created_at'] = Variable(createdAt); + return map; + } + + SessionsCompanion toCompanion(bool nullToAbsent) { + return SessionsCompanion( + id: Value(id), + title: Value(title), + content: Value(content), + status: Value(status), + achievements: achievements == null && nullToAbsent + ? const Value.absent() + : Value(achievements), + address: address == null && nullToAbsent + ? const Value.absent() + : Value(address), + date: date == null && nullToAbsent ? const Value.absent() : Value(date), + createdAt: Value(createdAt), + ); + } + + factory SessionsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return SessionsData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + content: serializer.fromJson(json['content']), + status: serializer.fromJson(json['status']), + achievements: serializer.fromJson(json['achievements']), + address: serializer.fromJson(json['address']), + date: serializer.fromJson(json['date']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'content': serializer.toJson(content), + 'status': serializer.toJson(status), + 'achievements': serializer.toJson(achievements), + 'address': serializer.toJson(address), + 'date': serializer.toJson(date), + 'createdAt': serializer.toJson(createdAt), + }; + } + + SessionsData copyWith( + {int? id, + String? title, + String? content, + String? status, + Value achievements = const Value.absent(), + Value address = const Value.absent(), + Value date = const Value.absent(), + DateTime? createdAt}) => + SessionsData( + id: id ?? this.id, + title: title ?? this.title, + content: content ?? this.content, + status: status ?? this.status, + achievements: + achievements.present ? achievements.value : this.achievements, + address: address.present ? address.value : this.address, + date: date.present ? date.value : this.date, + createdAt: createdAt ?? this.createdAt, + ); + SessionsData copyWithCompanion(SessionsCompanion data) { + return SessionsData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + content: data.content.present ? data.content.value : this.content, + status: data.status.present ? data.status.value : this.status, + achievements: data.achievements.present + ? data.achievements.value + : this.achievements, + address: data.address.present ? data.address.value : this.address, + date: data.date.present ? data.date.value : this.date, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('SessionsData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('content: $content, ') + ..write('status: $status, ') + ..write('achievements: $achievements, ') + ..write('address: $address, ') + ..write('date: $date, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash( + id, title, content, status, achievements, address, date, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is SessionsData && + other.id == this.id && + other.title == this.title && + other.content == this.content && + other.status == this.status && + other.achievements == this.achievements && + other.address == this.address && + other.date == this.date && + other.createdAt == this.createdAt); +} + +class SessionsCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value content; + final Value status; + final Value achievements; + final Value address; + final Value date; + final Value createdAt; + const SessionsCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.content = const Value.absent(), + this.status = const Value.absent(), + this.achievements = const Value.absent(), + this.address = const Value.absent(), + this.date = const Value.absent(), + this.createdAt = const Value.absent(), + }); + SessionsCompanion.insert({ + this.id = const Value.absent(), + required String title, + required String content, + required String status, + this.achievements = const Value.absent(), + this.address = const Value.absent(), + this.date = const Value.absent(), + this.createdAt = const Value.absent(), + }) : title = Value(title), + content = Value(content), + status = Value(status); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? content, + Expression? status, + Expression? achievements, + Expression? address, + Expression? date, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (content != null) 'body': content, + if (status != null) 'status': status, + if (achievements != null) 'achievements': achievements, + if (address != null) 'address': address, + if (date != null) 'date': date, + if (createdAt != null) 'created_at': createdAt, + }); + } + + SessionsCompanion copyWith( + {Value? id, + Value? title, + Value? content, + Value? status, + Value? achievements, + Value? address, + Value? date, + Value? createdAt}) { + return SessionsCompanion( + id: id ?? this.id, + title: title ?? this.title, + content: content ?? this.content, + status: status ?? this.status, + achievements: achievements ?? this.achievements, + address: address ?? this.address, + date: date ?? this.date, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (content.present) { + map['body'] = Variable(content.value); + } + if (status.present) { + map['status'] = Variable(status.value); + } + if (achievements.present) { + map['achievements'] = Variable(achievements.value); + } + if (address.present) { + map['address'] = Variable(address.value); + } + if (date.present) { + map['date'] = Variable(date.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('SessionsCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('content: $content, ') + ..write('status: $status, ') + ..write('achievements: $achievements, ') + ..write('address: $address, ') + ..write('date: $date, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class Activities extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + Activities(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 100), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn type = GeneratedColumn( + 'type', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn description = GeneratedColumn( + 'body', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn category = GeneratedColumn( + 'category', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn force = GeneratedColumn( + 'force', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn level = GeneratedColumn( + 'level', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn mechanic = GeneratedColumn( + 'mechanic', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn equipment = GeneratedColumn( + 'equipment', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn primaryMuscles = GeneratedColumn( + 'primary_muscles', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn secondaryMuscles = GeneratedColumn( + 'secondary_muscles', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => [ + id, + title, + type, + description, + category, + force, + level, + mechanic, + equipment, + primaryMuscles, + secondaryMuscles, + createdAt + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'activities'; + @override + Set get $primaryKey => {id}; + @override + ActivitiesData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ActivitiesData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + type: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}type']), + description: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body']), + category: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}category']), + force: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}force']), + level: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}level']), + mechanic: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}mechanic']), + equipment: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}equipment']), + primaryMuscles: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}primary_muscles']), + secondaryMuscles: attachedDatabase.typeMapping.read( + DriftSqlType.string, data['${effectivePrefix}secondary_muscles']), + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + Activities createAlias(String alias) { + return Activities(attachedDatabase, alias); + } +} + +class ActivitiesData extends DataClass implements Insertable { + final int id; + final String title; + final String? type; + final String? description; + final String? category; + final String? force; + final String? level; + final String? mechanic; + final String? equipment; + final String? primaryMuscles; + final String? secondaryMuscles; + final DateTime createdAt; + const ActivitiesData( + {required this.id, + required this.title, + this.type, + this.description, + this.category, + this.force, + this.level, + this.mechanic, + this.equipment, + this.primaryMuscles, + this.secondaryMuscles, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + if (!nullToAbsent || type != null) { + map['type'] = Variable(type); + } + if (!nullToAbsent || description != null) { + map['body'] = Variable(description); + } + if (!nullToAbsent || category != null) { + map['category'] = Variable(category); + } + if (!nullToAbsent || force != null) { + map['force'] = Variable(force); + } + if (!nullToAbsent || level != null) { + map['level'] = Variable(level); + } + if (!nullToAbsent || mechanic != null) { + map['mechanic'] = Variable(mechanic); + } + if (!nullToAbsent || equipment != null) { + map['equipment'] = Variable(equipment); + } + if (!nullToAbsent || primaryMuscles != null) { + map['primary_muscles'] = Variable(primaryMuscles); + } + if (!nullToAbsent || secondaryMuscles != null) { + map['secondary_muscles'] = Variable(secondaryMuscles); + } + map['created_at'] = Variable(createdAt); + return map; + } + + ActivitiesCompanion toCompanion(bool nullToAbsent) { + return ActivitiesCompanion( + id: Value(id), + title: Value(title), + type: type == null && nullToAbsent ? const Value.absent() : Value(type), + description: description == null && nullToAbsent + ? const Value.absent() + : Value(description), + category: category == null && nullToAbsent + ? const Value.absent() + : Value(category), + force: + force == null && nullToAbsent ? const Value.absent() : Value(force), + level: + level == null && nullToAbsent ? const Value.absent() : Value(level), + mechanic: mechanic == null && nullToAbsent + ? const Value.absent() + : Value(mechanic), + equipment: equipment == null && nullToAbsent + ? const Value.absent() + : Value(equipment), + primaryMuscles: primaryMuscles == null && nullToAbsent + ? const Value.absent() + : Value(primaryMuscles), + secondaryMuscles: secondaryMuscles == null && nullToAbsent + ? const Value.absent() + : Value(secondaryMuscles), + createdAt: Value(createdAt), + ); + } + + factory ActivitiesData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ActivitiesData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + type: serializer.fromJson(json['type']), + description: serializer.fromJson(json['description']), + category: serializer.fromJson(json['category']), + force: serializer.fromJson(json['force']), + level: serializer.fromJson(json['level']), + mechanic: serializer.fromJson(json['mechanic']), + equipment: serializer.fromJson(json['equipment']), + primaryMuscles: serializer.fromJson(json['primaryMuscles']), + secondaryMuscles: serializer.fromJson(json['secondaryMuscles']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'type': serializer.toJson(type), + 'description': serializer.toJson(description), + 'category': serializer.toJson(category), + 'force': serializer.toJson(force), + 'level': serializer.toJson(level), + 'mechanic': serializer.toJson(mechanic), + 'equipment': serializer.toJson(equipment), + 'primaryMuscles': serializer.toJson(primaryMuscles), + 'secondaryMuscles': serializer.toJson(secondaryMuscles), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ActivitiesData copyWith( + {int? id, + String? title, + Value type = const Value.absent(), + Value description = const Value.absent(), + Value category = const Value.absent(), + Value force = const Value.absent(), + Value level = const Value.absent(), + Value mechanic = const Value.absent(), + Value equipment = const Value.absent(), + Value primaryMuscles = const Value.absent(), + Value secondaryMuscles = const Value.absent(), + DateTime? createdAt}) => + ActivitiesData( + id: id ?? this.id, + title: title ?? this.title, + type: type.present ? type.value : this.type, + description: description.present ? description.value : this.description, + category: category.present ? category.value : this.category, + force: force.present ? force.value : this.force, + level: level.present ? level.value : this.level, + mechanic: mechanic.present ? mechanic.value : this.mechanic, + equipment: equipment.present ? equipment.value : this.equipment, + primaryMuscles: + primaryMuscles.present ? primaryMuscles.value : this.primaryMuscles, + secondaryMuscles: secondaryMuscles.present + ? secondaryMuscles.value + : this.secondaryMuscles, + createdAt: createdAt ?? this.createdAt, + ); + ActivitiesData copyWithCompanion(ActivitiesCompanion data) { + return ActivitiesData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + type: data.type.present ? data.type.value : this.type, + description: + data.description.present ? data.description.value : this.description, + category: data.category.present ? data.category.value : this.category, + force: data.force.present ? data.force.value : this.force, + level: data.level.present ? data.level.value : this.level, + mechanic: data.mechanic.present ? data.mechanic.value : this.mechanic, + equipment: data.equipment.present ? data.equipment.value : this.equipment, + primaryMuscles: data.primaryMuscles.present + ? data.primaryMuscles.value + : this.primaryMuscles, + secondaryMuscles: data.secondaryMuscles.present + ? data.secondaryMuscles.value + : this.secondaryMuscles, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ActivitiesData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('type: $type, ') + ..write('description: $description, ') + ..write('category: $category, ') + ..write('force: $force, ') + ..write('level: $level, ') + ..write('mechanic: $mechanic, ') + ..write('equipment: $equipment, ') + ..write('primaryMuscles: $primaryMuscles, ') + ..write('secondaryMuscles: $secondaryMuscles, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(id, title, type, description, category, force, + level, mechanic, equipment, primaryMuscles, secondaryMuscles, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ActivitiesData && + other.id == this.id && + other.title == this.title && + other.type == this.type && + other.description == this.description && + other.category == this.category && + other.force == this.force && + other.level == this.level && + other.mechanic == this.mechanic && + other.equipment == this.equipment && + other.primaryMuscles == this.primaryMuscles && + other.secondaryMuscles == this.secondaryMuscles && + other.createdAt == this.createdAt); +} + +class ActivitiesCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value type; + final Value description; + final Value category; + final Value force; + final Value level; + final Value mechanic; + final Value equipment; + final Value primaryMuscles; + final Value secondaryMuscles; + final Value createdAt; + const ActivitiesCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.type = const Value.absent(), + this.description = const Value.absent(), + this.category = const Value.absent(), + this.force = const Value.absent(), + this.level = const Value.absent(), + this.mechanic = const Value.absent(), + this.equipment = const Value.absent(), + this.primaryMuscles = const Value.absent(), + this.secondaryMuscles = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ActivitiesCompanion.insert({ + this.id = const Value.absent(), + required String title, + this.type = const Value.absent(), + this.description = const Value.absent(), + this.category = const Value.absent(), + this.force = const Value.absent(), + this.level = const Value.absent(), + this.mechanic = const Value.absent(), + this.equipment = const Value.absent(), + this.primaryMuscles = const Value.absent(), + this.secondaryMuscles = const Value.absent(), + this.createdAt = const Value.absent(), + }) : title = Value(title); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? type, + Expression? description, + Expression? category, + Expression? force, + Expression? level, + Expression? mechanic, + Expression? equipment, + Expression? primaryMuscles, + Expression? secondaryMuscles, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (type != null) 'type': type, + if (description != null) 'body': description, + if (category != null) 'category': category, + if (force != null) 'force': force, + if (level != null) 'level': level, + if (mechanic != null) 'mechanic': mechanic, + if (equipment != null) 'equipment': equipment, + if (primaryMuscles != null) 'primary_muscles': primaryMuscles, + if (secondaryMuscles != null) 'secondary_muscles': secondaryMuscles, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ActivitiesCompanion copyWith( + {Value? id, + Value? title, + Value? type, + Value? description, + Value? category, + Value? force, + Value? level, + Value? mechanic, + Value? equipment, + Value? primaryMuscles, + Value? secondaryMuscles, + Value? createdAt}) { + return ActivitiesCompanion( + id: id ?? this.id, + title: title ?? this.title, + type: type ?? this.type, + description: description ?? this.description, + category: category ?? this.category, + force: force ?? this.force, + level: level ?? this.level, + mechanic: mechanic ?? this.mechanic, + equipment: equipment ?? this.equipment, + primaryMuscles: primaryMuscles ?? this.primaryMuscles, + secondaryMuscles: secondaryMuscles ?? this.secondaryMuscles, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (type.present) { + map['type'] = Variable(type.value); + } + if (description.present) { + map['body'] = Variable(description.value); + } + if (category.present) { + map['category'] = Variable(category.value); + } + if (force.present) { + map['force'] = Variable(force.value); + } + if (level.present) { + map['level'] = Variable(level.value); + } + if (mechanic.present) { + map['mechanic'] = Variable(mechanic.value); + } + if (equipment.present) { + map['equipment'] = Variable(equipment.value); + } + if (primaryMuscles.present) { + map['primary_muscles'] = Variable(primaryMuscles.value); + } + if (secondaryMuscles.present) { + map['secondary_muscles'] = Variable(secondaryMuscles.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ActivitiesCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('type: $type, ') + ..write('description: $description, ') + ..write('category: $category, ') + ..write('force: $force, ') + ..write('level: $level, ') + ..write('mechanic: $mechanic, ') + ..write('equipment: $equipment, ') + ..write('primaryMuscles: $primaryMuscles, ') + ..write('secondaryMuscles: $secondaryMuscles, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class SessionActivities extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + SessionActivities(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn sessionId = GeneratedColumn( + 'session_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES sessions (id) ON DELETE CASCADE')); + late final GeneratedColumn activityId = GeneratedColumn( + 'activity_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES activities (id) ON DELETE CASCADE')); + late final GeneratedColumn position = GeneratedColumn( + 'position', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn results = GeneratedColumn( + 'results', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, sessionId, activityId, position, results, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'session_activities'; + @override + Set get $primaryKey => {id}; + @override + SessionActivitiesData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return SessionActivitiesData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + sessionId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}session_id'])!, + activityId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}activity_id'])!, + position: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}position'])!, + results: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}results']), + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + SessionActivities createAlias(String alias) { + return SessionActivities(attachedDatabase, alias); + } +} + +class SessionActivitiesData extends DataClass + implements Insertable { + final int id; + final int sessionId; + final int activityId; + final int position; + final String? results; + final DateTime createdAt; + const SessionActivitiesData( + {required this.id, + required this.sessionId, + required this.activityId, + required this.position, + this.results, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['session_id'] = Variable(sessionId); + map['activity_id'] = Variable(activityId); + map['position'] = Variable(position); + if (!nullToAbsent || results != null) { + map['results'] = Variable(results); + } + map['created_at'] = Variable(createdAt); + return map; + } + + SessionActivitiesCompanion toCompanion(bool nullToAbsent) { + return SessionActivitiesCompanion( + id: Value(id), + sessionId: Value(sessionId), + activityId: Value(activityId), + position: Value(position), + results: results == null && nullToAbsent + ? const Value.absent() + : Value(results), + createdAt: Value(createdAt), + ); + } + + factory SessionActivitiesData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return SessionActivitiesData( + id: serializer.fromJson(json['id']), + sessionId: serializer.fromJson(json['sessionId']), + activityId: serializer.fromJson(json['activityId']), + position: serializer.fromJson(json['position']), + results: serializer.fromJson(json['results']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'sessionId': serializer.toJson(sessionId), + 'activityId': serializer.toJson(activityId), + 'position': serializer.toJson(position), + 'results': serializer.toJson(results), + 'createdAt': serializer.toJson(createdAt), + }; + } + + SessionActivitiesData copyWith( + {int? id, + int? sessionId, + int? activityId, + int? position, + Value results = const Value.absent(), + DateTime? createdAt}) => + SessionActivitiesData( + id: id ?? this.id, + sessionId: sessionId ?? this.sessionId, + activityId: activityId ?? this.activityId, + position: position ?? this.position, + results: results.present ? results.value : this.results, + createdAt: createdAt ?? this.createdAt, + ); + SessionActivitiesData copyWithCompanion(SessionActivitiesCompanion data) { + return SessionActivitiesData( + id: data.id.present ? data.id.value : this.id, + sessionId: data.sessionId.present ? data.sessionId.value : this.sessionId, + activityId: + data.activityId.present ? data.activityId.value : this.activityId, + position: data.position.present ? data.position.value : this.position, + results: data.results.present ? data.results.value : this.results, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('SessionActivitiesData(') + ..write('id: $id, ') + ..write('sessionId: $sessionId, ') + ..write('activityId: $activityId, ') + ..write('position: $position, ') + ..write('results: $results, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(id, sessionId, activityId, position, results, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is SessionActivitiesData && + other.id == this.id && + other.sessionId == this.sessionId && + other.activityId == this.activityId && + other.position == this.position && + other.results == this.results && + other.createdAt == this.createdAt); +} + +class SessionActivitiesCompanion + extends UpdateCompanion { + final Value id; + final Value sessionId; + final Value activityId; + final Value position; + final Value results; + final Value createdAt; + const SessionActivitiesCompanion({ + this.id = const Value.absent(), + this.sessionId = const Value.absent(), + this.activityId = const Value.absent(), + this.position = const Value.absent(), + this.results = const Value.absent(), + this.createdAt = const Value.absent(), + }); + SessionActivitiesCompanion.insert({ + this.id = const Value.absent(), + required int sessionId, + required int activityId, + required int position, + this.results = const Value.absent(), + this.createdAt = const Value.absent(), + }) : sessionId = Value(sessionId), + activityId = Value(activityId), + position = Value(position); + static Insertable custom({ + Expression? id, + Expression? sessionId, + Expression? activityId, + Expression? position, + Expression? results, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (sessionId != null) 'session_id': sessionId, + if (activityId != null) 'activity_id': activityId, + if (position != null) 'position': position, + if (results != null) 'results': results, + if (createdAt != null) 'created_at': createdAt, + }); + } + + SessionActivitiesCompanion copyWith( + {Value? id, + Value? sessionId, + Value? activityId, + Value? position, + Value? results, + Value? createdAt}) { + return SessionActivitiesCompanion( + id: id ?? this.id, + sessionId: sessionId ?? this.sessionId, + activityId: activityId ?? this.activityId, + position: position ?? this.position, + results: results ?? this.results, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (sessionId.present) { + map['session_id'] = Variable(sessionId.value); + } + if (activityId.present) { + map['activity_id'] = Variable(activityId.value); + } + if (position.present) { + map['position'] = Variable(position.value); + } + if (results.present) { + map['results'] = Variable(results.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('SessionActivitiesCompanion(') + ..write('id: $id, ') + ..write('sessionId: $sessionId, ') + ..write('activityId: $activityId, ') + ..write('position: $position, ') + ..write('results: $results, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class Actions extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + Actions(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 64), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn description = GeneratedColumn( + 'body', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn totalSets = GeneratedColumn( + 'total_sets', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn totalReps = GeneratedColumn( + 'total_reps', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 1, maxTextLength: 32), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn restBeforeSets = GeneratedColumn( + 'rest_before_sets', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn restBetweenSets = GeneratedColumn( + 'rest_between_sets', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn restBetweenReps = GeneratedColumn( + 'rest_between_reps', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn restAfterSets = GeneratedColumn( + 'rest_after_sets', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn repType = GeneratedColumn( + 'rep_type', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn repLength = GeneratedColumn( + 'rep_length', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn repWeights = GeneratedColumn( + 'rep_weights', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn setWeights = GeneratedColumn( + 'set_weights', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn isAlternating = GeneratedColumn( + 'is_alternating', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("is_alternating" IN (0, 1))'), + defaultValue: Variable(false)); + late final GeneratedColumn tempo = GeneratedColumn( + 'tempo', aliasedName, true, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 6, maxTextLength: 36), + type: DriftSqlType.string, + requiredDuringInsert: false); + late final GeneratedColumn status = GeneratedColumn( + 'status', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: Variable(ActionStatus.pending.toString())); + late final GeneratedColumn set = GeneratedColumn( + 'set', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => [ + id, + title, + description, + totalSets, + totalReps, + restBeforeSets, + restBetweenSets, + restBetweenReps, + restAfterSets, + repType, + repLength, + repWeights, + setWeights, + isAlternating, + tempo, + status, + set, + createdAt + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'actions'; + @override + Set get $primaryKey => {id}; + @override + ActionsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ActionsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + description: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body'])!, + totalSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}total_sets'])!, + totalReps: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}total_reps'])!, + restBeforeSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_before_sets']), + restBetweenSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_between_sets']), + restBetweenReps: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_between_reps']), + restAfterSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_after_sets']), + repType: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}rep_type'])!, + repLength: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rep_length']), + repWeights: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}rep_weights']), + setWeights: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}set_weights']), + isAlternating: attachedDatabase.typeMapping + .read(DriftSqlType.bool, data['${effectivePrefix}is_alternating'])!, + tempo: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}tempo']), + status: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}status'])!, + set: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}set'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + Actions createAlias(String alias) { + return Actions(attachedDatabase, alias); + } +} + +class ActionsData extends DataClass implements Insertable { + final int id; + final String title; + final String description; + final int totalSets; + final String totalReps; + final int? restBeforeSets; + final int? restBetweenSets; + final int? restBetweenReps; + final int? restAfterSets; + final String repType; + final int? repLength; + final String? repWeights; + final String? setWeights; + final bool isAlternating; + final String? tempo; + final String status; + final String set; + final DateTime createdAt; + const ActionsData( + {required this.id, + required this.title, + required this.description, + required this.totalSets, + required this.totalReps, + this.restBeforeSets, + this.restBetweenSets, + this.restBetweenReps, + this.restAfterSets, + required this.repType, + this.repLength, + this.repWeights, + this.setWeights, + required this.isAlternating, + this.tempo, + required this.status, + required this.set, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + map['body'] = Variable(description); + map['total_sets'] = Variable(totalSets); + map['total_reps'] = Variable(totalReps); + if (!nullToAbsent || restBeforeSets != null) { + map['rest_before_sets'] = Variable(restBeforeSets); + } + if (!nullToAbsent || restBetweenSets != null) { + map['rest_between_sets'] = Variable(restBetweenSets); + } + if (!nullToAbsent || restBetweenReps != null) { + map['rest_between_reps'] = Variable(restBetweenReps); + } + if (!nullToAbsent || restAfterSets != null) { + map['rest_after_sets'] = Variable(restAfterSets); + } + map['rep_type'] = Variable(repType); + if (!nullToAbsent || repLength != null) { + map['rep_length'] = Variable(repLength); + } + if (!nullToAbsent || repWeights != null) { + map['rep_weights'] = Variable(repWeights); + } + if (!nullToAbsent || setWeights != null) { + map['set_weights'] = Variable(setWeights); + } + map['is_alternating'] = Variable(isAlternating); + if (!nullToAbsent || tempo != null) { + map['tempo'] = Variable(tempo); + } + map['status'] = Variable(status); + map['set'] = Variable(set); + map['created_at'] = Variable(createdAt); + return map; + } + + ActionsCompanion toCompanion(bool nullToAbsent) { + return ActionsCompanion( + id: Value(id), + title: Value(title), + description: Value(description), + totalSets: Value(totalSets), + totalReps: Value(totalReps), + restBeforeSets: restBeforeSets == null && nullToAbsent + ? const Value.absent() + : Value(restBeforeSets), + restBetweenSets: restBetweenSets == null && nullToAbsent + ? const Value.absent() + : Value(restBetweenSets), + restBetweenReps: restBetweenReps == null && nullToAbsent + ? const Value.absent() + : Value(restBetweenReps), + restAfterSets: restAfterSets == null && nullToAbsent + ? const Value.absent() + : Value(restAfterSets), + repType: Value(repType), + repLength: repLength == null && nullToAbsent + ? const Value.absent() + : Value(repLength), + repWeights: repWeights == null && nullToAbsent + ? const Value.absent() + : Value(repWeights), + setWeights: setWeights == null && nullToAbsent + ? const Value.absent() + : Value(setWeights), + isAlternating: Value(isAlternating), + tempo: + tempo == null && nullToAbsent ? const Value.absent() : Value(tempo), + status: Value(status), + set: Value(set), + createdAt: Value(createdAt), + ); + } + + factory ActionsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ActionsData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + description: serializer.fromJson(json['description']), + totalSets: serializer.fromJson(json['totalSets']), + totalReps: serializer.fromJson(json['totalReps']), + restBeforeSets: serializer.fromJson(json['restBeforeSets']), + restBetweenSets: serializer.fromJson(json['restBetweenSets']), + restBetweenReps: serializer.fromJson(json['restBetweenReps']), + restAfterSets: serializer.fromJson(json['restAfterSets']), + repType: serializer.fromJson(json['repType']), + repLength: serializer.fromJson(json['repLength']), + repWeights: serializer.fromJson(json['repWeights']), + setWeights: serializer.fromJson(json['setWeights']), + isAlternating: serializer.fromJson(json['isAlternating']), + tempo: serializer.fromJson(json['tempo']), + status: serializer.fromJson(json['status']), + set: serializer.fromJson(json['set']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'description': serializer.toJson(description), + 'totalSets': serializer.toJson(totalSets), + 'totalReps': serializer.toJson(totalReps), + 'restBeforeSets': serializer.toJson(restBeforeSets), + 'restBetweenSets': serializer.toJson(restBetweenSets), + 'restBetweenReps': serializer.toJson(restBetweenReps), + 'restAfterSets': serializer.toJson(restAfterSets), + 'repType': serializer.toJson(repType), + 'repLength': serializer.toJson(repLength), + 'repWeights': serializer.toJson(repWeights), + 'setWeights': serializer.toJson(setWeights), + 'isAlternating': serializer.toJson(isAlternating), + 'tempo': serializer.toJson(tempo), + 'status': serializer.toJson(status), + 'set': serializer.toJson(set), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ActionsData copyWith( + {int? id, + String? title, + String? description, + int? totalSets, + String? totalReps, + Value restBeforeSets = const Value.absent(), + Value restBetweenSets = const Value.absent(), + Value restBetweenReps = const Value.absent(), + Value restAfterSets = const Value.absent(), + String? repType, + Value repLength = const Value.absent(), + Value repWeights = const Value.absent(), + Value setWeights = const Value.absent(), + bool? isAlternating, + Value tempo = const Value.absent(), + String? status, + String? set, + DateTime? createdAt}) => + ActionsData( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + totalSets: totalSets ?? this.totalSets, + totalReps: totalReps ?? this.totalReps, + restBeforeSets: + restBeforeSets.present ? restBeforeSets.value : this.restBeforeSets, + restBetweenSets: restBetweenSets.present + ? restBetweenSets.value + : this.restBetweenSets, + restBetweenReps: restBetweenReps.present + ? restBetweenReps.value + : this.restBetweenReps, + restAfterSets: + restAfterSets.present ? restAfterSets.value : this.restAfterSets, + repType: repType ?? this.repType, + repLength: repLength.present ? repLength.value : this.repLength, + repWeights: repWeights.present ? repWeights.value : this.repWeights, + setWeights: setWeights.present ? setWeights.value : this.setWeights, + isAlternating: isAlternating ?? this.isAlternating, + tempo: tempo.present ? tempo.value : this.tempo, + status: status ?? this.status, + set: set ?? this.set, + createdAt: createdAt ?? this.createdAt, + ); + ActionsData copyWithCompanion(ActionsCompanion data) { + return ActionsData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + description: + data.description.present ? data.description.value : this.description, + totalSets: data.totalSets.present ? data.totalSets.value : this.totalSets, + totalReps: data.totalReps.present ? data.totalReps.value : this.totalReps, + restBeforeSets: data.restBeforeSets.present + ? data.restBeforeSets.value + : this.restBeforeSets, + restBetweenSets: data.restBetweenSets.present + ? data.restBetweenSets.value + : this.restBetweenSets, + restBetweenReps: data.restBetweenReps.present + ? data.restBetweenReps.value + : this.restBetweenReps, + restAfterSets: data.restAfterSets.present + ? data.restAfterSets.value + : this.restAfterSets, + repType: data.repType.present ? data.repType.value : this.repType, + repLength: data.repLength.present ? data.repLength.value : this.repLength, + repWeights: + data.repWeights.present ? data.repWeights.value : this.repWeights, + setWeights: + data.setWeights.present ? data.setWeights.value : this.setWeights, + isAlternating: data.isAlternating.present + ? data.isAlternating.value + : this.isAlternating, + tempo: data.tempo.present ? data.tempo.value : this.tempo, + status: data.status.present ? data.status.value : this.status, + set: data.set.present ? data.set.value : this.set, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ActionsData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('totalSets: $totalSets, ') + ..write('totalReps: $totalReps, ') + ..write('restBeforeSets: $restBeforeSets, ') + ..write('restBetweenSets: $restBetweenSets, ') + ..write('restBetweenReps: $restBetweenReps, ') + ..write('restAfterSets: $restAfterSets, ') + ..write('repType: $repType, ') + ..write('repLength: $repLength, ') + ..write('repWeights: $repWeights, ') + ..write('setWeights: $setWeights, ') + ..write('isAlternating: $isAlternating, ') + ..write('tempo: $tempo, ') + ..write('status: $status, ') + ..write('set: $set, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash( + id, + title, + description, + totalSets, + totalReps, + restBeforeSets, + restBetweenSets, + restBetweenReps, + restAfterSets, + repType, + repLength, + repWeights, + setWeights, + isAlternating, + tempo, + status, + set, + createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ActionsData && + other.id == this.id && + other.title == this.title && + other.description == this.description && + other.totalSets == this.totalSets && + other.totalReps == this.totalReps && + other.restBeforeSets == this.restBeforeSets && + other.restBetweenSets == this.restBetweenSets && + other.restBetweenReps == this.restBetweenReps && + other.restAfterSets == this.restAfterSets && + other.repType == this.repType && + other.repLength == this.repLength && + other.repWeights == this.repWeights && + other.setWeights == this.setWeights && + other.isAlternating == this.isAlternating && + other.tempo == this.tempo && + other.status == this.status && + other.set == this.set && + other.createdAt == this.createdAt); +} + +class ActionsCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value description; + final Value totalSets; + final Value totalReps; + final Value restBeforeSets; + final Value restBetweenSets; + final Value restBetweenReps; + final Value restAfterSets; + final Value repType; + final Value repLength; + final Value repWeights; + final Value setWeights; + final Value isAlternating; + final Value tempo; + final Value status; + final Value set; + final Value createdAt; + const ActionsCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.description = const Value.absent(), + this.totalSets = const Value.absent(), + this.totalReps = const Value.absent(), + this.restBeforeSets = const Value.absent(), + this.restBetweenSets = const Value.absent(), + this.restBetweenReps = const Value.absent(), + this.restAfterSets = const Value.absent(), + this.repType = const Value.absent(), + this.repLength = const Value.absent(), + this.repWeights = const Value.absent(), + this.setWeights = const Value.absent(), + this.isAlternating = const Value.absent(), + this.tempo = const Value.absent(), + this.status = const Value.absent(), + this.set = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ActionsCompanion.insert({ + this.id = const Value.absent(), + required String title, + required String description, + required int totalSets, + required String totalReps, + this.restBeforeSets = const Value.absent(), + this.restBetweenSets = const Value.absent(), + this.restBetweenReps = const Value.absent(), + this.restAfterSets = const Value.absent(), + required String repType, + this.repLength = const Value.absent(), + this.repWeights = const Value.absent(), + this.setWeights = const Value.absent(), + this.isAlternating = const Value.absent(), + this.tempo = const Value.absent(), + this.status = const Value.absent(), + required String set, + this.createdAt = const Value.absent(), + }) : title = Value(title), + description = Value(description), + totalSets = Value(totalSets), + totalReps = Value(totalReps), + repType = Value(repType), + set = Value(set); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? description, + Expression? totalSets, + Expression? totalReps, + Expression? restBeforeSets, + Expression? restBetweenSets, + Expression? restBetweenReps, + Expression? restAfterSets, + Expression? repType, + Expression? repLength, + Expression? repWeights, + Expression? setWeights, + Expression? isAlternating, + Expression? tempo, + Expression? status, + Expression? set, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (description != null) 'body': description, + if (totalSets != null) 'total_sets': totalSets, + if (totalReps != null) 'total_reps': totalReps, + if (restBeforeSets != null) 'rest_before_sets': restBeforeSets, + if (restBetweenSets != null) 'rest_between_sets': restBetweenSets, + if (restBetweenReps != null) 'rest_between_reps': restBetweenReps, + if (restAfterSets != null) 'rest_after_sets': restAfterSets, + if (repType != null) 'rep_type': repType, + if (repLength != null) 'rep_length': repLength, + if (repWeights != null) 'rep_weights': repWeights, + if (setWeights != null) 'set_weights': setWeights, + if (isAlternating != null) 'is_alternating': isAlternating, + if (tempo != null) 'tempo': tempo, + if (status != null) 'status': status, + if (set != null) 'set': set, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ActionsCompanion copyWith( + {Value? id, + Value? title, + Value? description, + Value? totalSets, + Value? totalReps, + Value? restBeforeSets, + Value? restBetweenSets, + Value? restBetweenReps, + Value? restAfterSets, + Value? repType, + Value? repLength, + Value? repWeights, + Value? setWeights, + Value? isAlternating, + Value? tempo, + Value? status, + Value? set, + Value? createdAt}) { + return ActionsCompanion( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + totalSets: totalSets ?? this.totalSets, + totalReps: totalReps ?? this.totalReps, + restBeforeSets: restBeforeSets ?? this.restBeforeSets, + restBetweenSets: restBetweenSets ?? this.restBetweenSets, + restBetweenReps: restBetweenReps ?? this.restBetweenReps, + restAfterSets: restAfterSets ?? this.restAfterSets, + repType: repType ?? this.repType, + repLength: repLength ?? this.repLength, + repWeights: repWeights ?? this.repWeights, + setWeights: setWeights ?? this.setWeights, + isAlternating: isAlternating ?? this.isAlternating, + tempo: tempo ?? this.tempo, + status: status ?? this.status, + set: set ?? this.set, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (description.present) { + map['body'] = Variable(description.value); + } + if (totalSets.present) { + map['total_sets'] = Variable(totalSets.value); + } + if (totalReps.present) { + map['total_reps'] = Variable(totalReps.value); + } + if (restBeforeSets.present) { + map['rest_before_sets'] = Variable(restBeforeSets.value); + } + if (restBetweenSets.present) { + map['rest_between_sets'] = Variable(restBetweenSets.value); + } + if (restBetweenReps.present) { + map['rest_between_reps'] = Variable(restBetweenReps.value); + } + if (restAfterSets.present) { + map['rest_after_sets'] = Variable(restAfterSets.value); + } + if (repType.present) { + map['rep_type'] = Variable(repType.value); + } + if (repLength.present) { + map['rep_length'] = Variable(repLength.value); + } + if (repWeights.present) { + map['rep_weights'] = Variable(repWeights.value); + } + if (setWeights.present) { + map['set_weights'] = Variable(setWeights.value); + } + if (isAlternating.present) { + map['is_alternating'] = Variable(isAlternating.value); + } + if (tempo.present) { + map['tempo'] = Variable(tempo.value); + } + if (status.present) { + map['status'] = Variable(status.value); + } + if (set.present) { + map['set'] = Variable(set.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ActionsCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('totalSets: $totalSets, ') + ..write('totalReps: $totalReps, ') + ..write('restBeforeSets: $restBeforeSets, ') + ..write('restBetweenSets: $restBetweenSets, ') + ..write('restBetweenReps: $restBetweenReps, ') + ..write('restAfterSets: $restAfterSets, ') + ..write('repType: $repType, ') + ..write('repLength: $repLength, ') + ..write('repWeights: $repWeights, ') + ..write('setWeights: $setWeights, ') + ..write('isAlternating: $isAlternating, ') + ..write('tempo: $tempo, ') + ..write('status: $status, ') + ..write('set: $set, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class ActivityActions extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + ActivityActions(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn activityId = GeneratedColumn( + 'activity_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES activities (id) ON DELETE CASCADE')); + late final GeneratedColumn actionId = GeneratedColumn( + 'action_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES actions (id) ON DELETE CASCADE')); + late final GeneratedColumn position = GeneratedColumn( + 'position', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, activityId, actionId, position, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'activity_actions'; + @override + Set get $primaryKey => {id}; + @override + ActivityActionsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ActivityActionsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + activityId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}activity_id'])!, + actionId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}action_id'])!, + position: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}position'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + ActivityActions createAlias(String alias) { + return ActivityActions(attachedDatabase, alias); + } +} + +class ActivityActionsData extends DataClass + implements Insertable { + final int id; + final int activityId; + final int actionId; + final int position; + final DateTime createdAt; + const ActivityActionsData( + {required this.id, + required this.activityId, + required this.actionId, + required this.position, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['activity_id'] = Variable(activityId); + map['action_id'] = Variable(actionId); + map['position'] = Variable(position); + map['created_at'] = Variable(createdAt); + return map; + } + + ActivityActionsCompanion toCompanion(bool nullToAbsent) { + return ActivityActionsCompanion( + id: Value(id), + activityId: Value(activityId), + actionId: Value(actionId), + position: Value(position), + createdAt: Value(createdAt), + ); + } + + factory ActivityActionsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ActivityActionsData( + id: serializer.fromJson(json['id']), + activityId: serializer.fromJson(json['activityId']), + actionId: serializer.fromJson(json['actionId']), + position: serializer.fromJson(json['position']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'activityId': serializer.toJson(activityId), + 'actionId': serializer.toJson(actionId), + 'position': serializer.toJson(position), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ActivityActionsData copyWith( + {int? id, + int? activityId, + int? actionId, + int? position, + DateTime? createdAt}) => + ActivityActionsData( + id: id ?? this.id, + activityId: activityId ?? this.activityId, + actionId: actionId ?? this.actionId, + position: position ?? this.position, + createdAt: createdAt ?? this.createdAt, + ); + ActivityActionsData copyWithCompanion(ActivityActionsCompanion data) { + return ActivityActionsData( + id: data.id.present ? data.id.value : this.id, + activityId: + data.activityId.present ? data.activityId.value : this.activityId, + actionId: data.actionId.present ? data.actionId.value : this.actionId, + position: data.position.present ? data.position.value : this.position, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ActivityActionsData(') + ..write('id: $id, ') + ..write('activityId: $activityId, ') + ..write('actionId: $actionId, ') + ..write('position: $position, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(id, activityId, actionId, position, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ActivityActionsData && + other.id == this.id && + other.activityId == this.activityId && + other.actionId == this.actionId && + other.position == this.position && + other.createdAt == this.createdAt); +} + +class ActivityActionsCompanion extends UpdateCompanion { + final Value id; + final Value activityId; + final Value actionId; + final Value position; + final Value createdAt; + const ActivityActionsCompanion({ + this.id = const Value.absent(), + this.activityId = const Value.absent(), + this.actionId = const Value.absent(), + this.position = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ActivityActionsCompanion.insert({ + this.id = const Value.absent(), + required int activityId, + required int actionId, + required int position, + this.createdAt = const Value.absent(), + }) : activityId = Value(activityId), + actionId = Value(actionId), + position = Value(position); + static Insertable custom({ + Expression? id, + Expression? activityId, + Expression? actionId, + Expression? position, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (activityId != null) 'activity_id': activityId, + if (actionId != null) 'action_id': actionId, + if (position != null) 'position': position, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ActivityActionsCompanion copyWith( + {Value? id, + Value? activityId, + Value? actionId, + Value? position, + Value? createdAt}) { + return ActivityActionsCompanion( + id: id ?? this.id, + activityId: activityId ?? this.activityId, + actionId: actionId ?? this.actionId, + position: position ?? this.position, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (activityId.present) { + map['activity_id'] = Variable(activityId.value); + } + if (actionId.present) { + map['action_id'] = Variable(actionId.value); + } + if (position.present) { + map['position'] = Variable(position.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ActivityActionsCompanion(') + ..write('id: $id, ') + ..write('activityId: $activityId, ') + ..write('actionId: $actionId, ') + ..write('position: $position, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class MediaItems extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + MediaItems(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 64), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn description = GeneratedColumn( + 'body', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn reference = GeneratedColumn( + 'reference', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn type = GeneratedColumn( + 'type', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, title, description, reference, type, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'media_items'; + @override + Set get $primaryKey => {id}; + @override + MediaItemsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return MediaItemsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + description: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body'])!, + reference: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}reference'])!, + type: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}type'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + MediaItems createAlias(String alias) { + return MediaItems(attachedDatabase, alias); + } +} + +class MediaItemsData extends DataClass implements Insertable { + final int id; + final String title; + final String description; + final String reference; + final String type; + final DateTime createdAt; + const MediaItemsData( + {required this.id, + required this.title, + required this.description, + required this.reference, + required this.type, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + map['body'] = Variable(description); + map['reference'] = Variable(reference); + map['type'] = Variable(type); + map['created_at'] = Variable(createdAt); + return map; + } + + MediaItemsCompanion toCompanion(bool nullToAbsent) { + return MediaItemsCompanion( + id: Value(id), + title: Value(title), + description: Value(description), + reference: Value(reference), + type: Value(type), + createdAt: Value(createdAt), + ); + } + + factory MediaItemsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return MediaItemsData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + description: serializer.fromJson(json['description']), + reference: serializer.fromJson(json['reference']), + type: serializer.fromJson(json['type']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'description': serializer.toJson(description), + 'reference': serializer.toJson(reference), + 'type': serializer.toJson(type), + 'createdAt': serializer.toJson(createdAt), + }; + } + + MediaItemsData copyWith( + {int? id, + String? title, + String? description, + String? reference, + String? type, + DateTime? createdAt}) => + MediaItemsData( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + reference: reference ?? this.reference, + type: type ?? this.type, + createdAt: createdAt ?? this.createdAt, + ); + MediaItemsData copyWithCompanion(MediaItemsCompanion data) { + return MediaItemsData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + description: + data.description.present ? data.description.value : this.description, + reference: data.reference.present ? data.reference.value : this.reference, + type: data.type.present ? data.type.value : this.type, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('MediaItemsData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('reference: $reference, ') + ..write('type: $type, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(id, title, description, reference, type, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is MediaItemsData && + other.id == this.id && + other.title == this.title && + other.description == this.description && + other.reference == this.reference && + other.type == this.type && + other.createdAt == this.createdAt); +} + +class MediaItemsCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value description; + final Value reference; + final Value type; + final Value createdAt; + const MediaItemsCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.description = const Value.absent(), + this.reference = const Value.absent(), + this.type = const Value.absent(), + this.createdAt = const Value.absent(), + }); + MediaItemsCompanion.insert({ + this.id = const Value.absent(), + required String title, + required String description, + required String reference, + required String type, + this.createdAt = const Value.absent(), + }) : title = Value(title), + description = Value(description), + reference = Value(reference), + type = Value(type); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? description, + Expression? reference, + Expression? type, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (description != null) 'body': description, + if (reference != null) 'reference': reference, + if (type != null) 'type': type, + if (createdAt != null) 'created_at': createdAt, + }); + } + + MediaItemsCompanion copyWith( + {Value? id, + Value? title, + Value? description, + Value? reference, + Value? type, + Value? createdAt}) { + return MediaItemsCompanion( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + reference: reference ?? this.reference, + type: type ?? this.type, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (description.present) { + map['body'] = Variable(description.value); + } + if (reference.present) { + map['reference'] = Variable(reference.value); + } + if (type.present) { + map['type'] = Variable(type.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('MediaItemsCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('reference: $reference, ') + ..write('type: $type, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class ObjectMediaItems extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + ObjectMediaItems(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn objectId = GeneratedColumn( + 'object_id', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn objectType = GeneratedColumn( + 'object_type', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn mediaId = GeneratedColumn( + 'media_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES media_items (id) ON DELETE CASCADE')); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, objectId, objectType, mediaId, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'object_media_items'; + @override + Set get $primaryKey => {id}; + @override + ObjectMediaItemsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ObjectMediaItemsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + objectId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}object_id'])!, + objectType: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}object_type'])!, + mediaId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}media_id'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + ObjectMediaItems createAlias(String alias) { + return ObjectMediaItems(attachedDatabase, alias); + } +} + +class ObjectMediaItemsData extends DataClass + implements Insertable { + final int id; + final int objectId; + final String objectType; + final int mediaId; + final DateTime createdAt; + const ObjectMediaItemsData( + {required this.id, + required this.objectId, + required this.objectType, + required this.mediaId, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['object_id'] = Variable(objectId); + map['object_type'] = Variable(objectType); + map['media_id'] = Variable(mediaId); + map['created_at'] = Variable(createdAt); + return map; + } + + ObjectMediaItemsCompanion toCompanion(bool nullToAbsent) { + return ObjectMediaItemsCompanion( + id: Value(id), + objectId: Value(objectId), + objectType: Value(objectType), + mediaId: Value(mediaId), + createdAt: Value(createdAt), + ); + } + + factory ObjectMediaItemsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ObjectMediaItemsData( + id: serializer.fromJson(json['id']), + objectId: serializer.fromJson(json['objectId']), + objectType: serializer.fromJson(json['objectType']), + mediaId: serializer.fromJson(json['mediaId']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'objectId': serializer.toJson(objectId), + 'objectType': serializer.toJson(objectType), + 'mediaId': serializer.toJson(mediaId), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ObjectMediaItemsData copyWith( + {int? id, + int? objectId, + String? objectType, + int? mediaId, + DateTime? createdAt}) => + ObjectMediaItemsData( + id: id ?? this.id, + objectId: objectId ?? this.objectId, + objectType: objectType ?? this.objectType, + mediaId: mediaId ?? this.mediaId, + createdAt: createdAt ?? this.createdAt, + ); + ObjectMediaItemsData copyWithCompanion(ObjectMediaItemsCompanion data) { + return ObjectMediaItemsData( + id: data.id.present ? data.id.value : this.id, + objectId: data.objectId.present ? data.objectId.value : this.objectId, + objectType: + data.objectType.present ? data.objectType.value : this.objectType, + mediaId: data.mediaId.present ? data.mediaId.value : this.mediaId, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ObjectMediaItemsData(') + ..write('id: $id, ') + ..write('objectId: $objectId, ') + ..write('objectType: $objectType, ') + ..write('mediaId: $mediaId, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(id, objectId, objectType, mediaId, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ObjectMediaItemsData && + other.id == this.id && + other.objectId == this.objectId && + other.objectType == this.objectType && + other.mediaId == this.mediaId && + other.createdAt == this.createdAt); +} + +class ObjectMediaItemsCompanion extends UpdateCompanion { + final Value id; + final Value objectId; + final Value objectType; + final Value mediaId; + final Value createdAt; + const ObjectMediaItemsCompanion({ + this.id = const Value.absent(), + this.objectId = const Value.absent(), + this.objectType = const Value.absent(), + this.mediaId = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ObjectMediaItemsCompanion.insert({ + this.id = const Value.absent(), + required int objectId, + required String objectType, + required int mediaId, + this.createdAt = const Value.absent(), + }) : objectId = Value(objectId), + objectType = Value(objectType), + mediaId = Value(mediaId); + static Insertable custom({ + Expression? id, + Expression? objectId, + Expression? objectType, + Expression? mediaId, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (objectId != null) 'object_id': objectId, + if (objectType != null) 'object_type': objectType, + if (mediaId != null) 'media_id': mediaId, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ObjectMediaItemsCompanion copyWith( + {Value? id, + Value? objectId, + Value? objectType, + Value? mediaId, + Value? createdAt}) { + return ObjectMediaItemsCompanion( + id: id ?? this.id, + objectId: objectId ?? this.objectId, + objectType: objectType ?? this.objectType, + mediaId: mediaId ?? this.mediaId, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (objectId.present) { + map['object_id'] = Variable(objectId.value); + } + if (objectType.present) { + map['object_type'] = Variable(objectType.value); + } + if (mediaId.present) { + map['media_id'] = Variable(mediaId.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ObjectMediaItemsCompanion(') + ..write('id: $id, ') + ..write('objectId: $objectId, ') + ..write('objectType: $objectType, ') + ..write('mediaId: $mediaId, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class DatabaseAtV24 extends GeneratedDatabase { + DatabaseAtV24(QueryExecutor e) : super(e); + late final Sessions sessions = Sessions(this); + late final Activities activities = Activities(this); + late final SessionActivities sessionActivities = SessionActivities(this); + late final Actions actions = Actions(this); + late final ActivityActions activityActions = ActivityActions(this); + late final MediaItems mediaItems = MediaItems(this); + late final ObjectMediaItems objectMediaItems = ObjectMediaItems(this); + @override + Iterable> get allTables => + allSchemaEntities.whereType>(); + @override + List get allSchemaEntities => [ + sessions, + activities, + sessionActivities, + actions, + activityActions, + mediaItems, + objectMediaItems + ]; + @override + int get schemaVersion => 24; +} diff --git a/test/drift/sendtrain/generated/schema_v25.dart b/test/drift/sendtrain/generated/schema_v25.dart new file mode 100644 index 0000000..4ed1ce2 --- /dev/null +++ b/test/drift/sendtrain/generated/schema_v25.dart @@ -0,0 +1,2702 @@ +// dart format width=80 +// GENERATED CODE, DO NOT EDIT BY HAND. +// ignore_for_file: type=lint +import 'package:drift/drift.dart'; + +class Sessions extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + Sessions(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 32), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn content = GeneratedColumn( + 'body', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn status = GeneratedColumn( + 'status', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn achievements = GeneratedColumn( + 'achievements', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn address = GeneratedColumn( + 'address', aliasedName, true, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 256), + type: DriftSqlType.string, + requiredDuringInsert: false); + late final GeneratedColumn date = GeneratedColumn( + 'date', aliasedName, true, + type: DriftSqlType.dateTime, requiredDuringInsert: false); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, title, content, status, achievements, address, date, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'sessions'; + @override + Set get $primaryKey => {id}; + @override + SessionsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return SessionsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + content: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body'])!, + status: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}status'])!, + achievements: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}achievements']), + address: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}address']), + date: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}date']), + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + Sessions createAlias(String alias) { + return Sessions(attachedDatabase, alias); + } +} + +class SessionsData extends DataClass implements Insertable { + final int id; + final String title; + final String content; + final String status; + final String? achievements; + final String? address; + final DateTime? date; + final DateTime createdAt; + const SessionsData( + {required this.id, + required this.title, + required this.content, + required this.status, + this.achievements, + this.address, + this.date, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + map['body'] = Variable(content); + map['status'] = Variable(status); + if (!nullToAbsent || achievements != null) { + map['achievements'] = Variable(achievements); + } + if (!nullToAbsent || address != null) { + map['address'] = Variable(address); + } + if (!nullToAbsent || date != null) { + map['date'] = Variable(date); + } + map['created_at'] = Variable(createdAt); + return map; + } + + SessionsCompanion toCompanion(bool nullToAbsent) { + return SessionsCompanion( + id: Value(id), + title: Value(title), + content: Value(content), + status: Value(status), + achievements: achievements == null && nullToAbsent + ? const Value.absent() + : Value(achievements), + address: address == null && nullToAbsent + ? const Value.absent() + : Value(address), + date: date == null && nullToAbsent ? const Value.absent() : Value(date), + createdAt: Value(createdAt), + ); + } + + factory SessionsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return SessionsData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + content: serializer.fromJson(json['content']), + status: serializer.fromJson(json['status']), + achievements: serializer.fromJson(json['achievements']), + address: serializer.fromJson(json['address']), + date: serializer.fromJson(json['date']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'content': serializer.toJson(content), + 'status': serializer.toJson(status), + 'achievements': serializer.toJson(achievements), + 'address': serializer.toJson(address), + 'date': serializer.toJson(date), + 'createdAt': serializer.toJson(createdAt), + }; + } + + SessionsData copyWith( + {int? id, + String? title, + String? content, + String? status, + Value achievements = const Value.absent(), + Value address = const Value.absent(), + Value date = const Value.absent(), + DateTime? createdAt}) => + SessionsData( + id: id ?? this.id, + title: title ?? this.title, + content: content ?? this.content, + status: status ?? this.status, + achievements: + achievements.present ? achievements.value : this.achievements, + address: address.present ? address.value : this.address, + date: date.present ? date.value : this.date, + createdAt: createdAt ?? this.createdAt, + ); + SessionsData copyWithCompanion(SessionsCompanion data) { + return SessionsData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + content: data.content.present ? data.content.value : this.content, + status: data.status.present ? data.status.value : this.status, + achievements: data.achievements.present + ? data.achievements.value + : this.achievements, + address: data.address.present ? data.address.value : this.address, + date: data.date.present ? data.date.value : this.date, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('SessionsData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('content: $content, ') + ..write('status: $status, ') + ..write('achievements: $achievements, ') + ..write('address: $address, ') + ..write('date: $date, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash( + id, title, content, status, achievements, address, date, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is SessionsData && + other.id == this.id && + other.title == this.title && + other.content == this.content && + other.status == this.status && + other.achievements == this.achievements && + other.address == this.address && + other.date == this.date && + other.createdAt == this.createdAt); +} + +class SessionsCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value content; + final Value status; + final Value achievements; + final Value address; + final Value date; + final Value createdAt; + const SessionsCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.content = const Value.absent(), + this.status = const Value.absent(), + this.achievements = const Value.absent(), + this.address = const Value.absent(), + this.date = const Value.absent(), + this.createdAt = const Value.absent(), + }); + SessionsCompanion.insert({ + this.id = const Value.absent(), + required String title, + required String content, + required String status, + this.achievements = const Value.absent(), + this.address = const Value.absent(), + this.date = const Value.absent(), + this.createdAt = const Value.absent(), + }) : title = Value(title), + content = Value(content), + status = Value(status); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? content, + Expression? status, + Expression? achievements, + Expression? address, + Expression? date, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (content != null) 'body': content, + if (status != null) 'status': status, + if (achievements != null) 'achievements': achievements, + if (address != null) 'address': address, + if (date != null) 'date': date, + if (createdAt != null) 'created_at': createdAt, + }); + } + + SessionsCompanion copyWith( + {Value? id, + Value? title, + Value? content, + Value? status, + Value? achievements, + Value? address, + Value? date, + Value? createdAt}) { + return SessionsCompanion( + id: id ?? this.id, + title: title ?? this.title, + content: content ?? this.content, + status: status ?? this.status, + achievements: achievements ?? this.achievements, + address: address ?? this.address, + date: date ?? this.date, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (content.present) { + map['body'] = Variable(content.value); + } + if (status.present) { + map['status'] = Variable(status.value); + } + if (achievements.present) { + map['achievements'] = Variable(achievements.value); + } + if (address.present) { + map['address'] = Variable(address.value); + } + if (date.present) { + map['date'] = Variable(date.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('SessionsCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('content: $content, ') + ..write('status: $status, ') + ..write('achievements: $achievements, ') + ..write('address: $address, ') + ..write('date: $date, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class Activities extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + Activities(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 100), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn type = GeneratedColumn( + 'type', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn description = GeneratedColumn( + 'body', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn category = GeneratedColumn( + 'category', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn force = GeneratedColumn( + 'force', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn level = GeneratedColumn( + 'level', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn mechanic = GeneratedColumn( + 'mechanic', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn equipment = GeneratedColumn( + 'equipment', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn primaryMuscles = GeneratedColumn( + 'primary_muscles', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn secondaryMuscles = GeneratedColumn( + 'secondary_muscles', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => [ + id, + title, + type, + description, + category, + force, + level, + mechanic, + equipment, + primaryMuscles, + secondaryMuscles, + createdAt + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'activities'; + @override + Set get $primaryKey => {id}; + @override + ActivitiesData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ActivitiesData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + type: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}type']), + description: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body']), + category: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}category']), + force: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}force']), + level: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}level']), + mechanic: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}mechanic']), + equipment: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}equipment']), + primaryMuscles: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}primary_muscles']), + secondaryMuscles: attachedDatabase.typeMapping.read( + DriftSqlType.string, data['${effectivePrefix}secondary_muscles']), + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + Activities createAlias(String alias) { + return Activities(attachedDatabase, alias); + } +} + +class ActivitiesData extends DataClass implements Insertable { + final int id; + final String title; + final String? type; + final String? description; + final String? category; + final String? force; + final String? level; + final String? mechanic; + final String? equipment; + final String? primaryMuscles; + final String? secondaryMuscles; + final DateTime createdAt; + const ActivitiesData( + {required this.id, + required this.title, + this.type, + this.description, + this.category, + this.force, + this.level, + this.mechanic, + this.equipment, + this.primaryMuscles, + this.secondaryMuscles, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + if (!nullToAbsent || type != null) { + map['type'] = Variable(type); + } + if (!nullToAbsent || description != null) { + map['body'] = Variable(description); + } + if (!nullToAbsent || category != null) { + map['category'] = Variable(category); + } + if (!nullToAbsent || force != null) { + map['force'] = Variable(force); + } + if (!nullToAbsent || level != null) { + map['level'] = Variable(level); + } + if (!nullToAbsent || mechanic != null) { + map['mechanic'] = Variable(mechanic); + } + if (!nullToAbsent || equipment != null) { + map['equipment'] = Variable(equipment); + } + if (!nullToAbsent || primaryMuscles != null) { + map['primary_muscles'] = Variable(primaryMuscles); + } + if (!nullToAbsent || secondaryMuscles != null) { + map['secondary_muscles'] = Variable(secondaryMuscles); + } + map['created_at'] = Variable(createdAt); + return map; + } + + ActivitiesCompanion toCompanion(bool nullToAbsent) { + return ActivitiesCompanion( + id: Value(id), + title: Value(title), + type: type == null && nullToAbsent ? const Value.absent() : Value(type), + description: description == null && nullToAbsent + ? const Value.absent() + : Value(description), + category: category == null && nullToAbsent + ? const Value.absent() + : Value(category), + force: + force == null && nullToAbsent ? const Value.absent() : Value(force), + level: + level == null && nullToAbsent ? const Value.absent() : Value(level), + mechanic: mechanic == null && nullToAbsent + ? const Value.absent() + : Value(mechanic), + equipment: equipment == null && nullToAbsent + ? const Value.absent() + : Value(equipment), + primaryMuscles: primaryMuscles == null && nullToAbsent + ? const Value.absent() + : Value(primaryMuscles), + secondaryMuscles: secondaryMuscles == null && nullToAbsent + ? const Value.absent() + : Value(secondaryMuscles), + createdAt: Value(createdAt), + ); + } + + factory ActivitiesData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ActivitiesData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + type: serializer.fromJson(json['type']), + description: serializer.fromJson(json['description']), + category: serializer.fromJson(json['category']), + force: serializer.fromJson(json['force']), + level: serializer.fromJson(json['level']), + mechanic: serializer.fromJson(json['mechanic']), + equipment: serializer.fromJson(json['equipment']), + primaryMuscles: serializer.fromJson(json['primaryMuscles']), + secondaryMuscles: serializer.fromJson(json['secondaryMuscles']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'type': serializer.toJson(type), + 'description': serializer.toJson(description), + 'category': serializer.toJson(category), + 'force': serializer.toJson(force), + 'level': serializer.toJson(level), + 'mechanic': serializer.toJson(mechanic), + 'equipment': serializer.toJson(equipment), + 'primaryMuscles': serializer.toJson(primaryMuscles), + 'secondaryMuscles': serializer.toJson(secondaryMuscles), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ActivitiesData copyWith( + {int? id, + String? title, + Value type = const Value.absent(), + Value description = const Value.absent(), + Value category = const Value.absent(), + Value force = const Value.absent(), + Value level = const Value.absent(), + Value mechanic = const Value.absent(), + Value equipment = const Value.absent(), + Value primaryMuscles = const Value.absent(), + Value secondaryMuscles = const Value.absent(), + DateTime? createdAt}) => + ActivitiesData( + id: id ?? this.id, + title: title ?? this.title, + type: type.present ? type.value : this.type, + description: description.present ? description.value : this.description, + category: category.present ? category.value : this.category, + force: force.present ? force.value : this.force, + level: level.present ? level.value : this.level, + mechanic: mechanic.present ? mechanic.value : this.mechanic, + equipment: equipment.present ? equipment.value : this.equipment, + primaryMuscles: + primaryMuscles.present ? primaryMuscles.value : this.primaryMuscles, + secondaryMuscles: secondaryMuscles.present + ? secondaryMuscles.value + : this.secondaryMuscles, + createdAt: createdAt ?? this.createdAt, + ); + ActivitiesData copyWithCompanion(ActivitiesCompanion data) { + return ActivitiesData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + type: data.type.present ? data.type.value : this.type, + description: + data.description.present ? data.description.value : this.description, + category: data.category.present ? data.category.value : this.category, + force: data.force.present ? data.force.value : this.force, + level: data.level.present ? data.level.value : this.level, + mechanic: data.mechanic.present ? data.mechanic.value : this.mechanic, + equipment: data.equipment.present ? data.equipment.value : this.equipment, + primaryMuscles: data.primaryMuscles.present + ? data.primaryMuscles.value + : this.primaryMuscles, + secondaryMuscles: data.secondaryMuscles.present + ? data.secondaryMuscles.value + : this.secondaryMuscles, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ActivitiesData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('type: $type, ') + ..write('description: $description, ') + ..write('category: $category, ') + ..write('force: $force, ') + ..write('level: $level, ') + ..write('mechanic: $mechanic, ') + ..write('equipment: $equipment, ') + ..write('primaryMuscles: $primaryMuscles, ') + ..write('secondaryMuscles: $secondaryMuscles, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(id, title, type, description, category, force, + level, mechanic, equipment, primaryMuscles, secondaryMuscles, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ActivitiesData && + other.id == this.id && + other.title == this.title && + other.type == this.type && + other.description == this.description && + other.category == this.category && + other.force == this.force && + other.level == this.level && + other.mechanic == this.mechanic && + other.equipment == this.equipment && + other.primaryMuscles == this.primaryMuscles && + other.secondaryMuscles == this.secondaryMuscles && + other.createdAt == this.createdAt); +} + +class ActivitiesCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value type; + final Value description; + final Value category; + final Value force; + final Value level; + final Value mechanic; + final Value equipment; + final Value primaryMuscles; + final Value secondaryMuscles; + final Value createdAt; + const ActivitiesCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.type = const Value.absent(), + this.description = const Value.absent(), + this.category = const Value.absent(), + this.force = const Value.absent(), + this.level = const Value.absent(), + this.mechanic = const Value.absent(), + this.equipment = const Value.absent(), + this.primaryMuscles = const Value.absent(), + this.secondaryMuscles = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ActivitiesCompanion.insert({ + this.id = const Value.absent(), + required String title, + this.type = const Value.absent(), + this.description = const Value.absent(), + this.category = const Value.absent(), + this.force = const Value.absent(), + this.level = const Value.absent(), + this.mechanic = const Value.absent(), + this.equipment = const Value.absent(), + this.primaryMuscles = const Value.absent(), + this.secondaryMuscles = const Value.absent(), + this.createdAt = const Value.absent(), + }) : title = Value(title); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? type, + Expression? description, + Expression? category, + Expression? force, + Expression? level, + Expression? mechanic, + Expression? equipment, + Expression? primaryMuscles, + Expression? secondaryMuscles, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (type != null) 'type': type, + if (description != null) 'body': description, + if (category != null) 'category': category, + if (force != null) 'force': force, + if (level != null) 'level': level, + if (mechanic != null) 'mechanic': mechanic, + if (equipment != null) 'equipment': equipment, + if (primaryMuscles != null) 'primary_muscles': primaryMuscles, + if (secondaryMuscles != null) 'secondary_muscles': secondaryMuscles, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ActivitiesCompanion copyWith( + {Value? id, + Value? title, + Value? type, + Value? description, + Value? category, + Value? force, + Value? level, + Value? mechanic, + Value? equipment, + Value? primaryMuscles, + Value? secondaryMuscles, + Value? createdAt}) { + return ActivitiesCompanion( + id: id ?? this.id, + title: title ?? this.title, + type: type ?? this.type, + description: description ?? this.description, + category: category ?? this.category, + force: force ?? this.force, + level: level ?? this.level, + mechanic: mechanic ?? this.mechanic, + equipment: equipment ?? this.equipment, + primaryMuscles: primaryMuscles ?? this.primaryMuscles, + secondaryMuscles: secondaryMuscles ?? this.secondaryMuscles, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (type.present) { + map['type'] = Variable(type.value); + } + if (description.present) { + map['body'] = Variable(description.value); + } + if (category.present) { + map['category'] = Variable(category.value); + } + if (force.present) { + map['force'] = Variable(force.value); + } + if (level.present) { + map['level'] = Variable(level.value); + } + if (mechanic.present) { + map['mechanic'] = Variable(mechanic.value); + } + if (equipment.present) { + map['equipment'] = Variable(equipment.value); + } + if (primaryMuscles.present) { + map['primary_muscles'] = Variable(primaryMuscles.value); + } + if (secondaryMuscles.present) { + map['secondary_muscles'] = Variable(secondaryMuscles.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ActivitiesCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('type: $type, ') + ..write('description: $description, ') + ..write('category: $category, ') + ..write('force: $force, ') + ..write('level: $level, ') + ..write('mechanic: $mechanic, ') + ..write('equipment: $equipment, ') + ..write('primaryMuscles: $primaryMuscles, ') + ..write('secondaryMuscles: $secondaryMuscles, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class SessionActivities extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + SessionActivities(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn sessionId = GeneratedColumn( + 'session_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES sessions (id) ON DELETE CASCADE')); + late final GeneratedColumn activityId = GeneratedColumn( + 'activity_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES activities (id) ON DELETE CASCADE')); + late final GeneratedColumn position = GeneratedColumn( + 'position', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn results = GeneratedColumn( + 'results', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, sessionId, activityId, position, results, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'session_activities'; + @override + Set get $primaryKey => {id}; + @override + SessionActivitiesData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return SessionActivitiesData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + sessionId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}session_id'])!, + activityId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}activity_id'])!, + position: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}position'])!, + results: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}results']), + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + SessionActivities createAlias(String alias) { + return SessionActivities(attachedDatabase, alias); + } +} + +class SessionActivitiesData extends DataClass + implements Insertable { + final int id; + final int sessionId; + final int activityId; + final int position; + final String? results; + final DateTime createdAt; + const SessionActivitiesData( + {required this.id, + required this.sessionId, + required this.activityId, + required this.position, + this.results, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['session_id'] = Variable(sessionId); + map['activity_id'] = Variable(activityId); + map['position'] = Variable(position); + if (!nullToAbsent || results != null) { + map['results'] = Variable(results); + } + map['created_at'] = Variable(createdAt); + return map; + } + + SessionActivitiesCompanion toCompanion(bool nullToAbsent) { + return SessionActivitiesCompanion( + id: Value(id), + sessionId: Value(sessionId), + activityId: Value(activityId), + position: Value(position), + results: results == null && nullToAbsent + ? const Value.absent() + : Value(results), + createdAt: Value(createdAt), + ); + } + + factory SessionActivitiesData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return SessionActivitiesData( + id: serializer.fromJson(json['id']), + sessionId: serializer.fromJson(json['sessionId']), + activityId: serializer.fromJson(json['activityId']), + position: serializer.fromJson(json['position']), + results: serializer.fromJson(json['results']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'sessionId': serializer.toJson(sessionId), + 'activityId': serializer.toJson(activityId), + 'position': serializer.toJson(position), + 'results': serializer.toJson(results), + 'createdAt': serializer.toJson(createdAt), + }; + } + + SessionActivitiesData copyWith( + {int? id, + int? sessionId, + int? activityId, + int? position, + Value results = const Value.absent(), + DateTime? createdAt}) => + SessionActivitiesData( + id: id ?? this.id, + sessionId: sessionId ?? this.sessionId, + activityId: activityId ?? this.activityId, + position: position ?? this.position, + results: results.present ? results.value : this.results, + createdAt: createdAt ?? this.createdAt, + ); + SessionActivitiesData copyWithCompanion(SessionActivitiesCompanion data) { + return SessionActivitiesData( + id: data.id.present ? data.id.value : this.id, + sessionId: data.sessionId.present ? data.sessionId.value : this.sessionId, + activityId: + data.activityId.present ? data.activityId.value : this.activityId, + position: data.position.present ? data.position.value : this.position, + results: data.results.present ? data.results.value : this.results, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('SessionActivitiesData(') + ..write('id: $id, ') + ..write('sessionId: $sessionId, ') + ..write('activityId: $activityId, ') + ..write('position: $position, ') + ..write('results: $results, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(id, sessionId, activityId, position, results, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is SessionActivitiesData && + other.id == this.id && + other.sessionId == this.sessionId && + other.activityId == this.activityId && + other.position == this.position && + other.results == this.results && + other.createdAt == this.createdAt); +} + +class SessionActivitiesCompanion + extends UpdateCompanion { + final Value id; + final Value sessionId; + final Value activityId; + final Value position; + final Value results; + final Value createdAt; + const SessionActivitiesCompanion({ + this.id = const Value.absent(), + this.sessionId = const Value.absent(), + this.activityId = const Value.absent(), + this.position = const Value.absent(), + this.results = const Value.absent(), + this.createdAt = const Value.absent(), + }); + SessionActivitiesCompanion.insert({ + this.id = const Value.absent(), + required int sessionId, + required int activityId, + required int position, + this.results = const Value.absent(), + this.createdAt = const Value.absent(), + }) : sessionId = Value(sessionId), + activityId = Value(activityId), + position = Value(position); + static Insertable custom({ + Expression? id, + Expression? sessionId, + Expression? activityId, + Expression? position, + Expression? results, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (sessionId != null) 'session_id': sessionId, + if (activityId != null) 'activity_id': activityId, + if (position != null) 'position': position, + if (results != null) 'results': results, + if (createdAt != null) 'created_at': createdAt, + }); + } + + SessionActivitiesCompanion copyWith( + {Value? id, + Value? sessionId, + Value? activityId, + Value? position, + Value? results, + Value? createdAt}) { + return SessionActivitiesCompanion( + id: id ?? this.id, + sessionId: sessionId ?? this.sessionId, + activityId: activityId ?? this.activityId, + position: position ?? this.position, + results: results ?? this.results, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (sessionId.present) { + map['session_id'] = Variable(sessionId.value); + } + if (activityId.present) { + map['activity_id'] = Variable(activityId.value); + } + if (position.present) { + map['position'] = Variable(position.value); + } + if (results.present) { + map['results'] = Variable(results.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('SessionActivitiesCompanion(') + ..write('id: $id, ') + ..write('sessionId: $sessionId, ') + ..write('activityId: $activityId, ') + ..write('position: $position, ') + ..write('results: $results, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class Actions extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + Actions(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 64), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn description = GeneratedColumn( + 'body', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn totalSets = GeneratedColumn( + 'total_sets', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn totalReps = GeneratedColumn( + 'total_reps', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 1, maxTextLength: 32), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn restBeforeSets = GeneratedColumn( + 'rest_before_sets', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn restBetweenSets = GeneratedColumn( + 'rest_between_sets', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn restBetweenReps = GeneratedColumn( + 'rest_between_reps', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn restAfterSets = GeneratedColumn( + 'rest_after_sets', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn repType = GeneratedColumn( + 'rep_type', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn repLength = GeneratedColumn( + 'rep_length', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn repWeights = GeneratedColumn( + 'rep_weights', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn setWeights = GeneratedColumn( + 'set_weights', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn isAlternating = GeneratedColumn( + 'is_alternating', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("is_alternating" IN (0, 1))'), + defaultValue: Variable(false)); + late final GeneratedColumn tempo = GeneratedColumn( + 'tempo', aliasedName, true, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 6, maxTextLength: 36), + type: DriftSqlType.string, + requiredDuringInsert: false); + late final GeneratedColumn status = GeneratedColumn( + 'status', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: Variable(ActionStatus.pending.toString())); + late final GeneratedColumn state = GeneratedColumn( + 'state', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn set = GeneratedColumn( + 'set', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => [ + id, + title, + description, + totalSets, + totalReps, + restBeforeSets, + restBetweenSets, + restBetweenReps, + restAfterSets, + repType, + repLength, + repWeights, + setWeights, + isAlternating, + tempo, + status, + state, + set, + createdAt + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'actions'; + @override + Set get $primaryKey => {id}; + @override + ActionsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ActionsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + description: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body'])!, + totalSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}total_sets'])!, + totalReps: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}total_reps'])!, + restBeforeSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_before_sets']), + restBetweenSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_between_sets']), + restBetweenReps: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_between_reps']), + restAfterSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_after_sets']), + repType: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}rep_type'])!, + repLength: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rep_length']), + repWeights: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}rep_weights']), + setWeights: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}set_weights']), + isAlternating: attachedDatabase.typeMapping + .read(DriftSqlType.bool, data['${effectivePrefix}is_alternating'])!, + tempo: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}tempo']), + status: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}status'])!, + state: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}state']), + set: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}set'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + Actions createAlias(String alias) { + return Actions(attachedDatabase, alias); + } +} + +class ActionsData extends DataClass implements Insertable { + final int id; + final String title; + final String description; + final int totalSets; + final String totalReps; + final int? restBeforeSets; + final int? restBetweenSets; + final int? restBetweenReps; + final int? restAfterSets; + final String repType; + final int? repLength; + final String? repWeights; + final String? setWeights; + final bool isAlternating; + final String? tempo; + final String status; + final String? state; + final String set; + final DateTime createdAt; + const ActionsData( + {required this.id, + required this.title, + required this.description, + required this.totalSets, + required this.totalReps, + this.restBeforeSets, + this.restBetweenSets, + this.restBetweenReps, + this.restAfterSets, + required this.repType, + this.repLength, + this.repWeights, + this.setWeights, + required this.isAlternating, + this.tempo, + required this.status, + this.state, + required this.set, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + map['body'] = Variable(description); + map['total_sets'] = Variable(totalSets); + map['total_reps'] = Variable(totalReps); + if (!nullToAbsent || restBeforeSets != null) { + map['rest_before_sets'] = Variable(restBeforeSets); + } + if (!nullToAbsent || restBetweenSets != null) { + map['rest_between_sets'] = Variable(restBetweenSets); + } + if (!nullToAbsent || restBetweenReps != null) { + map['rest_between_reps'] = Variable(restBetweenReps); + } + if (!nullToAbsent || restAfterSets != null) { + map['rest_after_sets'] = Variable(restAfterSets); + } + map['rep_type'] = Variable(repType); + if (!nullToAbsent || repLength != null) { + map['rep_length'] = Variable(repLength); + } + if (!nullToAbsent || repWeights != null) { + map['rep_weights'] = Variable(repWeights); + } + if (!nullToAbsent || setWeights != null) { + map['set_weights'] = Variable(setWeights); + } + map['is_alternating'] = Variable(isAlternating); + if (!nullToAbsent || tempo != null) { + map['tempo'] = Variable(tempo); + } + map['status'] = Variable(status); + if (!nullToAbsent || state != null) { + map['state'] = Variable(state); + } + map['set'] = Variable(set); + map['created_at'] = Variable(createdAt); + return map; + } + + ActionsCompanion toCompanion(bool nullToAbsent) { + return ActionsCompanion( + id: Value(id), + title: Value(title), + description: Value(description), + totalSets: Value(totalSets), + totalReps: Value(totalReps), + restBeforeSets: restBeforeSets == null && nullToAbsent + ? const Value.absent() + : Value(restBeforeSets), + restBetweenSets: restBetweenSets == null && nullToAbsent + ? const Value.absent() + : Value(restBetweenSets), + restBetweenReps: restBetweenReps == null && nullToAbsent + ? const Value.absent() + : Value(restBetweenReps), + restAfterSets: restAfterSets == null && nullToAbsent + ? const Value.absent() + : Value(restAfterSets), + repType: Value(repType), + repLength: repLength == null && nullToAbsent + ? const Value.absent() + : Value(repLength), + repWeights: repWeights == null && nullToAbsent + ? const Value.absent() + : Value(repWeights), + setWeights: setWeights == null && nullToAbsent + ? const Value.absent() + : Value(setWeights), + isAlternating: Value(isAlternating), + tempo: + tempo == null && nullToAbsent ? const Value.absent() : Value(tempo), + status: Value(status), + state: + state == null && nullToAbsent ? const Value.absent() : Value(state), + set: Value(set), + createdAt: Value(createdAt), + ); + } + + factory ActionsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ActionsData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + description: serializer.fromJson(json['description']), + totalSets: serializer.fromJson(json['totalSets']), + totalReps: serializer.fromJson(json['totalReps']), + restBeforeSets: serializer.fromJson(json['restBeforeSets']), + restBetweenSets: serializer.fromJson(json['restBetweenSets']), + restBetweenReps: serializer.fromJson(json['restBetweenReps']), + restAfterSets: serializer.fromJson(json['restAfterSets']), + repType: serializer.fromJson(json['repType']), + repLength: serializer.fromJson(json['repLength']), + repWeights: serializer.fromJson(json['repWeights']), + setWeights: serializer.fromJson(json['setWeights']), + isAlternating: serializer.fromJson(json['isAlternating']), + tempo: serializer.fromJson(json['tempo']), + status: serializer.fromJson(json['status']), + state: serializer.fromJson(json['state']), + set: serializer.fromJson(json['set']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'description': serializer.toJson(description), + 'totalSets': serializer.toJson(totalSets), + 'totalReps': serializer.toJson(totalReps), + 'restBeforeSets': serializer.toJson(restBeforeSets), + 'restBetweenSets': serializer.toJson(restBetweenSets), + 'restBetweenReps': serializer.toJson(restBetweenReps), + 'restAfterSets': serializer.toJson(restAfterSets), + 'repType': serializer.toJson(repType), + 'repLength': serializer.toJson(repLength), + 'repWeights': serializer.toJson(repWeights), + 'setWeights': serializer.toJson(setWeights), + 'isAlternating': serializer.toJson(isAlternating), + 'tempo': serializer.toJson(tempo), + 'status': serializer.toJson(status), + 'state': serializer.toJson(state), + 'set': serializer.toJson(set), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ActionsData copyWith( + {int? id, + String? title, + String? description, + int? totalSets, + String? totalReps, + Value restBeforeSets = const Value.absent(), + Value restBetweenSets = const Value.absent(), + Value restBetweenReps = const Value.absent(), + Value restAfterSets = const Value.absent(), + String? repType, + Value repLength = const Value.absent(), + Value repWeights = const Value.absent(), + Value setWeights = const Value.absent(), + bool? isAlternating, + Value tempo = const Value.absent(), + String? status, + Value state = const Value.absent(), + String? set, + DateTime? createdAt}) => + ActionsData( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + totalSets: totalSets ?? this.totalSets, + totalReps: totalReps ?? this.totalReps, + restBeforeSets: + restBeforeSets.present ? restBeforeSets.value : this.restBeforeSets, + restBetweenSets: restBetweenSets.present + ? restBetweenSets.value + : this.restBetweenSets, + restBetweenReps: restBetweenReps.present + ? restBetweenReps.value + : this.restBetweenReps, + restAfterSets: + restAfterSets.present ? restAfterSets.value : this.restAfterSets, + repType: repType ?? this.repType, + repLength: repLength.present ? repLength.value : this.repLength, + repWeights: repWeights.present ? repWeights.value : this.repWeights, + setWeights: setWeights.present ? setWeights.value : this.setWeights, + isAlternating: isAlternating ?? this.isAlternating, + tempo: tempo.present ? tempo.value : this.tempo, + status: status ?? this.status, + state: state.present ? state.value : this.state, + set: set ?? this.set, + createdAt: createdAt ?? this.createdAt, + ); + ActionsData copyWithCompanion(ActionsCompanion data) { + return ActionsData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + description: + data.description.present ? data.description.value : this.description, + totalSets: data.totalSets.present ? data.totalSets.value : this.totalSets, + totalReps: data.totalReps.present ? data.totalReps.value : this.totalReps, + restBeforeSets: data.restBeforeSets.present + ? data.restBeforeSets.value + : this.restBeforeSets, + restBetweenSets: data.restBetweenSets.present + ? data.restBetweenSets.value + : this.restBetweenSets, + restBetweenReps: data.restBetweenReps.present + ? data.restBetweenReps.value + : this.restBetweenReps, + restAfterSets: data.restAfterSets.present + ? data.restAfterSets.value + : this.restAfterSets, + repType: data.repType.present ? data.repType.value : this.repType, + repLength: data.repLength.present ? data.repLength.value : this.repLength, + repWeights: + data.repWeights.present ? data.repWeights.value : this.repWeights, + setWeights: + data.setWeights.present ? data.setWeights.value : this.setWeights, + isAlternating: data.isAlternating.present + ? data.isAlternating.value + : this.isAlternating, + tempo: data.tempo.present ? data.tempo.value : this.tempo, + status: data.status.present ? data.status.value : this.status, + state: data.state.present ? data.state.value : this.state, + set: data.set.present ? data.set.value : this.set, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ActionsData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('totalSets: $totalSets, ') + ..write('totalReps: $totalReps, ') + ..write('restBeforeSets: $restBeforeSets, ') + ..write('restBetweenSets: $restBetweenSets, ') + ..write('restBetweenReps: $restBetweenReps, ') + ..write('restAfterSets: $restAfterSets, ') + ..write('repType: $repType, ') + ..write('repLength: $repLength, ') + ..write('repWeights: $repWeights, ') + ..write('setWeights: $setWeights, ') + ..write('isAlternating: $isAlternating, ') + ..write('tempo: $tempo, ') + ..write('status: $status, ') + ..write('state: $state, ') + ..write('set: $set, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash( + id, + title, + description, + totalSets, + totalReps, + restBeforeSets, + restBetweenSets, + restBetweenReps, + restAfterSets, + repType, + repLength, + repWeights, + setWeights, + isAlternating, + tempo, + status, + state, + set, + createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ActionsData && + other.id == this.id && + other.title == this.title && + other.description == this.description && + other.totalSets == this.totalSets && + other.totalReps == this.totalReps && + other.restBeforeSets == this.restBeforeSets && + other.restBetweenSets == this.restBetweenSets && + other.restBetweenReps == this.restBetweenReps && + other.restAfterSets == this.restAfterSets && + other.repType == this.repType && + other.repLength == this.repLength && + other.repWeights == this.repWeights && + other.setWeights == this.setWeights && + other.isAlternating == this.isAlternating && + other.tempo == this.tempo && + other.status == this.status && + other.state == this.state && + other.set == this.set && + other.createdAt == this.createdAt); +} + +class ActionsCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value description; + final Value totalSets; + final Value totalReps; + final Value restBeforeSets; + final Value restBetweenSets; + final Value restBetweenReps; + final Value restAfterSets; + final Value repType; + final Value repLength; + final Value repWeights; + final Value setWeights; + final Value isAlternating; + final Value tempo; + final Value status; + final Value state; + final Value set; + final Value createdAt; + const ActionsCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.description = const Value.absent(), + this.totalSets = const Value.absent(), + this.totalReps = const Value.absent(), + this.restBeforeSets = const Value.absent(), + this.restBetweenSets = const Value.absent(), + this.restBetweenReps = const Value.absent(), + this.restAfterSets = const Value.absent(), + this.repType = const Value.absent(), + this.repLength = const Value.absent(), + this.repWeights = const Value.absent(), + this.setWeights = const Value.absent(), + this.isAlternating = const Value.absent(), + this.tempo = const Value.absent(), + this.status = const Value.absent(), + this.state = const Value.absent(), + this.set = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ActionsCompanion.insert({ + this.id = const Value.absent(), + required String title, + required String description, + required int totalSets, + required String totalReps, + this.restBeforeSets = const Value.absent(), + this.restBetweenSets = const Value.absent(), + this.restBetweenReps = const Value.absent(), + this.restAfterSets = const Value.absent(), + required String repType, + this.repLength = const Value.absent(), + this.repWeights = const Value.absent(), + this.setWeights = const Value.absent(), + this.isAlternating = const Value.absent(), + this.tempo = const Value.absent(), + this.status = const Value.absent(), + this.state = const Value.absent(), + required String set, + this.createdAt = const Value.absent(), + }) : title = Value(title), + description = Value(description), + totalSets = Value(totalSets), + totalReps = Value(totalReps), + repType = Value(repType), + set = Value(set); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? description, + Expression? totalSets, + Expression? totalReps, + Expression? restBeforeSets, + Expression? restBetweenSets, + Expression? restBetweenReps, + Expression? restAfterSets, + Expression? repType, + Expression? repLength, + Expression? repWeights, + Expression? setWeights, + Expression? isAlternating, + Expression? tempo, + Expression? status, + Expression? state, + Expression? set, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (description != null) 'body': description, + if (totalSets != null) 'total_sets': totalSets, + if (totalReps != null) 'total_reps': totalReps, + if (restBeforeSets != null) 'rest_before_sets': restBeforeSets, + if (restBetweenSets != null) 'rest_between_sets': restBetweenSets, + if (restBetweenReps != null) 'rest_between_reps': restBetweenReps, + if (restAfterSets != null) 'rest_after_sets': restAfterSets, + if (repType != null) 'rep_type': repType, + if (repLength != null) 'rep_length': repLength, + if (repWeights != null) 'rep_weights': repWeights, + if (setWeights != null) 'set_weights': setWeights, + if (isAlternating != null) 'is_alternating': isAlternating, + if (tempo != null) 'tempo': tempo, + if (status != null) 'status': status, + if (state != null) 'state': state, + if (set != null) 'set': set, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ActionsCompanion copyWith( + {Value? id, + Value? title, + Value? description, + Value? totalSets, + Value? totalReps, + Value? restBeforeSets, + Value? restBetweenSets, + Value? restBetweenReps, + Value? restAfterSets, + Value? repType, + Value? repLength, + Value? repWeights, + Value? setWeights, + Value? isAlternating, + Value? tempo, + Value? status, + Value? state, + Value? set, + Value? createdAt}) { + return ActionsCompanion( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + totalSets: totalSets ?? this.totalSets, + totalReps: totalReps ?? this.totalReps, + restBeforeSets: restBeforeSets ?? this.restBeforeSets, + restBetweenSets: restBetweenSets ?? this.restBetweenSets, + restBetweenReps: restBetweenReps ?? this.restBetweenReps, + restAfterSets: restAfterSets ?? this.restAfterSets, + repType: repType ?? this.repType, + repLength: repLength ?? this.repLength, + repWeights: repWeights ?? this.repWeights, + setWeights: setWeights ?? this.setWeights, + isAlternating: isAlternating ?? this.isAlternating, + tempo: tempo ?? this.tempo, + status: status ?? this.status, + state: state ?? this.state, + set: set ?? this.set, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (description.present) { + map['body'] = Variable(description.value); + } + if (totalSets.present) { + map['total_sets'] = Variable(totalSets.value); + } + if (totalReps.present) { + map['total_reps'] = Variable(totalReps.value); + } + if (restBeforeSets.present) { + map['rest_before_sets'] = Variable(restBeforeSets.value); + } + if (restBetweenSets.present) { + map['rest_between_sets'] = Variable(restBetweenSets.value); + } + if (restBetweenReps.present) { + map['rest_between_reps'] = Variable(restBetweenReps.value); + } + if (restAfterSets.present) { + map['rest_after_sets'] = Variable(restAfterSets.value); + } + if (repType.present) { + map['rep_type'] = Variable(repType.value); + } + if (repLength.present) { + map['rep_length'] = Variable(repLength.value); + } + if (repWeights.present) { + map['rep_weights'] = Variable(repWeights.value); + } + if (setWeights.present) { + map['set_weights'] = Variable(setWeights.value); + } + if (isAlternating.present) { + map['is_alternating'] = Variable(isAlternating.value); + } + if (tempo.present) { + map['tempo'] = Variable(tempo.value); + } + if (status.present) { + map['status'] = Variable(status.value); + } + if (state.present) { + map['state'] = Variable(state.value); + } + if (set.present) { + map['set'] = Variable(set.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ActionsCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('totalSets: $totalSets, ') + ..write('totalReps: $totalReps, ') + ..write('restBeforeSets: $restBeforeSets, ') + ..write('restBetweenSets: $restBetweenSets, ') + ..write('restBetweenReps: $restBetweenReps, ') + ..write('restAfterSets: $restAfterSets, ') + ..write('repType: $repType, ') + ..write('repLength: $repLength, ') + ..write('repWeights: $repWeights, ') + ..write('setWeights: $setWeights, ') + ..write('isAlternating: $isAlternating, ') + ..write('tempo: $tempo, ') + ..write('status: $status, ') + ..write('state: $state, ') + ..write('set: $set, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class ActivityActions extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + ActivityActions(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn activityId = GeneratedColumn( + 'activity_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES activities (id) ON DELETE CASCADE')); + late final GeneratedColumn actionId = GeneratedColumn( + 'action_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES actions (id) ON DELETE CASCADE')); + late final GeneratedColumn position = GeneratedColumn( + 'position', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, activityId, actionId, position, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'activity_actions'; + @override + Set get $primaryKey => {id}; + @override + ActivityActionsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ActivityActionsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + activityId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}activity_id'])!, + actionId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}action_id'])!, + position: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}position'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + ActivityActions createAlias(String alias) { + return ActivityActions(attachedDatabase, alias); + } +} + +class ActivityActionsData extends DataClass + implements Insertable { + final int id; + final int activityId; + final int actionId; + final int position; + final DateTime createdAt; + const ActivityActionsData( + {required this.id, + required this.activityId, + required this.actionId, + required this.position, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['activity_id'] = Variable(activityId); + map['action_id'] = Variable(actionId); + map['position'] = Variable(position); + map['created_at'] = Variable(createdAt); + return map; + } + + ActivityActionsCompanion toCompanion(bool nullToAbsent) { + return ActivityActionsCompanion( + id: Value(id), + activityId: Value(activityId), + actionId: Value(actionId), + position: Value(position), + createdAt: Value(createdAt), + ); + } + + factory ActivityActionsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ActivityActionsData( + id: serializer.fromJson(json['id']), + activityId: serializer.fromJson(json['activityId']), + actionId: serializer.fromJson(json['actionId']), + position: serializer.fromJson(json['position']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'activityId': serializer.toJson(activityId), + 'actionId': serializer.toJson(actionId), + 'position': serializer.toJson(position), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ActivityActionsData copyWith( + {int? id, + int? activityId, + int? actionId, + int? position, + DateTime? createdAt}) => + ActivityActionsData( + id: id ?? this.id, + activityId: activityId ?? this.activityId, + actionId: actionId ?? this.actionId, + position: position ?? this.position, + createdAt: createdAt ?? this.createdAt, + ); + ActivityActionsData copyWithCompanion(ActivityActionsCompanion data) { + return ActivityActionsData( + id: data.id.present ? data.id.value : this.id, + activityId: + data.activityId.present ? data.activityId.value : this.activityId, + actionId: data.actionId.present ? data.actionId.value : this.actionId, + position: data.position.present ? data.position.value : this.position, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ActivityActionsData(') + ..write('id: $id, ') + ..write('activityId: $activityId, ') + ..write('actionId: $actionId, ') + ..write('position: $position, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(id, activityId, actionId, position, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ActivityActionsData && + other.id == this.id && + other.activityId == this.activityId && + other.actionId == this.actionId && + other.position == this.position && + other.createdAt == this.createdAt); +} + +class ActivityActionsCompanion extends UpdateCompanion { + final Value id; + final Value activityId; + final Value actionId; + final Value position; + final Value createdAt; + const ActivityActionsCompanion({ + this.id = const Value.absent(), + this.activityId = const Value.absent(), + this.actionId = const Value.absent(), + this.position = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ActivityActionsCompanion.insert({ + this.id = const Value.absent(), + required int activityId, + required int actionId, + required int position, + this.createdAt = const Value.absent(), + }) : activityId = Value(activityId), + actionId = Value(actionId), + position = Value(position); + static Insertable custom({ + Expression? id, + Expression? activityId, + Expression? actionId, + Expression? position, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (activityId != null) 'activity_id': activityId, + if (actionId != null) 'action_id': actionId, + if (position != null) 'position': position, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ActivityActionsCompanion copyWith( + {Value? id, + Value? activityId, + Value? actionId, + Value? position, + Value? createdAt}) { + return ActivityActionsCompanion( + id: id ?? this.id, + activityId: activityId ?? this.activityId, + actionId: actionId ?? this.actionId, + position: position ?? this.position, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (activityId.present) { + map['activity_id'] = Variable(activityId.value); + } + if (actionId.present) { + map['action_id'] = Variable(actionId.value); + } + if (position.present) { + map['position'] = Variable(position.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ActivityActionsCompanion(') + ..write('id: $id, ') + ..write('activityId: $activityId, ') + ..write('actionId: $actionId, ') + ..write('position: $position, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class MediaItems extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + MediaItems(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 64), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn description = GeneratedColumn( + 'body', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn reference = GeneratedColumn( + 'reference', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn type = GeneratedColumn( + 'type', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, title, description, reference, type, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'media_items'; + @override + Set get $primaryKey => {id}; + @override + MediaItemsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return MediaItemsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + description: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body'])!, + reference: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}reference'])!, + type: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}type'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + MediaItems createAlias(String alias) { + return MediaItems(attachedDatabase, alias); + } +} + +class MediaItemsData extends DataClass implements Insertable { + final int id; + final String title; + final String description; + final String reference; + final String type; + final DateTime createdAt; + const MediaItemsData( + {required this.id, + required this.title, + required this.description, + required this.reference, + required this.type, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + map['body'] = Variable(description); + map['reference'] = Variable(reference); + map['type'] = Variable(type); + map['created_at'] = Variable(createdAt); + return map; + } + + MediaItemsCompanion toCompanion(bool nullToAbsent) { + return MediaItemsCompanion( + id: Value(id), + title: Value(title), + description: Value(description), + reference: Value(reference), + type: Value(type), + createdAt: Value(createdAt), + ); + } + + factory MediaItemsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return MediaItemsData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + description: serializer.fromJson(json['description']), + reference: serializer.fromJson(json['reference']), + type: serializer.fromJson(json['type']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'description': serializer.toJson(description), + 'reference': serializer.toJson(reference), + 'type': serializer.toJson(type), + 'createdAt': serializer.toJson(createdAt), + }; + } + + MediaItemsData copyWith( + {int? id, + String? title, + String? description, + String? reference, + String? type, + DateTime? createdAt}) => + MediaItemsData( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + reference: reference ?? this.reference, + type: type ?? this.type, + createdAt: createdAt ?? this.createdAt, + ); + MediaItemsData copyWithCompanion(MediaItemsCompanion data) { + return MediaItemsData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + description: + data.description.present ? data.description.value : this.description, + reference: data.reference.present ? data.reference.value : this.reference, + type: data.type.present ? data.type.value : this.type, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('MediaItemsData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('reference: $reference, ') + ..write('type: $type, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(id, title, description, reference, type, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is MediaItemsData && + other.id == this.id && + other.title == this.title && + other.description == this.description && + other.reference == this.reference && + other.type == this.type && + other.createdAt == this.createdAt); +} + +class MediaItemsCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value description; + final Value reference; + final Value type; + final Value createdAt; + const MediaItemsCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.description = const Value.absent(), + this.reference = const Value.absent(), + this.type = const Value.absent(), + this.createdAt = const Value.absent(), + }); + MediaItemsCompanion.insert({ + this.id = const Value.absent(), + required String title, + required String description, + required String reference, + required String type, + this.createdAt = const Value.absent(), + }) : title = Value(title), + description = Value(description), + reference = Value(reference), + type = Value(type); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? description, + Expression? reference, + Expression? type, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (description != null) 'body': description, + if (reference != null) 'reference': reference, + if (type != null) 'type': type, + if (createdAt != null) 'created_at': createdAt, + }); + } + + MediaItemsCompanion copyWith( + {Value? id, + Value? title, + Value? description, + Value? reference, + Value? type, + Value? createdAt}) { + return MediaItemsCompanion( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + reference: reference ?? this.reference, + type: type ?? this.type, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (description.present) { + map['body'] = Variable(description.value); + } + if (reference.present) { + map['reference'] = Variable(reference.value); + } + if (type.present) { + map['type'] = Variable(type.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('MediaItemsCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('reference: $reference, ') + ..write('type: $type, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class ObjectMediaItems extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + ObjectMediaItems(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn objectId = GeneratedColumn( + 'object_id', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn objectType = GeneratedColumn( + 'object_type', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn mediaId = GeneratedColumn( + 'media_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES media_items (id) ON DELETE CASCADE')); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, objectId, objectType, mediaId, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'object_media_items'; + @override + Set get $primaryKey => {id}; + @override + ObjectMediaItemsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ObjectMediaItemsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + objectId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}object_id'])!, + objectType: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}object_type'])!, + mediaId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}media_id'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + ObjectMediaItems createAlias(String alias) { + return ObjectMediaItems(attachedDatabase, alias); + } +} + +class ObjectMediaItemsData extends DataClass + implements Insertable { + final int id; + final int objectId; + final String objectType; + final int mediaId; + final DateTime createdAt; + const ObjectMediaItemsData( + {required this.id, + required this.objectId, + required this.objectType, + required this.mediaId, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['object_id'] = Variable(objectId); + map['object_type'] = Variable(objectType); + map['media_id'] = Variable(mediaId); + map['created_at'] = Variable(createdAt); + return map; + } + + ObjectMediaItemsCompanion toCompanion(bool nullToAbsent) { + return ObjectMediaItemsCompanion( + id: Value(id), + objectId: Value(objectId), + objectType: Value(objectType), + mediaId: Value(mediaId), + createdAt: Value(createdAt), + ); + } + + factory ObjectMediaItemsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ObjectMediaItemsData( + id: serializer.fromJson(json['id']), + objectId: serializer.fromJson(json['objectId']), + objectType: serializer.fromJson(json['objectType']), + mediaId: serializer.fromJson(json['mediaId']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'objectId': serializer.toJson(objectId), + 'objectType': serializer.toJson(objectType), + 'mediaId': serializer.toJson(mediaId), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ObjectMediaItemsData copyWith( + {int? id, + int? objectId, + String? objectType, + int? mediaId, + DateTime? createdAt}) => + ObjectMediaItemsData( + id: id ?? this.id, + objectId: objectId ?? this.objectId, + objectType: objectType ?? this.objectType, + mediaId: mediaId ?? this.mediaId, + createdAt: createdAt ?? this.createdAt, + ); + ObjectMediaItemsData copyWithCompanion(ObjectMediaItemsCompanion data) { + return ObjectMediaItemsData( + id: data.id.present ? data.id.value : this.id, + objectId: data.objectId.present ? data.objectId.value : this.objectId, + objectType: + data.objectType.present ? data.objectType.value : this.objectType, + mediaId: data.mediaId.present ? data.mediaId.value : this.mediaId, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ObjectMediaItemsData(') + ..write('id: $id, ') + ..write('objectId: $objectId, ') + ..write('objectType: $objectType, ') + ..write('mediaId: $mediaId, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(id, objectId, objectType, mediaId, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ObjectMediaItemsData && + other.id == this.id && + other.objectId == this.objectId && + other.objectType == this.objectType && + other.mediaId == this.mediaId && + other.createdAt == this.createdAt); +} + +class ObjectMediaItemsCompanion extends UpdateCompanion { + final Value id; + final Value objectId; + final Value objectType; + final Value mediaId; + final Value createdAt; + const ObjectMediaItemsCompanion({ + this.id = const Value.absent(), + this.objectId = const Value.absent(), + this.objectType = const Value.absent(), + this.mediaId = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ObjectMediaItemsCompanion.insert({ + this.id = const Value.absent(), + required int objectId, + required String objectType, + required int mediaId, + this.createdAt = const Value.absent(), + }) : objectId = Value(objectId), + objectType = Value(objectType), + mediaId = Value(mediaId); + static Insertable custom({ + Expression? id, + Expression? objectId, + Expression? objectType, + Expression? mediaId, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (objectId != null) 'object_id': objectId, + if (objectType != null) 'object_type': objectType, + if (mediaId != null) 'media_id': mediaId, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ObjectMediaItemsCompanion copyWith( + {Value? id, + Value? objectId, + Value? objectType, + Value? mediaId, + Value? createdAt}) { + return ObjectMediaItemsCompanion( + id: id ?? this.id, + objectId: objectId ?? this.objectId, + objectType: objectType ?? this.objectType, + mediaId: mediaId ?? this.mediaId, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (objectId.present) { + map['object_id'] = Variable(objectId.value); + } + if (objectType.present) { + map['object_type'] = Variable(objectType.value); + } + if (mediaId.present) { + map['media_id'] = Variable(mediaId.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ObjectMediaItemsCompanion(') + ..write('id: $id, ') + ..write('objectId: $objectId, ') + ..write('objectType: $objectType, ') + ..write('mediaId: $mediaId, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class DatabaseAtV25 extends GeneratedDatabase { + DatabaseAtV25(QueryExecutor e) : super(e); + late final Sessions sessions = Sessions(this); + late final Activities activities = Activities(this); + late final SessionActivities sessionActivities = SessionActivities(this); + late final Actions actions = Actions(this); + late final ActivityActions activityActions = ActivityActions(this); + late final MediaItems mediaItems = MediaItems(this); + late final ObjectMediaItems objectMediaItems = ObjectMediaItems(this); + @override + Iterable> get allTables => + allSchemaEntities.whereType>(); + @override + List get allSchemaEntities => [ + sessions, + activities, + sessionActivities, + actions, + activityActions, + mediaItems, + objectMediaItems + ]; + @override + int get schemaVersion => 25; +} diff --git a/test/drift/sendtrain/generated/schema_v26.dart b/test/drift/sendtrain/generated/schema_v26.dart new file mode 100644 index 0000000..9f320e7 --- /dev/null +++ b/test/drift/sendtrain/generated/schema_v26.dart @@ -0,0 +1,2701 @@ +// dart format width=80 +// GENERATED CODE, DO NOT EDIT BY HAND. +// ignore_for_file: type=lint +import 'package:drift/drift.dart'; + +class Sessions extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + Sessions(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 32), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn content = GeneratedColumn( + 'body', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn status = GeneratedColumn( + 'status', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn achievements = GeneratedColumn( + 'achievements', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn address = GeneratedColumn( + 'address', aliasedName, true, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 256), + type: DriftSqlType.string, + requiredDuringInsert: false); + late final GeneratedColumn date = GeneratedColumn( + 'date', aliasedName, true, + type: DriftSqlType.dateTime, requiredDuringInsert: false); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, title, content, status, achievements, address, date, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'sessions'; + @override + Set get $primaryKey => {id}; + @override + SessionsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return SessionsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + content: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body'])!, + status: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}status'])!, + achievements: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}achievements']), + address: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}address']), + date: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}date']), + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + Sessions createAlias(String alias) { + return Sessions(attachedDatabase, alias); + } +} + +class SessionsData extends DataClass implements Insertable { + final int id; + final String title; + final String content; + final String status; + final String? achievements; + final String? address; + final DateTime? date; + final DateTime createdAt; + const SessionsData( + {required this.id, + required this.title, + required this.content, + required this.status, + this.achievements, + this.address, + this.date, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + map['body'] = Variable(content); + map['status'] = Variable(status); + if (!nullToAbsent || achievements != null) { + map['achievements'] = Variable(achievements); + } + if (!nullToAbsent || address != null) { + map['address'] = Variable(address); + } + if (!nullToAbsent || date != null) { + map['date'] = Variable(date); + } + map['created_at'] = Variable(createdAt); + return map; + } + + SessionsCompanion toCompanion(bool nullToAbsent) { + return SessionsCompanion( + id: Value(id), + title: Value(title), + content: Value(content), + status: Value(status), + achievements: achievements == null && nullToAbsent + ? const Value.absent() + : Value(achievements), + address: address == null && nullToAbsent + ? const Value.absent() + : Value(address), + date: date == null && nullToAbsent ? const Value.absent() : Value(date), + createdAt: Value(createdAt), + ); + } + + factory SessionsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return SessionsData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + content: serializer.fromJson(json['content']), + status: serializer.fromJson(json['status']), + achievements: serializer.fromJson(json['achievements']), + address: serializer.fromJson(json['address']), + date: serializer.fromJson(json['date']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'content': serializer.toJson(content), + 'status': serializer.toJson(status), + 'achievements': serializer.toJson(achievements), + 'address': serializer.toJson(address), + 'date': serializer.toJson(date), + 'createdAt': serializer.toJson(createdAt), + }; + } + + SessionsData copyWith( + {int? id, + String? title, + String? content, + String? status, + Value achievements = const Value.absent(), + Value address = const Value.absent(), + Value date = const Value.absent(), + DateTime? createdAt}) => + SessionsData( + id: id ?? this.id, + title: title ?? this.title, + content: content ?? this.content, + status: status ?? this.status, + achievements: + achievements.present ? achievements.value : this.achievements, + address: address.present ? address.value : this.address, + date: date.present ? date.value : this.date, + createdAt: createdAt ?? this.createdAt, + ); + SessionsData copyWithCompanion(SessionsCompanion data) { + return SessionsData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + content: data.content.present ? data.content.value : this.content, + status: data.status.present ? data.status.value : this.status, + achievements: data.achievements.present + ? data.achievements.value + : this.achievements, + address: data.address.present ? data.address.value : this.address, + date: data.date.present ? data.date.value : this.date, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('SessionsData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('content: $content, ') + ..write('status: $status, ') + ..write('achievements: $achievements, ') + ..write('address: $address, ') + ..write('date: $date, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash( + id, title, content, status, achievements, address, date, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is SessionsData && + other.id == this.id && + other.title == this.title && + other.content == this.content && + other.status == this.status && + other.achievements == this.achievements && + other.address == this.address && + other.date == this.date && + other.createdAt == this.createdAt); +} + +class SessionsCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value content; + final Value status; + final Value achievements; + final Value address; + final Value date; + final Value createdAt; + const SessionsCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.content = const Value.absent(), + this.status = const Value.absent(), + this.achievements = const Value.absent(), + this.address = const Value.absent(), + this.date = const Value.absent(), + this.createdAt = const Value.absent(), + }); + SessionsCompanion.insert({ + this.id = const Value.absent(), + required String title, + required String content, + required String status, + this.achievements = const Value.absent(), + this.address = const Value.absent(), + this.date = const Value.absent(), + this.createdAt = const Value.absent(), + }) : title = Value(title), + content = Value(content), + status = Value(status); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? content, + Expression? status, + Expression? achievements, + Expression? address, + Expression? date, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (content != null) 'body': content, + if (status != null) 'status': status, + if (achievements != null) 'achievements': achievements, + if (address != null) 'address': address, + if (date != null) 'date': date, + if (createdAt != null) 'created_at': createdAt, + }); + } + + SessionsCompanion copyWith( + {Value? id, + Value? title, + Value? content, + Value? status, + Value? achievements, + Value? address, + Value? date, + Value? createdAt}) { + return SessionsCompanion( + id: id ?? this.id, + title: title ?? this.title, + content: content ?? this.content, + status: status ?? this.status, + achievements: achievements ?? this.achievements, + address: address ?? this.address, + date: date ?? this.date, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (content.present) { + map['body'] = Variable(content.value); + } + if (status.present) { + map['status'] = Variable(status.value); + } + if (achievements.present) { + map['achievements'] = Variable(achievements.value); + } + if (address.present) { + map['address'] = Variable(address.value); + } + if (date.present) { + map['date'] = Variable(date.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('SessionsCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('content: $content, ') + ..write('status: $status, ') + ..write('achievements: $achievements, ') + ..write('address: $address, ') + ..write('date: $date, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class Activities extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + Activities(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 100), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn type = GeneratedColumn( + 'type', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn description = GeneratedColumn( + 'body', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn category = GeneratedColumn( + 'category', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn force = GeneratedColumn( + 'force', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn level = GeneratedColumn( + 'level', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn mechanic = GeneratedColumn( + 'mechanic', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn equipment = GeneratedColumn( + 'equipment', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn primaryMuscles = GeneratedColumn( + 'primary_muscles', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn secondaryMuscles = GeneratedColumn( + 'secondary_muscles', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => [ + id, + title, + type, + description, + category, + force, + level, + mechanic, + equipment, + primaryMuscles, + secondaryMuscles, + createdAt + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'activities'; + @override + Set get $primaryKey => {id}; + @override + ActivitiesData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ActivitiesData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + type: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}type']), + description: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body']), + category: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}category']), + force: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}force']), + level: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}level']), + mechanic: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}mechanic']), + equipment: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}equipment']), + primaryMuscles: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}primary_muscles']), + secondaryMuscles: attachedDatabase.typeMapping.read( + DriftSqlType.string, data['${effectivePrefix}secondary_muscles']), + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + Activities createAlias(String alias) { + return Activities(attachedDatabase, alias); + } +} + +class ActivitiesData extends DataClass implements Insertable { + final int id; + final String title; + final String? type; + final String? description; + final String? category; + final String? force; + final String? level; + final String? mechanic; + final String? equipment; + final String? primaryMuscles; + final String? secondaryMuscles; + final DateTime createdAt; + const ActivitiesData( + {required this.id, + required this.title, + this.type, + this.description, + this.category, + this.force, + this.level, + this.mechanic, + this.equipment, + this.primaryMuscles, + this.secondaryMuscles, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + if (!nullToAbsent || type != null) { + map['type'] = Variable(type); + } + if (!nullToAbsent || description != null) { + map['body'] = Variable(description); + } + if (!nullToAbsent || category != null) { + map['category'] = Variable(category); + } + if (!nullToAbsent || force != null) { + map['force'] = Variable(force); + } + if (!nullToAbsent || level != null) { + map['level'] = Variable(level); + } + if (!nullToAbsent || mechanic != null) { + map['mechanic'] = Variable(mechanic); + } + if (!nullToAbsent || equipment != null) { + map['equipment'] = Variable(equipment); + } + if (!nullToAbsent || primaryMuscles != null) { + map['primary_muscles'] = Variable(primaryMuscles); + } + if (!nullToAbsent || secondaryMuscles != null) { + map['secondary_muscles'] = Variable(secondaryMuscles); + } + map['created_at'] = Variable(createdAt); + return map; + } + + ActivitiesCompanion toCompanion(bool nullToAbsent) { + return ActivitiesCompanion( + id: Value(id), + title: Value(title), + type: type == null && nullToAbsent ? const Value.absent() : Value(type), + description: description == null && nullToAbsent + ? const Value.absent() + : Value(description), + category: category == null && nullToAbsent + ? const Value.absent() + : Value(category), + force: + force == null && nullToAbsent ? const Value.absent() : Value(force), + level: + level == null && nullToAbsent ? const Value.absent() : Value(level), + mechanic: mechanic == null && nullToAbsent + ? const Value.absent() + : Value(mechanic), + equipment: equipment == null && nullToAbsent + ? const Value.absent() + : Value(equipment), + primaryMuscles: primaryMuscles == null && nullToAbsent + ? const Value.absent() + : Value(primaryMuscles), + secondaryMuscles: secondaryMuscles == null && nullToAbsent + ? const Value.absent() + : Value(secondaryMuscles), + createdAt: Value(createdAt), + ); + } + + factory ActivitiesData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ActivitiesData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + type: serializer.fromJson(json['type']), + description: serializer.fromJson(json['description']), + category: serializer.fromJson(json['category']), + force: serializer.fromJson(json['force']), + level: serializer.fromJson(json['level']), + mechanic: serializer.fromJson(json['mechanic']), + equipment: serializer.fromJson(json['equipment']), + primaryMuscles: serializer.fromJson(json['primaryMuscles']), + secondaryMuscles: serializer.fromJson(json['secondaryMuscles']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'type': serializer.toJson(type), + 'description': serializer.toJson(description), + 'category': serializer.toJson(category), + 'force': serializer.toJson(force), + 'level': serializer.toJson(level), + 'mechanic': serializer.toJson(mechanic), + 'equipment': serializer.toJson(equipment), + 'primaryMuscles': serializer.toJson(primaryMuscles), + 'secondaryMuscles': serializer.toJson(secondaryMuscles), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ActivitiesData copyWith( + {int? id, + String? title, + Value type = const Value.absent(), + Value description = const Value.absent(), + Value category = const Value.absent(), + Value force = const Value.absent(), + Value level = const Value.absent(), + Value mechanic = const Value.absent(), + Value equipment = const Value.absent(), + Value primaryMuscles = const Value.absent(), + Value secondaryMuscles = const Value.absent(), + DateTime? createdAt}) => + ActivitiesData( + id: id ?? this.id, + title: title ?? this.title, + type: type.present ? type.value : this.type, + description: description.present ? description.value : this.description, + category: category.present ? category.value : this.category, + force: force.present ? force.value : this.force, + level: level.present ? level.value : this.level, + mechanic: mechanic.present ? mechanic.value : this.mechanic, + equipment: equipment.present ? equipment.value : this.equipment, + primaryMuscles: + primaryMuscles.present ? primaryMuscles.value : this.primaryMuscles, + secondaryMuscles: secondaryMuscles.present + ? secondaryMuscles.value + : this.secondaryMuscles, + createdAt: createdAt ?? this.createdAt, + ); + ActivitiesData copyWithCompanion(ActivitiesCompanion data) { + return ActivitiesData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + type: data.type.present ? data.type.value : this.type, + description: + data.description.present ? data.description.value : this.description, + category: data.category.present ? data.category.value : this.category, + force: data.force.present ? data.force.value : this.force, + level: data.level.present ? data.level.value : this.level, + mechanic: data.mechanic.present ? data.mechanic.value : this.mechanic, + equipment: data.equipment.present ? data.equipment.value : this.equipment, + primaryMuscles: data.primaryMuscles.present + ? data.primaryMuscles.value + : this.primaryMuscles, + secondaryMuscles: data.secondaryMuscles.present + ? data.secondaryMuscles.value + : this.secondaryMuscles, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ActivitiesData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('type: $type, ') + ..write('description: $description, ') + ..write('category: $category, ') + ..write('force: $force, ') + ..write('level: $level, ') + ..write('mechanic: $mechanic, ') + ..write('equipment: $equipment, ') + ..write('primaryMuscles: $primaryMuscles, ') + ..write('secondaryMuscles: $secondaryMuscles, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(id, title, type, description, category, force, + level, mechanic, equipment, primaryMuscles, secondaryMuscles, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ActivitiesData && + other.id == this.id && + other.title == this.title && + other.type == this.type && + other.description == this.description && + other.category == this.category && + other.force == this.force && + other.level == this.level && + other.mechanic == this.mechanic && + other.equipment == this.equipment && + other.primaryMuscles == this.primaryMuscles && + other.secondaryMuscles == this.secondaryMuscles && + other.createdAt == this.createdAt); +} + +class ActivitiesCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value type; + final Value description; + final Value category; + final Value force; + final Value level; + final Value mechanic; + final Value equipment; + final Value primaryMuscles; + final Value secondaryMuscles; + final Value createdAt; + const ActivitiesCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.type = const Value.absent(), + this.description = const Value.absent(), + this.category = const Value.absent(), + this.force = const Value.absent(), + this.level = const Value.absent(), + this.mechanic = const Value.absent(), + this.equipment = const Value.absent(), + this.primaryMuscles = const Value.absent(), + this.secondaryMuscles = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ActivitiesCompanion.insert({ + this.id = const Value.absent(), + required String title, + this.type = const Value.absent(), + this.description = const Value.absent(), + this.category = const Value.absent(), + this.force = const Value.absent(), + this.level = const Value.absent(), + this.mechanic = const Value.absent(), + this.equipment = const Value.absent(), + this.primaryMuscles = const Value.absent(), + this.secondaryMuscles = const Value.absent(), + this.createdAt = const Value.absent(), + }) : title = Value(title); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? type, + Expression? description, + Expression? category, + Expression? force, + Expression? level, + Expression? mechanic, + Expression? equipment, + Expression? primaryMuscles, + Expression? secondaryMuscles, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (type != null) 'type': type, + if (description != null) 'body': description, + if (category != null) 'category': category, + if (force != null) 'force': force, + if (level != null) 'level': level, + if (mechanic != null) 'mechanic': mechanic, + if (equipment != null) 'equipment': equipment, + if (primaryMuscles != null) 'primary_muscles': primaryMuscles, + if (secondaryMuscles != null) 'secondary_muscles': secondaryMuscles, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ActivitiesCompanion copyWith( + {Value? id, + Value? title, + Value? type, + Value? description, + Value? category, + Value? force, + Value? level, + Value? mechanic, + Value? equipment, + Value? primaryMuscles, + Value? secondaryMuscles, + Value? createdAt}) { + return ActivitiesCompanion( + id: id ?? this.id, + title: title ?? this.title, + type: type ?? this.type, + description: description ?? this.description, + category: category ?? this.category, + force: force ?? this.force, + level: level ?? this.level, + mechanic: mechanic ?? this.mechanic, + equipment: equipment ?? this.equipment, + primaryMuscles: primaryMuscles ?? this.primaryMuscles, + secondaryMuscles: secondaryMuscles ?? this.secondaryMuscles, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (type.present) { + map['type'] = Variable(type.value); + } + if (description.present) { + map['body'] = Variable(description.value); + } + if (category.present) { + map['category'] = Variable(category.value); + } + if (force.present) { + map['force'] = Variable(force.value); + } + if (level.present) { + map['level'] = Variable(level.value); + } + if (mechanic.present) { + map['mechanic'] = Variable(mechanic.value); + } + if (equipment.present) { + map['equipment'] = Variable(equipment.value); + } + if (primaryMuscles.present) { + map['primary_muscles'] = Variable(primaryMuscles.value); + } + if (secondaryMuscles.present) { + map['secondary_muscles'] = Variable(secondaryMuscles.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ActivitiesCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('type: $type, ') + ..write('description: $description, ') + ..write('category: $category, ') + ..write('force: $force, ') + ..write('level: $level, ') + ..write('mechanic: $mechanic, ') + ..write('equipment: $equipment, ') + ..write('primaryMuscles: $primaryMuscles, ') + ..write('secondaryMuscles: $secondaryMuscles, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class SessionActivities extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + SessionActivities(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn sessionId = GeneratedColumn( + 'session_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES sessions (id) ON DELETE CASCADE')); + late final GeneratedColumn activityId = GeneratedColumn( + 'activity_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES activities (id) ON DELETE CASCADE')); + late final GeneratedColumn position = GeneratedColumn( + 'position', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn results = GeneratedColumn( + 'results', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, sessionId, activityId, position, results, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'session_activities'; + @override + Set get $primaryKey => {id}; + @override + SessionActivitiesData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return SessionActivitiesData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + sessionId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}session_id'])!, + activityId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}activity_id'])!, + position: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}position'])!, + results: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}results']), + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + SessionActivities createAlias(String alias) { + return SessionActivities(attachedDatabase, alias); + } +} + +class SessionActivitiesData extends DataClass + implements Insertable { + final int id; + final int sessionId; + final int activityId; + final int position; + final String? results; + final DateTime createdAt; + const SessionActivitiesData( + {required this.id, + required this.sessionId, + required this.activityId, + required this.position, + this.results, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['session_id'] = Variable(sessionId); + map['activity_id'] = Variable(activityId); + map['position'] = Variable(position); + if (!nullToAbsent || results != null) { + map['results'] = Variable(results); + } + map['created_at'] = Variable(createdAt); + return map; + } + + SessionActivitiesCompanion toCompanion(bool nullToAbsent) { + return SessionActivitiesCompanion( + id: Value(id), + sessionId: Value(sessionId), + activityId: Value(activityId), + position: Value(position), + results: results == null && nullToAbsent + ? const Value.absent() + : Value(results), + createdAt: Value(createdAt), + ); + } + + factory SessionActivitiesData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return SessionActivitiesData( + id: serializer.fromJson(json['id']), + sessionId: serializer.fromJson(json['sessionId']), + activityId: serializer.fromJson(json['activityId']), + position: serializer.fromJson(json['position']), + results: serializer.fromJson(json['results']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'sessionId': serializer.toJson(sessionId), + 'activityId': serializer.toJson(activityId), + 'position': serializer.toJson(position), + 'results': serializer.toJson(results), + 'createdAt': serializer.toJson(createdAt), + }; + } + + SessionActivitiesData copyWith( + {int? id, + int? sessionId, + int? activityId, + int? position, + Value results = const Value.absent(), + DateTime? createdAt}) => + SessionActivitiesData( + id: id ?? this.id, + sessionId: sessionId ?? this.sessionId, + activityId: activityId ?? this.activityId, + position: position ?? this.position, + results: results.present ? results.value : this.results, + createdAt: createdAt ?? this.createdAt, + ); + SessionActivitiesData copyWithCompanion(SessionActivitiesCompanion data) { + return SessionActivitiesData( + id: data.id.present ? data.id.value : this.id, + sessionId: data.sessionId.present ? data.sessionId.value : this.sessionId, + activityId: + data.activityId.present ? data.activityId.value : this.activityId, + position: data.position.present ? data.position.value : this.position, + results: data.results.present ? data.results.value : this.results, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('SessionActivitiesData(') + ..write('id: $id, ') + ..write('sessionId: $sessionId, ') + ..write('activityId: $activityId, ') + ..write('position: $position, ') + ..write('results: $results, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(id, sessionId, activityId, position, results, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is SessionActivitiesData && + other.id == this.id && + other.sessionId == this.sessionId && + other.activityId == this.activityId && + other.position == this.position && + other.results == this.results && + other.createdAt == this.createdAt); +} + +class SessionActivitiesCompanion + extends UpdateCompanion { + final Value id; + final Value sessionId; + final Value activityId; + final Value position; + final Value results; + final Value createdAt; + const SessionActivitiesCompanion({ + this.id = const Value.absent(), + this.sessionId = const Value.absent(), + this.activityId = const Value.absent(), + this.position = const Value.absent(), + this.results = const Value.absent(), + this.createdAt = const Value.absent(), + }); + SessionActivitiesCompanion.insert({ + this.id = const Value.absent(), + required int sessionId, + required int activityId, + required int position, + this.results = const Value.absent(), + this.createdAt = const Value.absent(), + }) : sessionId = Value(sessionId), + activityId = Value(activityId), + position = Value(position); + static Insertable custom({ + Expression? id, + Expression? sessionId, + Expression? activityId, + Expression? position, + Expression? results, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (sessionId != null) 'session_id': sessionId, + if (activityId != null) 'activity_id': activityId, + if (position != null) 'position': position, + if (results != null) 'results': results, + if (createdAt != null) 'created_at': createdAt, + }); + } + + SessionActivitiesCompanion copyWith( + {Value? id, + Value? sessionId, + Value? activityId, + Value? position, + Value? results, + Value? createdAt}) { + return SessionActivitiesCompanion( + id: id ?? this.id, + sessionId: sessionId ?? this.sessionId, + activityId: activityId ?? this.activityId, + position: position ?? this.position, + results: results ?? this.results, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (sessionId.present) { + map['session_id'] = Variable(sessionId.value); + } + if (activityId.present) { + map['activity_id'] = Variable(activityId.value); + } + if (position.present) { + map['position'] = Variable(position.value); + } + if (results.present) { + map['results'] = Variable(results.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('SessionActivitiesCompanion(') + ..write('id: $id, ') + ..write('sessionId: $sessionId, ') + ..write('activityId: $activityId, ') + ..write('position: $position, ') + ..write('results: $results, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class Actions extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + Actions(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 64), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn description = GeneratedColumn( + 'body', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn totalSets = GeneratedColumn( + 'total_sets', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn totalReps = GeneratedColumn( + 'total_reps', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 1, maxTextLength: 32), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn restBeforeSets = GeneratedColumn( + 'rest_before_sets', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn restBetweenSets = GeneratedColumn( + 'rest_between_sets', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn restBetweenReps = GeneratedColumn( + 'rest_between_reps', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn restAfterSets = GeneratedColumn( + 'rest_after_sets', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn repType = GeneratedColumn( + 'rep_type', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn repLength = GeneratedColumn( + 'rep_length', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn repWeights = GeneratedColumn( + 'rep_weights', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn setWeights = GeneratedColumn( + 'set_weights', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn isAlternating = GeneratedColumn( + 'is_alternating', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("is_alternating" IN (0, 1))'), + defaultValue: Variable(false)); + late final GeneratedColumn tempo = GeneratedColumn( + 'tempo', aliasedName, true, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 6, maxTextLength: 36), + type: DriftSqlType.string, + requiredDuringInsert: false); + late final GeneratedColumn status = GeneratedColumn( + 'status', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: Variable(ActionStatus.pending.toString())); + late final GeneratedColumn state = GeneratedColumn( + 'state', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: Variable("{}")); + late final GeneratedColumn set = GeneratedColumn( + 'set', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => [ + id, + title, + description, + totalSets, + totalReps, + restBeforeSets, + restBetweenSets, + restBetweenReps, + restAfterSets, + repType, + repLength, + repWeights, + setWeights, + isAlternating, + tempo, + status, + state, + set, + createdAt + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'actions'; + @override + Set get $primaryKey => {id}; + @override + ActionsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ActionsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + description: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body'])!, + totalSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}total_sets'])!, + totalReps: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}total_reps'])!, + restBeforeSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_before_sets']), + restBetweenSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_between_sets']), + restBetweenReps: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_between_reps']), + restAfterSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_after_sets']), + repType: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}rep_type'])!, + repLength: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rep_length']), + repWeights: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}rep_weights']), + setWeights: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}set_weights']), + isAlternating: attachedDatabase.typeMapping + .read(DriftSqlType.bool, data['${effectivePrefix}is_alternating'])!, + tempo: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}tempo']), + status: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}status'])!, + state: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}state'])!, + set: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}set'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + Actions createAlias(String alias) { + return Actions(attachedDatabase, alias); + } +} + +class ActionsData extends DataClass implements Insertable { + final int id; + final String title; + final String description; + final int totalSets; + final String totalReps; + final int? restBeforeSets; + final int? restBetweenSets; + final int? restBetweenReps; + final int? restAfterSets; + final String repType; + final int? repLength; + final String? repWeights; + final String? setWeights; + final bool isAlternating; + final String? tempo; + final String status; + final String state; + final String set; + final DateTime createdAt; + const ActionsData( + {required this.id, + required this.title, + required this.description, + required this.totalSets, + required this.totalReps, + this.restBeforeSets, + this.restBetweenSets, + this.restBetweenReps, + this.restAfterSets, + required this.repType, + this.repLength, + this.repWeights, + this.setWeights, + required this.isAlternating, + this.tempo, + required this.status, + required this.state, + required this.set, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + map['body'] = Variable(description); + map['total_sets'] = Variable(totalSets); + map['total_reps'] = Variable(totalReps); + if (!nullToAbsent || restBeforeSets != null) { + map['rest_before_sets'] = Variable(restBeforeSets); + } + if (!nullToAbsent || restBetweenSets != null) { + map['rest_between_sets'] = Variable(restBetweenSets); + } + if (!nullToAbsent || restBetweenReps != null) { + map['rest_between_reps'] = Variable(restBetweenReps); + } + if (!nullToAbsent || restAfterSets != null) { + map['rest_after_sets'] = Variable(restAfterSets); + } + map['rep_type'] = Variable(repType); + if (!nullToAbsent || repLength != null) { + map['rep_length'] = Variable(repLength); + } + if (!nullToAbsent || repWeights != null) { + map['rep_weights'] = Variable(repWeights); + } + if (!nullToAbsent || setWeights != null) { + map['set_weights'] = Variable(setWeights); + } + map['is_alternating'] = Variable(isAlternating); + if (!nullToAbsent || tempo != null) { + map['tempo'] = Variable(tempo); + } + map['status'] = Variable(status); + map['state'] = Variable(state); + map['set'] = Variable(set); + map['created_at'] = Variable(createdAt); + return map; + } + + ActionsCompanion toCompanion(bool nullToAbsent) { + return ActionsCompanion( + id: Value(id), + title: Value(title), + description: Value(description), + totalSets: Value(totalSets), + totalReps: Value(totalReps), + restBeforeSets: restBeforeSets == null && nullToAbsent + ? const Value.absent() + : Value(restBeforeSets), + restBetweenSets: restBetweenSets == null && nullToAbsent + ? const Value.absent() + : Value(restBetweenSets), + restBetweenReps: restBetweenReps == null && nullToAbsent + ? const Value.absent() + : Value(restBetweenReps), + restAfterSets: restAfterSets == null && nullToAbsent + ? const Value.absent() + : Value(restAfterSets), + repType: Value(repType), + repLength: repLength == null && nullToAbsent + ? const Value.absent() + : Value(repLength), + repWeights: repWeights == null && nullToAbsent + ? const Value.absent() + : Value(repWeights), + setWeights: setWeights == null && nullToAbsent + ? const Value.absent() + : Value(setWeights), + isAlternating: Value(isAlternating), + tempo: + tempo == null && nullToAbsent ? const Value.absent() : Value(tempo), + status: Value(status), + state: Value(state), + set: Value(set), + createdAt: Value(createdAt), + ); + } + + factory ActionsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ActionsData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + description: serializer.fromJson(json['description']), + totalSets: serializer.fromJson(json['totalSets']), + totalReps: serializer.fromJson(json['totalReps']), + restBeforeSets: serializer.fromJson(json['restBeforeSets']), + restBetweenSets: serializer.fromJson(json['restBetweenSets']), + restBetweenReps: serializer.fromJson(json['restBetweenReps']), + restAfterSets: serializer.fromJson(json['restAfterSets']), + repType: serializer.fromJson(json['repType']), + repLength: serializer.fromJson(json['repLength']), + repWeights: serializer.fromJson(json['repWeights']), + setWeights: serializer.fromJson(json['setWeights']), + isAlternating: serializer.fromJson(json['isAlternating']), + tempo: serializer.fromJson(json['tempo']), + status: serializer.fromJson(json['status']), + state: serializer.fromJson(json['state']), + set: serializer.fromJson(json['set']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'description': serializer.toJson(description), + 'totalSets': serializer.toJson(totalSets), + 'totalReps': serializer.toJson(totalReps), + 'restBeforeSets': serializer.toJson(restBeforeSets), + 'restBetweenSets': serializer.toJson(restBetweenSets), + 'restBetweenReps': serializer.toJson(restBetweenReps), + 'restAfterSets': serializer.toJson(restAfterSets), + 'repType': serializer.toJson(repType), + 'repLength': serializer.toJson(repLength), + 'repWeights': serializer.toJson(repWeights), + 'setWeights': serializer.toJson(setWeights), + 'isAlternating': serializer.toJson(isAlternating), + 'tempo': serializer.toJson(tempo), + 'status': serializer.toJson(status), + 'state': serializer.toJson(state), + 'set': serializer.toJson(set), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ActionsData copyWith( + {int? id, + String? title, + String? description, + int? totalSets, + String? totalReps, + Value restBeforeSets = const Value.absent(), + Value restBetweenSets = const Value.absent(), + Value restBetweenReps = const Value.absent(), + Value restAfterSets = const Value.absent(), + String? repType, + Value repLength = const Value.absent(), + Value repWeights = const Value.absent(), + Value setWeights = const Value.absent(), + bool? isAlternating, + Value tempo = const Value.absent(), + String? status, + String? state, + String? set, + DateTime? createdAt}) => + ActionsData( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + totalSets: totalSets ?? this.totalSets, + totalReps: totalReps ?? this.totalReps, + restBeforeSets: + restBeforeSets.present ? restBeforeSets.value : this.restBeforeSets, + restBetweenSets: restBetweenSets.present + ? restBetweenSets.value + : this.restBetweenSets, + restBetweenReps: restBetweenReps.present + ? restBetweenReps.value + : this.restBetweenReps, + restAfterSets: + restAfterSets.present ? restAfterSets.value : this.restAfterSets, + repType: repType ?? this.repType, + repLength: repLength.present ? repLength.value : this.repLength, + repWeights: repWeights.present ? repWeights.value : this.repWeights, + setWeights: setWeights.present ? setWeights.value : this.setWeights, + isAlternating: isAlternating ?? this.isAlternating, + tempo: tempo.present ? tempo.value : this.tempo, + status: status ?? this.status, + state: state ?? this.state, + set: set ?? this.set, + createdAt: createdAt ?? this.createdAt, + ); + ActionsData copyWithCompanion(ActionsCompanion data) { + return ActionsData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + description: + data.description.present ? data.description.value : this.description, + totalSets: data.totalSets.present ? data.totalSets.value : this.totalSets, + totalReps: data.totalReps.present ? data.totalReps.value : this.totalReps, + restBeforeSets: data.restBeforeSets.present + ? data.restBeforeSets.value + : this.restBeforeSets, + restBetweenSets: data.restBetweenSets.present + ? data.restBetweenSets.value + : this.restBetweenSets, + restBetweenReps: data.restBetweenReps.present + ? data.restBetweenReps.value + : this.restBetweenReps, + restAfterSets: data.restAfterSets.present + ? data.restAfterSets.value + : this.restAfterSets, + repType: data.repType.present ? data.repType.value : this.repType, + repLength: data.repLength.present ? data.repLength.value : this.repLength, + repWeights: + data.repWeights.present ? data.repWeights.value : this.repWeights, + setWeights: + data.setWeights.present ? data.setWeights.value : this.setWeights, + isAlternating: data.isAlternating.present + ? data.isAlternating.value + : this.isAlternating, + tempo: data.tempo.present ? data.tempo.value : this.tempo, + status: data.status.present ? data.status.value : this.status, + state: data.state.present ? data.state.value : this.state, + set: data.set.present ? data.set.value : this.set, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ActionsData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('totalSets: $totalSets, ') + ..write('totalReps: $totalReps, ') + ..write('restBeforeSets: $restBeforeSets, ') + ..write('restBetweenSets: $restBetweenSets, ') + ..write('restBetweenReps: $restBetweenReps, ') + ..write('restAfterSets: $restAfterSets, ') + ..write('repType: $repType, ') + ..write('repLength: $repLength, ') + ..write('repWeights: $repWeights, ') + ..write('setWeights: $setWeights, ') + ..write('isAlternating: $isAlternating, ') + ..write('tempo: $tempo, ') + ..write('status: $status, ') + ..write('state: $state, ') + ..write('set: $set, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash( + id, + title, + description, + totalSets, + totalReps, + restBeforeSets, + restBetweenSets, + restBetweenReps, + restAfterSets, + repType, + repLength, + repWeights, + setWeights, + isAlternating, + tempo, + status, + state, + set, + createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ActionsData && + other.id == this.id && + other.title == this.title && + other.description == this.description && + other.totalSets == this.totalSets && + other.totalReps == this.totalReps && + other.restBeforeSets == this.restBeforeSets && + other.restBetweenSets == this.restBetweenSets && + other.restBetweenReps == this.restBetweenReps && + other.restAfterSets == this.restAfterSets && + other.repType == this.repType && + other.repLength == this.repLength && + other.repWeights == this.repWeights && + other.setWeights == this.setWeights && + other.isAlternating == this.isAlternating && + other.tempo == this.tempo && + other.status == this.status && + other.state == this.state && + other.set == this.set && + other.createdAt == this.createdAt); +} + +class ActionsCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value description; + final Value totalSets; + final Value totalReps; + final Value restBeforeSets; + final Value restBetweenSets; + final Value restBetweenReps; + final Value restAfterSets; + final Value repType; + final Value repLength; + final Value repWeights; + final Value setWeights; + final Value isAlternating; + final Value tempo; + final Value status; + final Value state; + final Value set; + final Value createdAt; + const ActionsCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.description = const Value.absent(), + this.totalSets = const Value.absent(), + this.totalReps = const Value.absent(), + this.restBeforeSets = const Value.absent(), + this.restBetweenSets = const Value.absent(), + this.restBetweenReps = const Value.absent(), + this.restAfterSets = const Value.absent(), + this.repType = const Value.absent(), + this.repLength = const Value.absent(), + this.repWeights = const Value.absent(), + this.setWeights = const Value.absent(), + this.isAlternating = const Value.absent(), + this.tempo = const Value.absent(), + this.status = const Value.absent(), + this.state = const Value.absent(), + this.set = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ActionsCompanion.insert({ + this.id = const Value.absent(), + required String title, + required String description, + required int totalSets, + required String totalReps, + this.restBeforeSets = const Value.absent(), + this.restBetweenSets = const Value.absent(), + this.restBetweenReps = const Value.absent(), + this.restAfterSets = const Value.absent(), + required String repType, + this.repLength = const Value.absent(), + this.repWeights = const Value.absent(), + this.setWeights = const Value.absent(), + this.isAlternating = const Value.absent(), + this.tempo = const Value.absent(), + this.status = const Value.absent(), + this.state = const Value.absent(), + required String set, + this.createdAt = const Value.absent(), + }) : title = Value(title), + description = Value(description), + totalSets = Value(totalSets), + totalReps = Value(totalReps), + repType = Value(repType), + set = Value(set); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? description, + Expression? totalSets, + Expression? totalReps, + Expression? restBeforeSets, + Expression? restBetweenSets, + Expression? restBetweenReps, + Expression? restAfterSets, + Expression? repType, + Expression? repLength, + Expression? repWeights, + Expression? setWeights, + Expression? isAlternating, + Expression? tempo, + Expression? status, + Expression? state, + Expression? set, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (description != null) 'body': description, + if (totalSets != null) 'total_sets': totalSets, + if (totalReps != null) 'total_reps': totalReps, + if (restBeforeSets != null) 'rest_before_sets': restBeforeSets, + if (restBetweenSets != null) 'rest_between_sets': restBetweenSets, + if (restBetweenReps != null) 'rest_between_reps': restBetweenReps, + if (restAfterSets != null) 'rest_after_sets': restAfterSets, + if (repType != null) 'rep_type': repType, + if (repLength != null) 'rep_length': repLength, + if (repWeights != null) 'rep_weights': repWeights, + if (setWeights != null) 'set_weights': setWeights, + if (isAlternating != null) 'is_alternating': isAlternating, + if (tempo != null) 'tempo': tempo, + if (status != null) 'status': status, + if (state != null) 'state': state, + if (set != null) 'set': set, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ActionsCompanion copyWith( + {Value? id, + Value? title, + Value? description, + Value? totalSets, + Value? totalReps, + Value? restBeforeSets, + Value? restBetweenSets, + Value? restBetweenReps, + Value? restAfterSets, + Value? repType, + Value? repLength, + Value? repWeights, + Value? setWeights, + Value? isAlternating, + Value? tempo, + Value? status, + Value? state, + Value? set, + Value? createdAt}) { + return ActionsCompanion( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + totalSets: totalSets ?? this.totalSets, + totalReps: totalReps ?? this.totalReps, + restBeforeSets: restBeforeSets ?? this.restBeforeSets, + restBetweenSets: restBetweenSets ?? this.restBetweenSets, + restBetweenReps: restBetweenReps ?? this.restBetweenReps, + restAfterSets: restAfterSets ?? this.restAfterSets, + repType: repType ?? this.repType, + repLength: repLength ?? this.repLength, + repWeights: repWeights ?? this.repWeights, + setWeights: setWeights ?? this.setWeights, + isAlternating: isAlternating ?? this.isAlternating, + tempo: tempo ?? this.tempo, + status: status ?? this.status, + state: state ?? this.state, + set: set ?? this.set, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (description.present) { + map['body'] = Variable(description.value); + } + if (totalSets.present) { + map['total_sets'] = Variable(totalSets.value); + } + if (totalReps.present) { + map['total_reps'] = Variable(totalReps.value); + } + if (restBeforeSets.present) { + map['rest_before_sets'] = Variable(restBeforeSets.value); + } + if (restBetweenSets.present) { + map['rest_between_sets'] = Variable(restBetweenSets.value); + } + if (restBetweenReps.present) { + map['rest_between_reps'] = Variable(restBetweenReps.value); + } + if (restAfterSets.present) { + map['rest_after_sets'] = Variable(restAfterSets.value); + } + if (repType.present) { + map['rep_type'] = Variable(repType.value); + } + if (repLength.present) { + map['rep_length'] = Variable(repLength.value); + } + if (repWeights.present) { + map['rep_weights'] = Variable(repWeights.value); + } + if (setWeights.present) { + map['set_weights'] = Variable(setWeights.value); + } + if (isAlternating.present) { + map['is_alternating'] = Variable(isAlternating.value); + } + if (tempo.present) { + map['tempo'] = Variable(tempo.value); + } + if (status.present) { + map['status'] = Variable(status.value); + } + if (state.present) { + map['state'] = Variable(state.value); + } + if (set.present) { + map['set'] = Variable(set.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ActionsCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('totalSets: $totalSets, ') + ..write('totalReps: $totalReps, ') + ..write('restBeforeSets: $restBeforeSets, ') + ..write('restBetweenSets: $restBetweenSets, ') + ..write('restBetweenReps: $restBetweenReps, ') + ..write('restAfterSets: $restAfterSets, ') + ..write('repType: $repType, ') + ..write('repLength: $repLength, ') + ..write('repWeights: $repWeights, ') + ..write('setWeights: $setWeights, ') + ..write('isAlternating: $isAlternating, ') + ..write('tempo: $tempo, ') + ..write('status: $status, ') + ..write('state: $state, ') + ..write('set: $set, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class ActivityActions extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + ActivityActions(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn activityId = GeneratedColumn( + 'activity_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES activities (id) ON DELETE CASCADE')); + late final GeneratedColumn actionId = GeneratedColumn( + 'action_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES actions (id) ON DELETE CASCADE')); + late final GeneratedColumn position = GeneratedColumn( + 'position', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, activityId, actionId, position, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'activity_actions'; + @override + Set get $primaryKey => {id}; + @override + ActivityActionsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ActivityActionsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + activityId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}activity_id'])!, + actionId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}action_id'])!, + position: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}position'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + ActivityActions createAlias(String alias) { + return ActivityActions(attachedDatabase, alias); + } +} + +class ActivityActionsData extends DataClass + implements Insertable { + final int id; + final int activityId; + final int actionId; + final int position; + final DateTime createdAt; + const ActivityActionsData( + {required this.id, + required this.activityId, + required this.actionId, + required this.position, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['activity_id'] = Variable(activityId); + map['action_id'] = Variable(actionId); + map['position'] = Variable(position); + map['created_at'] = Variable(createdAt); + return map; + } + + ActivityActionsCompanion toCompanion(bool nullToAbsent) { + return ActivityActionsCompanion( + id: Value(id), + activityId: Value(activityId), + actionId: Value(actionId), + position: Value(position), + createdAt: Value(createdAt), + ); + } + + factory ActivityActionsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ActivityActionsData( + id: serializer.fromJson(json['id']), + activityId: serializer.fromJson(json['activityId']), + actionId: serializer.fromJson(json['actionId']), + position: serializer.fromJson(json['position']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'activityId': serializer.toJson(activityId), + 'actionId': serializer.toJson(actionId), + 'position': serializer.toJson(position), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ActivityActionsData copyWith( + {int? id, + int? activityId, + int? actionId, + int? position, + DateTime? createdAt}) => + ActivityActionsData( + id: id ?? this.id, + activityId: activityId ?? this.activityId, + actionId: actionId ?? this.actionId, + position: position ?? this.position, + createdAt: createdAt ?? this.createdAt, + ); + ActivityActionsData copyWithCompanion(ActivityActionsCompanion data) { + return ActivityActionsData( + id: data.id.present ? data.id.value : this.id, + activityId: + data.activityId.present ? data.activityId.value : this.activityId, + actionId: data.actionId.present ? data.actionId.value : this.actionId, + position: data.position.present ? data.position.value : this.position, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ActivityActionsData(') + ..write('id: $id, ') + ..write('activityId: $activityId, ') + ..write('actionId: $actionId, ') + ..write('position: $position, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(id, activityId, actionId, position, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ActivityActionsData && + other.id == this.id && + other.activityId == this.activityId && + other.actionId == this.actionId && + other.position == this.position && + other.createdAt == this.createdAt); +} + +class ActivityActionsCompanion extends UpdateCompanion { + final Value id; + final Value activityId; + final Value actionId; + final Value position; + final Value createdAt; + const ActivityActionsCompanion({ + this.id = const Value.absent(), + this.activityId = const Value.absent(), + this.actionId = const Value.absent(), + this.position = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ActivityActionsCompanion.insert({ + this.id = const Value.absent(), + required int activityId, + required int actionId, + required int position, + this.createdAt = const Value.absent(), + }) : activityId = Value(activityId), + actionId = Value(actionId), + position = Value(position); + static Insertable custom({ + Expression? id, + Expression? activityId, + Expression? actionId, + Expression? position, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (activityId != null) 'activity_id': activityId, + if (actionId != null) 'action_id': actionId, + if (position != null) 'position': position, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ActivityActionsCompanion copyWith( + {Value? id, + Value? activityId, + Value? actionId, + Value? position, + Value? createdAt}) { + return ActivityActionsCompanion( + id: id ?? this.id, + activityId: activityId ?? this.activityId, + actionId: actionId ?? this.actionId, + position: position ?? this.position, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (activityId.present) { + map['activity_id'] = Variable(activityId.value); + } + if (actionId.present) { + map['action_id'] = Variable(actionId.value); + } + if (position.present) { + map['position'] = Variable(position.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ActivityActionsCompanion(') + ..write('id: $id, ') + ..write('activityId: $activityId, ') + ..write('actionId: $actionId, ') + ..write('position: $position, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class MediaItems extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + MediaItems(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 64), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn description = GeneratedColumn( + 'body', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn reference = GeneratedColumn( + 'reference', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn type = GeneratedColumn( + 'type', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, title, description, reference, type, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'media_items'; + @override + Set get $primaryKey => {id}; + @override + MediaItemsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return MediaItemsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + description: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body'])!, + reference: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}reference'])!, + type: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}type'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + MediaItems createAlias(String alias) { + return MediaItems(attachedDatabase, alias); + } +} + +class MediaItemsData extends DataClass implements Insertable { + final int id; + final String title; + final String description; + final String reference; + final String type; + final DateTime createdAt; + const MediaItemsData( + {required this.id, + required this.title, + required this.description, + required this.reference, + required this.type, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + map['body'] = Variable(description); + map['reference'] = Variable(reference); + map['type'] = Variable(type); + map['created_at'] = Variable(createdAt); + return map; + } + + MediaItemsCompanion toCompanion(bool nullToAbsent) { + return MediaItemsCompanion( + id: Value(id), + title: Value(title), + description: Value(description), + reference: Value(reference), + type: Value(type), + createdAt: Value(createdAt), + ); + } + + factory MediaItemsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return MediaItemsData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + description: serializer.fromJson(json['description']), + reference: serializer.fromJson(json['reference']), + type: serializer.fromJson(json['type']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'description': serializer.toJson(description), + 'reference': serializer.toJson(reference), + 'type': serializer.toJson(type), + 'createdAt': serializer.toJson(createdAt), + }; + } + + MediaItemsData copyWith( + {int? id, + String? title, + String? description, + String? reference, + String? type, + DateTime? createdAt}) => + MediaItemsData( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + reference: reference ?? this.reference, + type: type ?? this.type, + createdAt: createdAt ?? this.createdAt, + ); + MediaItemsData copyWithCompanion(MediaItemsCompanion data) { + return MediaItemsData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + description: + data.description.present ? data.description.value : this.description, + reference: data.reference.present ? data.reference.value : this.reference, + type: data.type.present ? data.type.value : this.type, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('MediaItemsData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('reference: $reference, ') + ..write('type: $type, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(id, title, description, reference, type, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is MediaItemsData && + other.id == this.id && + other.title == this.title && + other.description == this.description && + other.reference == this.reference && + other.type == this.type && + other.createdAt == this.createdAt); +} + +class MediaItemsCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value description; + final Value reference; + final Value type; + final Value createdAt; + const MediaItemsCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.description = const Value.absent(), + this.reference = const Value.absent(), + this.type = const Value.absent(), + this.createdAt = const Value.absent(), + }); + MediaItemsCompanion.insert({ + this.id = const Value.absent(), + required String title, + required String description, + required String reference, + required String type, + this.createdAt = const Value.absent(), + }) : title = Value(title), + description = Value(description), + reference = Value(reference), + type = Value(type); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? description, + Expression? reference, + Expression? type, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (description != null) 'body': description, + if (reference != null) 'reference': reference, + if (type != null) 'type': type, + if (createdAt != null) 'created_at': createdAt, + }); + } + + MediaItemsCompanion copyWith( + {Value? id, + Value? title, + Value? description, + Value? reference, + Value? type, + Value? createdAt}) { + return MediaItemsCompanion( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + reference: reference ?? this.reference, + type: type ?? this.type, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (description.present) { + map['body'] = Variable(description.value); + } + if (reference.present) { + map['reference'] = Variable(reference.value); + } + if (type.present) { + map['type'] = Variable(type.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('MediaItemsCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('reference: $reference, ') + ..write('type: $type, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class ObjectMediaItems extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + ObjectMediaItems(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn objectId = GeneratedColumn( + 'object_id', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn objectType = GeneratedColumn( + 'object_type', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn mediaId = GeneratedColumn( + 'media_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES media_items (id) ON DELETE CASCADE')); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, objectId, objectType, mediaId, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'object_media_items'; + @override + Set get $primaryKey => {id}; + @override + ObjectMediaItemsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ObjectMediaItemsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + objectId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}object_id'])!, + objectType: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}object_type'])!, + mediaId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}media_id'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + ObjectMediaItems createAlias(String alias) { + return ObjectMediaItems(attachedDatabase, alias); + } +} + +class ObjectMediaItemsData extends DataClass + implements Insertable { + final int id; + final int objectId; + final String objectType; + final int mediaId; + final DateTime createdAt; + const ObjectMediaItemsData( + {required this.id, + required this.objectId, + required this.objectType, + required this.mediaId, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['object_id'] = Variable(objectId); + map['object_type'] = Variable(objectType); + map['media_id'] = Variable(mediaId); + map['created_at'] = Variable(createdAt); + return map; + } + + ObjectMediaItemsCompanion toCompanion(bool nullToAbsent) { + return ObjectMediaItemsCompanion( + id: Value(id), + objectId: Value(objectId), + objectType: Value(objectType), + mediaId: Value(mediaId), + createdAt: Value(createdAt), + ); + } + + factory ObjectMediaItemsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ObjectMediaItemsData( + id: serializer.fromJson(json['id']), + objectId: serializer.fromJson(json['objectId']), + objectType: serializer.fromJson(json['objectType']), + mediaId: serializer.fromJson(json['mediaId']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'objectId': serializer.toJson(objectId), + 'objectType': serializer.toJson(objectType), + 'mediaId': serializer.toJson(mediaId), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ObjectMediaItemsData copyWith( + {int? id, + int? objectId, + String? objectType, + int? mediaId, + DateTime? createdAt}) => + ObjectMediaItemsData( + id: id ?? this.id, + objectId: objectId ?? this.objectId, + objectType: objectType ?? this.objectType, + mediaId: mediaId ?? this.mediaId, + createdAt: createdAt ?? this.createdAt, + ); + ObjectMediaItemsData copyWithCompanion(ObjectMediaItemsCompanion data) { + return ObjectMediaItemsData( + id: data.id.present ? data.id.value : this.id, + objectId: data.objectId.present ? data.objectId.value : this.objectId, + objectType: + data.objectType.present ? data.objectType.value : this.objectType, + mediaId: data.mediaId.present ? data.mediaId.value : this.mediaId, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ObjectMediaItemsData(') + ..write('id: $id, ') + ..write('objectId: $objectId, ') + ..write('objectType: $objectType, ') + ..write('mediaId: $mediaId, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(id, objectId, objectType, mediaId, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ObjectMediaItemsData && + other.id == this.id && + other.objectId == this.objectId && + other.objectType == this.objectType && + other.mediaId == this.mediaId && + other.createdAt == this.createdAt); +} + +class ObjectMediaItemsCompanion extends UpdateCompanion { + final Value id; + final Value objectId; + final Value objectType; + final Value mediaId; + final Value createdAt; + const ObjectMediaItemsCompanion({ + this.id = const Value.absent(), + this.objectId = const Value.absent(), + this.objectType = const Value.absent(), + this.mediaId = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ObjectMediaItemsCompanion.insert({ + this.id = const Value.absent(), + required int objectId, + required String objectType, + required int mediaId, + this.createdAt = const Value.absent(), + }) : objectId = Value(objectId), + objectType = Value(objectType), + mediaId = Value(mediaId); + static Insertable custom({ + Expression? id, + Expression? objectId, + Expression? objectType, + Expression? mediaId, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (objectId != null) 'object_id': objectId, + if (objectType != null) 'object_type': objectType, + if (mediaId != null) 'media_id': mediaId, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ObjectMediaItemsCompanion copyWith( + {Value? id, + Value? objectId, + Value? objectType, + Value? mediaId, + Value? createdAt}) { + return ObjectMediaItemsCompanion( + id: id ?? this.id, + objectId: objectId ?? this.objectId, + objectType: objectType ?? this.objectType, + mediaId: mediaId ?? this.mediaId, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (objectId.present) { + map['object_id'] = Variable(objectId.value); + } + if (objectType.present) { + map['object_type'] = Variable(objectType.value); + } + if (mediaId.present) { + map['media_id'] = Variable(mediaId.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ObjectMediaItemsCompanion(') + ..write('id: $id, ') + ..write('objectId: $objectId, ') + ..write('objectType: $objectType, ') + ..write('mediaId: $mediaId, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class DatabaseAtV26 extends GeneratedDatabase { + DatabaseAtV26(QueryExecutor e) : super(e); + late final Sessions sessions = Sessions(this); + late final Activities activities = Activities(this); + late final SessionActivities sessionActivities = SessionActivities(this); + late final Actions actions = Actions(this); + late final ActivityActions activityActions = ActivityActions(this); + late final MediaItems mediaItems = MediaItems(this); + late final ObjectMediaItems objectMediaItems = ObjectMediaItems(this); + @override + Iterable> get allTables => + allSchemaEntities.whereType>(); + @override + List get allSchemaEntities => [ + sessions, + activities, + sessionActivities, + actions, + activityActions, + mediaItems, + objectMediaItems + ]; + @override + int get schemaVersion => 26; +} diff --git a/test/drift/sendtrain/generated/schema_v27.dart b/test/drift/sendtrain/generated/schema_v27.dart new file mode 100644 index 0000000..f002ba1 --- /dev/null +++ b/test/drift/sendtrain/generated/schema_v27.dart @@ -0,0 +1,2701 @@ +// dart format width=80 +// GENERATED CODE, DO NOT EDIT BY HAND. +// ignore_for_file: type=lint +import 'package:drift/drift.dart'; + +class Sessions extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + Sessions(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 32), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn content = GeneratedColumn( + 'body', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn status = GeneratedColumn( + 'status', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn achievements = GeneratedColumn( + 'achievements', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn address = GeneratedColumn( + 'address', aliasedName, true, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 256), + type: DriftSqlType.string, + requiredDuringInsert: false); + late final GeneratedColumn date = GeneratedColumn( + 'date', aliasedName, true, + type: DriftSqlType.dateTime, requiredDuringInsert: false); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, title, content, status, achievements, address, date, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'sessions'; + @override + Set get $primaryKey => {id}; + @override + SessionsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return SessionsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + content: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body'])!, + status: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}status'])!, + achievements: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}achievements']), + address: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}address']), + date: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}date']), + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + Sessions createAlias(String alias) { + return Sessions(attachedDatabase, alias); + } +} + +class SessionsData extends DataClass implements Insertable { + final int id; + final String title; + final String content; + final String status; + final String? achievements; + final String? address; + final DateTime? date; + final DateTime createdAt; + const SessionsData( + {required this.id, + required this.title, + required this.content, + required this.status, + this.achievements, + this.address, + this.date, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + map['body'] = Variable(content); + map['status'] = Variable(status); + if (!nullToAbsent || achievements != null) { + map['achievements'] = Variable(achievements); + } + if (!nullToAbsent || address != null) { + map['address'] = Variable(address); + } + if (!nullToAbsent || date != null) { + map['date'] = Variable(date); + } + map['created_at'] = Variable(createdAt); + return map; + } + + SessionsCompanion toCompanion(bool nullToAbsent) { + return SessionsCompanion( + id: Value(id), + title: Value(title), + content: Value(content), + status: Value(status), + achievements: achievements == null && nullToAbsent + ? const Value.absent() + : Value(achievements), + address: address == null && nullToAbsent + ? const Value.absent() + : Value(address), + date: date == null && nullToAbsent ? const Value.absent() : Value(date), + createdAt: Value(createdAt), + ); + } + + factory SessionsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return SessionsData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + content: serializer.fromJson(json['content']), + status: serializer.fromJson(json['status']), + achievements: serializer.fromJson(json['achievements']), + address: serializer.fromJson(json['address']), + date: serializer.fromJson(json['date']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'content': serializer.toJson(content), + 'status': serializer.toJson(status), + 'achievements': serializer.toJson(achievements), + 'address': serializer.toJson(address), + 'date': serializer.toJson(date), + 'createdAt': serializer.toJson(createdAt), + }; + } + + SessionsData copyWith( + {int? id, + String? title, + String? content, + String? status, + Value achievements = const Value.absent(), + Value address = const Value.absent(), + Value date = const Value.absent(), + DateTime? createdAt}) => + SessionsData( + id: id ?? this.id, + title: title ?? this.title, + content: content ?? this.content, + status: status ?? this.status, + achievements: + achievements.present ? achievements.value : this.achievements, + address: address.present ? address.value : this.address, + date: date.present ? date.value : this.date, + createdAt: createdAt ?? this.createdAt, + ); + SessionsData copyWithCompanion(SessionsCompanion data) { + return SessionsData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + content: data.content.present ? data.content.value : this.content, + status: data.status.present ? data.status.value : this.status, + achievements: data.achievements.present + ? data.achievements.value + : this.achievements, + address: data.address.present ? data.address.value : this.address, + date: data.date.present ? data.date.value : this.date, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('SessionsData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('content: $content, ') + ..write('status: $status, ') + ..write('achievements: $achievements, ') + ..write('address: $address, ') + ..write('date: $date, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash( + id, title, content, status, achievements, address, date, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is SessionsData && + other.id == this.id && + other.title == this.title && + other.content == this.content && + other.status == this.status && + other.achievements == this.achievements && + other.address == this.address && + other.date == this.date && + other.createdAt == this.createdAt); +} + +class SessionsCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value content; + final Value status; + final Value achievements; + final Value address; + final Value date; + final Value createdAt; + const SessionsCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.content = const Value.absent(), + this.status = const Value.absent(), + this.achievements = const Value.absent(), + this.address = const Value.absent(), + this.date = const Value.absent(), + this.createdAt = const Value.absent(), + }); + SessionsCompanion.insert({ + this.id = const Value.absent(), + required String title, + required String content, + required String status, + this.achievements = const Value.absent(), + this.address = const Value.absent(), + this.date = const Value.absent(), + this.createdAt = const Value.absent(), + }) : title = Value(title), + content = Value(content), + status = Value(status); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? content, + Expression? status, + Expression? achievements, + Expression? address, + Expression? date, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (content != null) 'body': content, + if (status != null) 'status': status, + if (achievements != null) 'achievements': achievements, + if (address != null) 'address': address, + if (date != null) 'date': date, + if (createdAt != null) 'created_at': createdAt, + }); + } + + SessionsCompanion copyWith( + {Value? id, + Value? title, + Value? content, + Value? status, + Value? achievements, + Value? address, + Value? date, + Value? createdAt}) { + return SessionsCompanion( + id: id ?? this.id, + title: title ?? this.title, + content: content ?? this.content, + status: status ?? this.status, + achievements: achievements ?? this.achievements, + address: address ?? this.address, + date: date ?? this.date, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (content.present) { + map['body'] = Variable(content.value); + } + if (status.present) { + map['status'] = Variable(status.value); + } + if (achievements.present) { + map['achievements'] = Variable(achievements.value); + } + if (address.present) { + map['address'] = Variable(address.value); + } + if (date.present) { + map['date'] = Variable(date.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('SessionsCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('content: $content, ') + ..write('status: $status, ') + ..write('achievements: $achievements, ') + ..write('address: $address, ') + ..write('date: $date, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class Activities extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + Activities(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 100), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn type = GeneratedColumn( + 'type', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn description = GeneratedColumn( + 'body', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn category = GeneratedColumn( + 'category', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn force = GeneratedColumn( + 'force', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn level = GeneratedColumn( + 'level', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn mechanic = GeneratedColumn( + 'mechanic', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn equipment = GeneratedColumn( + 'equipment', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn primaryMuscles = GeneratedColumn( + 'primary_muscles', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn secondaryMuscles = GeneratedColumn( + 'secondary_muscles', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => [ + id, + title, + type, + description, + category, + force, + level, + mechanic, + equipment, + primaryMuscles, + secondaryMuscles, + createdAt + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'activities'; + @override + Set get $primaryKey => {id}; + @override + ActivitiesData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ActivitiesData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + type: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}type']), + description: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body']), + category: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}category']), + force: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}force']), + level: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}level']), + mechanic: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}mechanic']), + equipment: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}equipment']), + primaryMuscles: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}primary_muscles']), + secondaryMuscles: attachedDatabase.typeMapping.read( + DriftSqlType.string, data['${effectivePrefix}secondary_muscles']), + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + Activities createAlias(String alias) { + return Activities(attachedDatabase, alias); + } +} + +class ActivitiesData extends DataClass implements Insertable { + final int id; + final String title; + final String? type; + final String? description; + final String? category; + final String? force; + final String? level; + final String? mechanic; + final String? equipment; + final String? primaryMuscles; + final String? secondaryMuscles; + final DateTime createdAt; + const ActivitiesData( + {required this.id, + required this.title, + this.type, + this.description, + this.category, + this.force, + this.level, + this.mechanic, + this.equipment, + this.primaryMuscles, + this.secondaryMuscles, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + if (!nullToAbsent || type != null) { + map['type'] = Variable(type); + } + if (!nullToAbsent || description != null) { + map['body'] = Variable(description); + } + if (!nullToAbsent || category != null) { + map['category'] = Variable(category); + } + if (!nullToAbsent || force != null) { + map['force'] = Variable(force); + } + if (!nullToAbsent || level != null) { + map['level'] = Variable(level); + } + if (!nullToAbsent || mechanic != null) { + map['mechanic'] = Variable(mechanic); + } + if (!nullToAbsent || equipment != null) { + map['equipment'] = Variable(equipment); + } + if (!nullToAbsent || primaryMuscles != null) { + map['primary_muscles'] = Variable(primaryMuscles); + } + if (!nullToAbsent || secondaryMuscles != null) { + map['secondary_muscles'] = Variable(secondaryMuscles); + } + map['created_at'] = Variable(createdAt); + return map; + } + + ActivitiesCompanion toCompanion(bool nullToAbsent) { + return ActivitiesCompanion( + id: Value(id), + title: Value(title), + type: type == null && nullToAbsent ? const Value.absent() : Value(type), + description: description == null && nullToAbsent + ? const Value.absent() + : Value(description), + category: category == null && nullToAbsent + ? const Value.absent() + : Value(category), + force: + force == null && nullToAbsent ? const Value.absent() : Value(force), + level: + level == null && nullToAbsent ? const Value.absent() : Value(level), + mechanic: mechanic == null && nullToAbsent + ? const Value.absent() + : Value(mechanic), + equipment: equipment == null && nullToAbsent + ? const Value.absent() + : Value(equipment), + primaryMuscles: primaryMuscles == null && nullToAbsent + ? const Value.absent() + : Value(primaryMuscles), + secondaryMuscles: secondaryMuscles == null && nullToAbsent + ? const Value.absent() + : Value(secondaryMuscles), + createdAt: Value(createdAt), + ); + } + + factory ActivitiesData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ActivitiesData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + type: serializer.fromJson(json['type']), + description: serializer.fromJson(json['description']), + category: serializer.fromJson(json['category']), + force: serializer.fromJson(json['force']), + level: serializer.fromJson(json['level']), + mechanic: serializer.fromJson(json['mechanic']), + equipment: serializer.fromJson(json['equipment']), + primaryMuscles: serializer.fromJson(json['primaryMuscles']), + secondaryMuscles: serializer.fromJson(json['secondaryMuscles']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'type': serializer.toJson(type), + 'description': serializer.toJson(description), + 'category': serializer.toJson(category), + 'force': serializer.toJson(force), + 'level': serializer.toJson(level), + 'mechanic': serializer.toJson(mechanic), + 'equipment': serializer.toJson(equipment), + 'primaryMuscles': serializer.toJson(primaryMuscles), + 'secondaryMuscles': serializer.toJson(secondaryMuscles), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ActivitiesData copyWith( + {int? id, + String? title, + Value type = const Value.absent(), + Value description = const Value.absent(), + Value category = const Value.absent(), + Value force = const Value.absent(), + Value level = const Value.absent(), + Value mechanic = const Value.absent(), + Value equipment = const Value.absent(), + Value primaryMuscles = const Value.absent(), + Value secondaryMuscles = const Value.absent(), + DateTime? createdAt}) => + ActivitiesData( + id: id ?? this.id, + title: title ?? this.title, + type: type.present ? type.value : this.type, + description: description.present ? description.value : this.description, + category: category.present ? category.value : this.category, + force: force.present ? force.value : this.force, + level: level.present ? level.value : this.level, + mechanic: mechanic.present ? mechanic.value : this.mechanic, + equipment: equipment.present ? equipment.value : this.equipment, + primaryMuscles: + primaryMuscles.present ? primaryMuscles.value : this.primaryMuscles, + secondaryMuscles: secondaryMuscles.present + ? secondaryMuscles.value + : this.secondaryMuscles, + createdAt: createdAt ?? this.createdAt, + ); + ActivitiesData copyWithCompanion(ActivitiesCompanion data) { + return ActivitiesData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + type: data.type.present ? data.type.value : this.type, + description: + data.description.present ? data.description.value : this.description, + category: data.category.present ? data.category.value : this.category, + force: data.force.present ? data.force.value : this.force, + level: data.level.present ? data.level.value : this.level, + mechanic: data.mechanic.present ? data.mechanic.value : this.mechanic, + equipment: data.equipment.present ? data.equipment.value : this.equipment, + primaryMuscles: data.primaryMuscles.present + ? data.primaryMuscles.value + : this.primaryMuscles, + secondaryMuscles: data.secondaryMuscles.present + ? data.secondaryMuscles.value + : this.secondaryMuscles, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ActivitiesData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('type: $type, ') + ..write('description: $description, ') + ..write('category: $category, ') + ..write('force: $force, ') + ..write('level: $level, ') + ..write('mechanic: $mechanic, ') + ..write('equipment: $equipment, ') + ..write('primaryMuscles: $primaryMuscles, ') + ..write('secondaryMuscles: $secondaryMuscles, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(id, title, type, description, category, force, + level, mechanic, equipment, primaryMuscles, secondaryMuscles, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ActivitiesData && + other.id == this.id && + other.title == this.title && + other.type == this.type && + other.description == this.description && + other.category == this.category && + other.force == this.force && + other.level == this.level && + other.mechanic == this.mechanic && + other.equipment == this.equipment && + other.primaryMuscles == this.primaryMuscles && + other.secondaryMuscles == this.secondaryMuscles && + other.createdAt == this.createdAt); +} + +class ActivitiesCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value type; + final Value description; + final Value category; + final Value force; + final Value level; + final Value mechanic; + final Value equipment; + final Value primaryMuscles; + final Value secondaryMuscles; + final Value createdAt; + const ActivitiesCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.type = const Value.absent(), + this.description = const Value.absent(), + this.category = const Value.absent(), + this.force = const Value.absent(), + this.level = const Value.absent(), + this.mechanic = const Value.absent(), + this.equipment = const Value.absent(), + this.primaryMuscles = const Value.absent(), + this.secondaryMuscles = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ActivitiesCompanion.insert({ + this.id = const Value.absent(), + required String title, + this.type = const Value.absent(), + this.description = const Value.absent(), + this.category = const Value.absent(), + this.force = const Value.absent(), + this.level = const Value.absent(), + this.mechanic = const Value.absent(), + this.equipment = const Value.absent(), + this.primaryMuscles = const Value.absent(), + this.secondaryMuscles = const Value.absent(), + this.createdAt = const Value.absent(), + }) : title = Value(title); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? type, + Expression? description, + Expression? category, + Expression? force, + Expression? level, + Expression? mechanic, + Expression? equipment, + Expression? primaryMuscles, + Expression? secondaryMuscles, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (type != null) 'type': type, + if (description != null) 'body': description, + if (category != null) 'category': category, + if (force != null) 'force': force, + if (level != null) 'level': level, + if (mechanic != null) 'mechanic': mechanic, + if (equipment != null) 'equipment': equipment, + if (primaryMuscles != null) 'primary_muscles': primaryMuscles, + if (secondaryMuscles != null) 'secondary_muscles': secondaryMuscles, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ActivitiesCompanion copyWith( + {Value? id, + Value? title, + Value? type, + Value? description, + Value? category, + Value? force, + Value? level, + Value? mechanic, + Value? equipment, + Value? primaryMuscles, + Value? secondaryMuscles, + Value? createdAt}) { + return ActivitiesCompanion( + id: id ?? this.id, + title: title ?? this.title, + type: type ?? this.type, + description: description ?? this.description, + category: category ?? this.category, + force: force ?? this.force, + level: level ?? this.level, + mechanic: mechanic ?? this.mechanic, + equipment: equipment ?? this.equipment, + primaryMuscles: primaryMuscles ?? this.primaryMuscles, + secondaryMuscles: secondaryMuscles ?? this.secondaryMuscles, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (type.present) { + map['type'] = Variable(type.value); + } + if (description.present) { + map['body'] = Variable(description.value); + } + if (category.present) { + map['category'] = Variable(category.value); + } + if (force.present) { + map['force'] = Variable(force.value); + } + if (level.present) { + map['level'] = Variable(level.value); + } + if (mechanic.present) { + map['mechanic'] = Variable(mechanic.value); + } + if (equipment.present) { + map['equipment'] = Variable(equipment.value); + } + if (primaryMuscles.present) { + map['primary_muscles'] = Variable(primaryMuscles.value); + } + if (secondaryMuscles.present) { + map['secondary_muscles'] = Variable(secondaryMuscles.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ActivitiesCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('type: $type, ') + ..write('description: $description, ') + ..write('category: $category, ') + ..write('force: $force, ') + ..write('level: $level, ') + ..write('mechanic: $mechanic, ') + ..write('equipment: $equipment, ') + ..write('primaryMuscles: $primaryMuscles, ') + ..write('secondaryMuscles: $secondaryMuscles, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class SessionActivities extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + SessionActivities(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn sessionId = GeneratedColumn( + 'session_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES sessions (id) ON DELETE CASCADE')); + late final GeneratedColumn activityId = GeneratedColumn( + 'activity_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES activities (id) ON DELETE CASCADE')); + late final GeneratedColumn position = GeneratedColumn( + 'position', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn results = GeneratedColumn( + 'results', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, sessionId, activityId, position, results, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'session_activities'; + @override + Set get $primaryKey => {id}; + @override + SessionActivitiesData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return SessionActivitiesData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + sessionId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}session_id'])!, + activityId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}activity_id'])!, + position: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}position'])!, + results: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}results']), + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + SessionActivities createAlias(String alias) { + return SessionActivities(attachedDatabase, alias); + } +} + +class SessionActivitiesData extends DataClass + implements Insertable { + final int id; + final int sessionId; + final int activityId; + final int position; + final String? results; + final DateTime createdAt; + const SessionActivitiesData( + {required this.id, + required this.sessionId, + required this.activityId, + required this.position, + this.results, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['session_id'] = Variable(sessionId); + map['activity_id'] = Variable(activityId); + map['position'] = Variable(position); + if (!nullToAbsent || results != null) { + map['results'] = Variable(results); + } + map['created_at'] = Variable(createdAt); + return map; + } + + SessionActivitiesCompanion toCompanion(bool nullToAbsent) { + return SessionActivitiesCompanion( + id: Value(id), + sessionId: Value(sessionId), + activityId: Value(activityId), + position: Value(position), + results: results == null && nullToAbsent + ? const Value.absent() + : Value(results), + createdAt: Value(createdAt), + ); + } + + factory SessionActivitiesData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return SessionActivitiesData( + id: serializer.fromJson(json['id']), + sessionId: serializer.fromJson(json['sessionId']), + activityId: serializer.fromJson(json['activityId']), + position: serializer.fromJson(json['position']), + results: serializer.fromJson(json['results']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'sessionId': serializer.toJson(sessionId), + 'activityId': serializer.toJson(activityId), + 'position': serializer.toJson(position), + 'results': serializer.toJson(results), + 'createdAt': serializer.toJson(createdAt), + }; + } + + SessionActivitiesData copyWith( + {int? id, + int? sessionId, + int? activityId, + int? position, + Value results = const Value.absent(), + DateTime? createdAt}) => + SessionActivitiesData( + id: id ?? this.id, + sessionId: sessionId ?? this.sessionId, + activityId: activityId ?? this.activityId, + position: position ?? this.position, + results: results.present ? results.value : this.results, + createdAt: createdAt ?? this.createdAt, + ); + SessionActivitiesData copyWithCompanion(SessionActivitiesCompanion data) { + return SessionActivitiesData( + id: data.id.present ? data.id.value : this.id, + sessionId: data.sessionId.present ? data.sessionId.value : this.sessionId, + activityId: + data.activityId.present ? data.activityId.value : this.activityId, + position: data.position.present ? data.position.value : this.position, + results: data.results.present ? data.results.value : this.results, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('SessionActivitiesData(') + ..write('id: $id, ') + ..write('sessionId: $sessionId, ') + ..write('activityId: $activityId, ') + ..write('position: $position, ') + ..write('results: $results, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(id, sessionId, activityId, position, results, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is SessionActivitiesData && + other.id == this.id && + other.sessionId == this.sessionId && + other.activityId == this.activityId && + other.position == this.position && + other.results == this.results && + other.createdAt == this.createdAt); +} + +class SessionActivitiesCompanion + extends UpdateCompanion { + final Value id; + final Value sessionId; + final Value activityId; + final Value position; + final Value results; + final Value createdAt; + const SessionActivitiesCompanion({ + this.id = const Value.absent(), + this.sessionId = const Value.absent(), + this.activityId = const Value.absent(), + this.position = const Value.absent(), + this.results = const Value.absent(), + this.createdAt = const Value.absent(), + }); + SessionActivitiesCompanion.insert({ + this.id = const Value.absent(), + required int sessionId, + required int activityId, + required int position, + this.results = const Value.absent(), + this.createdAt = const Value.absent(), + }) : sessionId = Value(sessionId), + activityId = Value(activityId), + position = Value(position); + static Insertable custom({ + Expression? id, + Expression? sessionId, + Expression? activityId, + Expression? position, + Expression? results, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (sessionId != null) 'session_id': sessionId, + if (activityId != null) 'activity_id': activityId, + if (position != null) 'position': position, + if (results != null) 'results': results, + if (createdAt != null) 'created_at': createdAt, + }); + } + + SessionActivitiesCompanion copyWith( + {Value? id, + Value? sessionId, + Value? activityId, + Value? position, + Value? results, + Value? createdAt}) { + return SessionActivitiesCompanion( + id: id ?? this.id, + sessionId: sessionId ?? this.sessionId, + activityId: activityId ?? this.activityId, + position: position ?? this.position, + results: results ?? this.results, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (sessionId.present) { + map['session_id'] = Variable(sessionId.value); + } + if (activityId.present) { + map['activity_id'] = Variable(activityId.value); + } + if (position.present) { + map['position'] = Variable(position.value); + } + if (results.present) { + map['results'] = Variable(results.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('SessionActivitiesCompanion(') + ..write('id: $id, ') + ..write('sessionId: $sessionId, ') + ..write('activityId: $activityId, ') + ..write('position: $position, ') + ..write('results: $results, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class Actions extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + Actions(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 64), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn description = GeneratedColumn( + 'body', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn totalSets = GeneratedColumn( + 'total_sets', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn totalReps = GeneratedColumn( + 'total_reps', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 1, maxTextLength: 32), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn restBeforeSets = GeneratedColumn( + 'rest_before_sets', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn restBetweenSets = GeneratedColumn( + 'rest_between_sets', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn restBetweenReps = GeneratedColumn( + 'rest_between_reps', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn restAfterSets = GeneratedColumn( + 'rest_after_sets', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn repType = GeneratedColumn( + 'rep_type', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn repLength = GeneratedColumn( + 'rep_length', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn repWeights = GeneratedColumn( + 'rep_weights', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn setWeights = GeneratedColumn( + 'set_weights', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn isAlternating = GeneratedColumn( + 'is_alternating', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("is_alternating" IN (0, 1))'), + defaultValue: Variable(false)); + late final GeneratedColumn tempo = GeneratedColumn( + 'tempo', aliasedName, true, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 6, maxTextLength: 36), + type: DriftSqlType.string, + requiredDuringInsert: false); + late final GeneratedColumn status = GeneratedColumn( + 'status', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: Variable('pending')); + late final GeneratedColumn state = GeneratedColumn( + 'state', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: Variable("{}")); + late final GeneratedColumn set = GeneratedColumn( + 'set', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => [ + id, + title, + description, + totalSets, + totalReps, + restBeforeSets, + restBetweenSets, + restBetweenReps, + restAfterSets, + repType, + repLength, + repWeights, + setWeights, + isAlternating, + tempo, + status, + state, + set, + createdAt + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'actions'; + @override + Set get $primaryKey => {id}; + @override + ActionsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ActionsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + description: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body'])!, + totalSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}total_sets'])!, + totalReps: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}total_reps'])!, + restBeforeSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_before_sets']), + restBetweenSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_between_sets']), + restBetweenReps: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_between_reps']), + restAfterSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_after_sets']), + repType: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}rep_type'])!, + repLength: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rep_length']), + repWeights: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}rep_weights']), + setWeights: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}set_weights']), + isAlternating: attachedDatabase.typeMapping + .read(DriftSqlType.bool, data['${effectivePrefix}is_alternating'])!, + tempo: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}tempo']), + status: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}status'])!, + state: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}state'])!, + set: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}set'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + Actions createAlias(String alias) { + return Actions(attachedDatabase, alias); + } +} + +class ActionsData extends DataClass implements Insertable { + final int id; + final String title; + final String description; + final int totalSets; + final String totalReps; + final int? restBeforeSets; + final int? restBetweenSets; + final int? restBetweenReps; + final int? restAfterSets; + final String repType; + final int? repLength; + final String? repWeights; + final String? setWeights; + final bool isAlternating; + final String? tempo; + final String status; + final String state; + final String set; + final DateTime createdAt; + const ActionsData( + {required this.id, + required this.title, + required this.description, + required this.totalSets, + required this.totalReps, + this.restBeforeSets, + this.restBetweenSets, + this.restBetweenReps, + this.restAfterSets, + required this.repType, + this.repLength, + this.repWeights, + this.setWeights, + required this.isAlternating, + this.tempo, + required this.status, + required this.state, + required this.set, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + map['body'] = Variable(description); + map['total_sets'] = Variable(totalSets); + map['total_reps'] = Variable(totalReps); + if (!nullToAbsent || restBeforeSets != null) { + map['rest_before_sets'] = Variable(restBeforeSets); + } + if (!nullToAbsent || restBetweenSets != null) { + map['rest_between_sets'] = Variable(restBetweenSets); + } + if (!nullToAbsent || restBetweenReps != null) { + map['rest_between_reps'] = Variable(restBetweenReps); + } + if (!nullToAbsent || restAfterSets != null) { + map['rest_after_sets'] = Variable(restAfterSets); + } + map['rep_type'] = Variable(repType); + if (!nullToAbsent || repLength != null) { + map['rep_length'] = Variable(repLength); + } + if (!nullToAbsent || repWeights != null) { + map['rep_weights'] = Variable(repWeights); + } + if (!nullToAbsent || setWeights != null) { + map['set_weights'] = Variable(setWeights); + } + map['is_alternating'] = Variable(isAlternating); + if (!nullToAbsent || tempo != null) { + map['tempo'] = Variable(tempo); + } + map['status'] = Variable(status); + map['state'] = Variable(state); + map['set'] = Variable(set); + map['created_at'] = Variable(createdAt); + return map; + } + + ActionsCompanion toCompanion(bool nullToAbsent) { + return ActionsCompanion( + id: Value(id), + title: Value(title), + description: Value(description), + totalSets: Value(totalSets), + totalReps: Value(totalReps), + restBeforeSets: restBeforeSets == null && nullToAbsent + ? const Value.absent() + : Value(restBeforeSets), + restBetweenSets: restBetweenSets == null && nullToAbsent + ? const Value.absent() + : Value(restBetweenSets), + restBetweenReps: restBetweenReps == null && nullToAbsent + ? const Value.absent() + : Value(restBetweenReps), + restAfterSets: restAfterSets == null && nullToAbsent + ? const Value.absent() + : Value(restAfterSets), + repType: Value(repType), + repLength: repLength == null && nullToAbsent + ? const Value.absent() + : Value(repLength), + repWeights: repWeights == null && nullToAbsent + ? const Value.absent() + : Value(repWeights), + setWeights: setWeights == null && nullToAbsent + ? const Value.absent() + : Value(setWeights), + isAlternating: Value(isAlternating), + tempo: + tempo == null && nullToAbsent ? const Value.absent() : Value(tempo), + status: Value(status), + state: Value(state), + set: Value(set), + createdAt: Value(createdAt), + ); + } + + factory ActionsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ActionsData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + description: serializer.fromJson(json['description']), + totalSets: serializer.fromJson(json['totalSets']), + totalReps: serializer.fromJson(json['totalReps']), + restBeforeSets: serializer.fromJson(json['restBeforeSets']), + restBetweenSets: serializer.fromJson(json['restBetweenSets']), + restBetweenReps: serializer.fromJson(json['restBetweenReps']), + restAfterSets: serializer.fromJson(json['restAfterSets']), + repType: serializer.fromJson(json['repType']), + repLength: serializer.fromJson(json['repLength']), + repWeights: serializer.fromJson(json['repWeights']), + setWeights: serializer.fromJson(json['setWeights']), + isAlternating: serializer.fromJson(json['isAlternating']), + tempo: serializer.fromJson(json['tempo']), + status: serializer.fromJson(json['status']), + state: serializer.fromJson(json['state']), + set: serializer.fromJson(json['set']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'description': serializer.toJson(description), + 'totalSets': serializer.toJson(totalSets), + 'totalReps': serializer.toJson(totalReps), + 'restBeforeSets': serializer.toJson(restBeforeSets), + 'restBetweenSets': serializer.toJson(restBetweenSets), + 'restBetweenReps': serializer.toJson(restBetweenReps), + 'restAfterSets': serializer.toJson(restAfterSets), + 'repType': serializer.toJson(repType), + 'repLength': serializer.toJson(repLength), + 'repWeights': serializer.toJson(repWeights), + 'setWeights': serializer.toJson(setWeights), + 'isAlternating': serializer.toJson(isAlternating), + 'tempo': serializer.toJson(tempo), + 'status': serializer.toJson(status), + 'state': serializer.toJson(state), + 'set': serializer.toJson(set), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ActionsData copyWith( + {int? id, + String? title, + String? description, + int? totalSets, + String? totalReps, + Value restBeforeSets = const Value.absent(), + Value restBetweenSets = const Value.absent(), + Value restBetweenReps = const Value.absent(), + Value restAfterSets = const Value.absent(), + String? repType, + Value repLength = const Value.absent(), + Value repWeights = const Value.absent(), + Value setWeights = const Value.absent(), + bool? isAlternating, + Value tempo = const Value.absent(), + String? status, + String? state, + String? set, + DateTime? createdAt}) => + ActionsData( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + totalSets: totalSets ?? this.totalSets, + totalReps: totalReps ?? this.totalReps, + restBeforeSets: + restBeforeSets.present ? restBeforeSets.value : this.restBeforeSets, + restBetweenSets: restBetweenSets.present + ? restBetweenSets.value + : this.restBetweenSets, + restBetweenReps: restBetweenReps.present + ? restBetweenReps.value + : this.restBetweenReps, + restAfterSets: + restAfterSets.present ? restAfterSets.value : this.restAfterSets, + repType: repType ?? this.repType, + repLength: repLength.present ? repLength.value : this.repLength, + repWeights: repWeights.present ? repWeights.value : this.repWeights, + setWeights: setWeights.present ? setWeights.value : this.setWeights, + isAlternating: isAlternating ?? this.isAlternating, + tempo: tempo.present ? tempo.value : this.tempo, + status: status ?? this.status, + state: state ?? this.state, + set: set ?? this.set, + createdAt: createdAt ?? this.createdAt, + ); + ActionsData copyWithCompanion(ActionsCompanion data) { + return ActionsData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + description: + data.description.present ? data.description.value : this.description, + totalSets: data.totalSets.present ? data.totalSets.value : this.totalSets, + totalReps: data.totalReps.present ? data.totalReps.value : this.totalReps, + restBeforeSets: data.restBeforeSets.present + ? data.restBeforeSets.value + : this.restBeforeSets, + restBetweenSets: data.restBetweenSets.present + ? data.restBetweenSets.value + : this.restBetweenSets, + restBetweenReps: data.restBetweenReps.present + ? data.restBetweenReps.value + : this.restBetweenReps, + restAfterSets: data.restAfterSets.present + ? data.restAfterSets.value + : this.restAfterSets, + repType: data.repType.present ? data.repType.value : this.repType, + repLength: data.repLength.present ? data.repLength.value : this.repLength, + repWeights: + data.repWeights.present ? data.repWeights.value : this.repWeights, + setWeights: + data.setWeights.present ? data.setWeights.value : this.setWeights, + isAlternating: data.isAlternating.present + ? data.isAlternating.value + : this.isAlternating, + tempo: data.tempo.present ? data.tempo.value : this.tempo, + status: data.status.present ? data.status.value : this.status, + state: data.state.present ? data.state.value : this.state, + set: data.set.present ? data.set.value : this.set, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ActionsData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('totalSets: $totalSets, ') + ..write('totalReps: $totalReps, ') + ..write('restBeforeSets: $restBeforeSets, ') + ..write('restBetweenSets: $restBetweenSets, ') + ..write('restBetweenReps: $restBetweenReps, ') + ..write('restAfterSets: $restAfterSets, ') + ..write('repType: $repType, ') + ..write('repLength: $repLength, ') + ..write('repWeights: $repWeights, ') + ..write('setWeights: $setWeights, ') + ..write('isAlternating: $isAlternating, ') + ..write('tempo: $tempo, ') + ..write('status: $status, ') + ..write('state: $state, ') + ..write('set: $set, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash( + id, + title, + description, + totalSets, + totalReps, + restBeforeSets, + restBetweenSets, + restBetweenReps, + restAfterSets, + repType, + repLength, + repWeights, + setWeights, + isAlternating, + tempo, + status, + state, + set, + createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ActionsData && + other.id == this.id && + other.title == this.title && + other.description == this.description && + other.totalSets == this.totalSets && + other.totalReps == this.totalReps && + other.restBeforeSets == this.restBeforeSets && + other.restBetweenSets == this.restBetweenSets && + other.restBetweenReps == this.restBetweenReps && + other.restAfterSets == this.restAfterSets && + other.repType == this.repType && + other.repLength == this.repLength && + other.repWeights == this.repWeights && + other.setWeights == this.setWeights && + other.isAlternating == this.isAlternating && + other.tempo == this.tempo && + other.status == this.status && + other.state == this.state && + other.set == this.set && + other.createdAt == this.createdAt); +} + +class ActionsCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value description; + final Value totalSets; + final Value totalReps; + final Value restBeforeSets; + final Value restBetweenSets; + final Value restBetweenReps; + final Value restAfterSets; + final Value repType; + final Value repLength; + final Value repWeights; + final Value setWeights; + final Value isAlternating; + final Value tempo; + final Value status; + final Value state; + final Value set; + final Value createdAt; + const ActionsCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.description = const Value.absent(), + this.totalSets = const Value.absent(), + this.totalReps = const Value.absent(), + this.restBeforeSets = const Value.absent(), + this.restBetweenSets = const Value.absent(), + this.restBetweenReps = const Value.absent(), + this.restAfterSets = const Value.absent(), + this.repType = const Value.absent(), + this.repLength = const Value.absent(), + this.repWeights = const Value.absent(), + this.setWeights = const Value.absent(), + this.isAlternating = const Value.absent(), + this.tempo = const Value.absent(), + this.status = const Value.absent(), + this.state = const Value.absent(), + this.set = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ActionsCompanion.insert({ + this.id = const Value.absent(), + required String title, + required String description, + required int totalSets, + required String totalReps, + this.restBeforeSets = const Value.absent(), + this.restBetweenSets = const Value.absent(), + this.restBetweenReps = const Value.absent(), + this.restAfterSets = const Value.absent(), + required String repType, + this.repLength = const Value.absent(), + this.repWeights = const Value.absent(), + this.setWeights = const Value.absent(), + this.isAlternating = const Value.absent(), + this.tempo = const Value.absent(), + this.status = const Value.absent(), + this.state = const Value.absent(), + required String set, + this.createdAt = const Value.absent(), + }) : title = Value(title), + description = Value(description), + totalSets = Value(totalSets), + totalReps = Value(totalReps), + repType = Value(repType), + set = Value(set); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? description, + Expression? totalSets, + Expression? totalReps, + Expression? restBeforeSets, + Expression? restBetweenSets, + Expression? restBetweenReps, + Expression? restAfterSets, + Expression? repType, + Expression? repLength, + Expression? repWeights, + Expression? setWeights, + Expression? isAlternating, + Expression? tempo, + Expression? status, + Expression? state, + Expression? set, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (description != null) 'body': description, + if (totalSets != null) 'total_sets': totalSets, + if (totalReps != null) 'total_reps': totalReps, + if (restBeforeSets != null) 'rest_before_sets': restBeforeSets, + if (restBetweenSets != null) 'rest_between_sets': restBetweenSets, + if (restBetweenReps != null) 'rest_between_reps': restBetweenReps, + if (restAfterSets != null) 'rest_after_sets': restAfterSets, + if (repType != null) 'rep_type': repType, + if (repLength != null) 'rep_length': repLength, + if (repWeights != null) 'rep_weights': repWeights, + if (setWeights != null) 'set_weights': setWeights, + if (isAlternating != null) 'is_alternating': isAlternating, + if (tempo != null) 'tempo': tempo, + if (status != null) 'status': status, + if (state != null) 'state': state, + if (set != null) 'set': set, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ActionsCompanion copyWith( + {Value? id, + Value? title, + Value? description, + Value? totalSets, + Value? totalReps, + Value? restBeforeSets, + Value? restBetweenSets, + Value? restBetweenReps, + Value? restAfterSets, + Value? repType, + Value? repLength, + Value? repWeights, + Value? setWeights, + Value? isAlternating, + Value? tempo, + Value? status, + Value? state, + Value? set, + Value? createdAt}) { + return ActionsCompanion( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + totalSets: totalSets ?? this.totalSets, + totalReps: totalReps ?? this.totalReps, + restBeforeSets: restBeforeSets ?? this.restBeforeSets, + restBetweenSets: restBetweenSets ?? this.restBetweenSets, + restBetweenReps: restBetweenReps ?? this.restBetweenReps, + restAfterSets: restAfterSets ?? this.restAfterSets, + repType: repType ?? this.repType, + repLength: repLength ?? this.repLength, + repWeights: repWeights ?? this.repWeights, + setWeights: setWeights ?? this.setWeights, + isAlternating: isAlternating ?? this.isAlternating, + tempo: tempo ?? this.tempo, + status: status ?? this.status, + state: state ?? this.state, + set: set ?? this.set, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (description.present) { + map['body'] = Variable(description.value); + } + if (totalSets.present) { + map['total_sets'] = Variable(totalSets.value); + } + if (totalReps.present) { + map['total_reps'] = Variable(totalReps.value); + } + if (restBeforeSets.present) { + map['rest_before_sets'] = Variable(restBeforeSets.value); + } + if (restBetweenSets.present) { + map['rest_between_sets'] = Variable(restBetweenSets.value); + } + if (restBetweenReps.present) { + map['rest_between_reps'] = Variable(restBetweenReps.value); + } + if (restAfterSets.present) { + map['rest_after_sets'] = Variable(restAfterSets.value); + } + if (repType.present) { + map['rep_type'] = Variable(repType.value); + } + if (repLength.present) { + map['rep_length'] = Variable(repLength.value); + } + if (repWeights.present) { + map['rep_weights'] = Variable(repWeights.value); + } + if (setWeights.present) { + map['set_weights'] = Variable(setWeights.value); + } + if (isAlternating.present) { + map['is_alternating'] = Variable(isAlternating.value); + } + if (tempo.present) { + map['tempo'] = Variable(tempo.value); + } + if (status.present) { + map['status'] = Variable(status.value); + } + if (state.present) { + map['state'] = Variable(state.value); + } + if (set.present) { + map['set'] = Variable(set.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ActionsCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('totalSets: $totalSets, ') + ..write('totalReps: $totalReps, ') + ..write('restBeforeSets: $restBeforeSets, ') + ..write('restBetweenSets: $restBetweenSets, ') + ..write('restBetweenReps: $restBetweenReps, ') + ..write('restAfterSets: $restAfterSets, ') + ..write('repType: $repType, ') + ..write('repLength: $repLength, ') + ..write('repWeights: $repWeights, ') + ..write('setWeights: $setWeights, ') + ..write('isAlternating: $isAlternating, ') + ..write('tempo: $tempo, ') + ..write('status: $status, ') + ..write('state: $state, ') + ..write('set: $set, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class ActivityActions extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + ActivityActions(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn activityId = GeneratedColumn( + 'activity_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES activities (id) ON DELETE CASCADE')); + late final GeneratedColumn actionId = GeneratedColumn( + 'action_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES actions (id) ON DELETE CASCADE')); + late final GeneratedColumn position = GeneratedColumn( + 'position', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, activityId, actionId, position, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'activity_actions'; + @override + Set get $primaryKey => {id}; + @override + ActivityActionsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ActivityActionsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + activityId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}activity_id'])!, + actionId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}action_id'])!, + position: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}position'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + ActivityActions createAlias(String alias) { + return ActivityActions(attachedDatabase, alias); + } +} + +class ActivityActionsData extends DataClass + implements Insertable { + final int id; + final int activityId; + final int actionId; + final int position; + final DateTime createdAt; + const ActivityActionsData( + {required this.id, + required this.activityId, + required this.actionId, + required this.position, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['activity_id'] = Variable(activityId); + map['action_id'] = Variable(actionId); + map['position'] = Variable(position); + map['created_at'] = Variable(createdAt); + return map; + } + + ActivityActionsCompanion toCompanion(bool nullToAbsent) { + return ActivityActionsCompanion( + id: Value(id), + activityId: Value(activityId), + actionId: Value(actionId), + position: Value(position), + createdAt: Value(createdAt), + ); + } + + factory ActivityActionsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ActivityActionsData( + id: serializer.fromJson(json['id']), + activityId: serializer.fromJson(json['activityId']), + actionId: serializer.fromJson(json['actionId']), + position: serializer.fromJson(json['position']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'activityId': serializer.toJson(activityId), + 'actionId': serializer.toJson(actionId), + 'position': serializer.toJson(position), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ActivityActionsData copyWith( + {int? id, + int? activityId, + int? actionId, + int? position, + DateTime? createdAt}) => + ActivityActionsData( + id: id ?? this.id, + activityId: activityId ?? this.activityId, + actionId: actionId ?? this.actionId, + position: position ?? this.position, + createdAt: createdAt ?? this.createdAt, + ); + ActivityActionsData copyWithCompanion(ActivityActionsCompanion data) { + return ActivityActionsData( + id: data.id.present ? data.id.value : this.id, + activityId: + data.activityId.present ? data.activityId.value : this.activityId, + actionId: data.actionId.present ? data.actionId.value : this.actionId, + position: data.position.present ? data.position.value : this.position, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ActivityActionsData(') + ..write('id: $id, ') + ..write('activityId: $activityId, ') + ..write('actionId: $actionId, ') + ..write('position: $position, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(id, activityId, actionId, position, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ActivityActionsData && + other.id == this.id && + other.activityId == this.activityId && + other.actionId == this.actionId && + other.position == this.position && + other.createdAt == this.createdAt); +} + +class ActivityActionsCompanion extends UpdateCompanion { + final Value id; + final Value activityId; + final Value actionId; + final Value position; + final Value createdAt; + const ActivityActionsCompanion({ + this.id = const Value.absent(), + this.activityId = const Value.absent(), + this.actionId = const Value.absent(), + this.position = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ActivityActionsCompanion.insert({ + this.id = const Value.absent(), + required int activityId, + required int actionId, + required int position, + this.createdAt = const Value.absent(), + }) : activityId = Value(activityId), + actionId = Value(actionId), + position = Value(position); + static Insertable custom({ + Expression? id, + Expression? activityId, + Expression? actionId, + Expression? position, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (activityId != null) 'activity_id': activityId, + if (actionId != null) 'action_id': actionId, + if (position != null) 'position': position, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ActivityActionsCompanion copyWith( + {Value? id, + Value? activityId, + Value? actionId, + Value? position, + Value? createdAt}) { + return ActivityActionsCompanion( + id: id ?? this.id, + activityId: activityId ?? this.activityId, + actionId: actionId ?? this.actionId, + position: position ?? this.position, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (activityId.present) { + map['activity_id'] = Variable(activityId.value); + } + if (actionId.present) { + map['action_id'] = Variable(actionId.value); + } + if (position.present) { + map['position'] = Variable(position.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ActivityActionsCompanion(') + ..write('id: $id, ') + ..write('activityId: $activityId, ') + ..write('actionId: $actionId, ') + ..write('position: $position, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class MediaItems extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + MediaItems(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 64), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn description = GeneratedColumn( + 'body', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn reference = GeneratedColumn( + 'reference', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn type = GeneratedColumn( + 'type', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, title, description, reference, type, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'media_items'; + @override + Set get $primaryKey => {id}; + @override + MediaItemsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return MediaItemsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + description: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body'])!, + reference: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}reference'])!, + type: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}type'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + MediaItems createAlias(String alias) { + return MediaItems(attachedDatabase, alias); + } +} + +class MediaItemsData extends DataClass implements Insertable { + final int id; + final String title; + final String description; + final String reference; + final String type; + final DateTime createdAt; + const MediaItemsData( + {required this.id, + required this.title, + required this.description, + required this.reference, + required this.type, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + map['body'] = Variable(description); + map['reference'] = Variable(reference); + map['type'] = Variable(type); + map['created_at'] = Variable(createdAt); + return map; + } + + MediaItemsCompanion toCompanion(bool nullToAbsent) { + return MediaItemsCompanion( + id: Value(id), + title: Value(title), + description: Value(description), + reference: Value(reference), + type: Value(type), + createdAt: Value(createdAt), + ); + } + + factory MediaItemsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return MediaItemsData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + description: serializer.fromJson(json['description']), + reference: serializer.fromJson(json['reference']), + type: serializer.fromJson(json['type']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'description': serializer.toJson(description), + 'reference': serializer.toJson(reference), + 'type': serializer.toJson(type), + 'createdAt': serializer.toJson(createdAt), + }; + } + + MediaItemsData copyWith( + {int? id, + String? title, + String? description, + String? reference, + String? type, + DateTime? createdAt}) => + MediaItemsData( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + reference: reference ?? this.reference, + type: type ?? this.type, + createdAt: createdAt ?? this.createdAt, + ); + MediaItemsData copyWithCompanion(MediaItemsCompanion data) { + return MediaItemsData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + description: + data.description.present ? data.description.value : this.description, + reference: data.reference.present ? data.reference.value : this.reference, + type: data.type.present ? data.type.value : this.type, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('MediaItemsData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('reference: $reference, ') + ..write('type: $type, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(id, title, description, reference, type, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is MediaItemsData && + other.id == this.id && + other.title == this.title && + other.description == this.description && + other.reference == this.reference && + other.type == this.type && + other.createdAt == this.createdAt); +} + +class MediaItemsCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value description; + final Value reference; + final Value type; + final Value createdAt; + const MediaItemsCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.description = const Value.absent(), + this.reference = const Value.absent(), + this.type = const Value.absent(), + this.createdAt = const Value.absent(), + }); + MediaItemsCompanion.insert({ + this.id = const Value.absent(), + required String title, + required String description, + required String reference, + required String type, + this.createdAt = const Value.absent(), + }) : title = Value(title), + description = Value(description), + reference = Value(reference), + type = Value(type); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? description, + Expression? reference, + Expression? type, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (description != null) 'body': description, + if (reference != null) 'reference': reference, + if (type != null) 'type': type, + if (createdAt != null) 'created_at': createdAt, + }); + } + + MediaItemsCompanion copyWith( + {Value? id, + Value? title, + Value? description, + Value? reference, + Value? type, + Value? createdAt}) { + return MediaItemsCompanion( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + reference: reference ?? this.reference, + type: type ?? this.type, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (description.present) { + map['body'] = Variable(description.value); + } + if (reference.present) { + map['reference'] = Variable(reference.value); + } + if (type.present) { + map['type'] = Variable(type.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('MediaItemsCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('reference: $reference, ') + ..write('type: $type, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class ObjectMediaItems extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + ObjectMediaItems(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn objectId = GeneratedColumn( + 'object_id', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn objectType = GeneratedColumn( + 'object_type', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn mediaId = GeneratedColumn( + 'media_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES media_items (id) ON DELETE CASCADE')); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, objectId, objectType, mediaId, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'object_media_items'; + @override + Set get $primaryKey => {id}; + @override + ObjectMediaItemsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ObjectMediaItemsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + objectId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}object_id'])!, + objectType: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}object_type'])!, + mediaId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}media_id'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + ObjectMediaItems createAlias(String alias) { + return ObjectMediaItems(attachedDatabase, alias); + } +} + +class ObjectMediaItemsData extends DataClass + implements Insertable { + final int id; + final int objectId; + final String objectType; + final int mediaId; + final DateTime createdAt; + const ObjectMediaItemsData( + {required this.id, + required this.objectId, + required this.objectType, + required this.mediaId, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['object_id'] = Variable(objectId); + map['object_type'] = Variable(objectType); + map['media_id'] = Variable(mediaId); + map['created_at'] = Variable(createdAt); + return map; + } + + ObjectMediaItemsCompanion toCompanion(bool nullToAbsent) { + return ObjectMediaItemsCompanion( + id: Value(id), + objectId: Value(objectId), + objectType: Value(objectType), + mediaId: Value(mediaId), + createdAt: Value(createdAt), + ); + } + + factory ObjectMediaItemsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ObjectMediaItemsData( + id: serializer.fromJson(json['id']), + objectId: serializer.fromJson(json['objectId']), + objectType: serializer.fromJson(json['objectType']), + mediaId: serializer.fromJson(json['mediaId']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'objectId': serializer.toJson(objectId), + 'objectType': serializer.toJson(objectType), + 'mediaId': serializer.toJson(mediaId), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ObjectMediaItemsData copyWith( + {int? id, + int? objectId, + String? objectType, + int? mediaId, + DateTime? createdAt}) => + ObjectMediaItemsData( + id: id ?? this.id, + objectId: objectId ?? this.objectId, + objectType: objectType ?? this.objectType, + mediaId: mediaId ?? this.mediaId, + createdAt: createdAt ?? this.createdAt, + ); + ObjectMediaItemsData copyWithCompanion(ObjectMediaItemsCompanion data) { + return ObjectMediaItemsData( + id: data.id.present ? data.id.value : this.id, + objectId: data.objectId.present ? data.objectId.value : this.objectId, + objectType: + data.objectType.present ? data.objectType.value : this.objectType, + mediaId: data.mediaId.present ? data.mediaId.value : this.mediaId, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ObjectMediaItemsData(') + ..write('id: $id, ') + ..write('objectId: $objectId, ') + ..write('objectType: $objectType, ') + ..write('mediaId: $mediaId, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(id, objectId, objectType, mediaId, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ObjectMediaItemsData && + other.id == this.id && + other.objectId == this.objectId && + other.objectType == this.objectType && + other.mediaId == this.mediaId && + other.createdAt == this.createdAt); +} + +class ObjectMediaItemsCompanion extends UpdateCompanion { + final Value id; + final Value objectId; + final Value objectType; + final Value mediaId; + final Value createdAt; + const ObjectMediaItemsCompanion({ + this.id = const Value.absent(), + this.objectId = const Value.absent(), + this.objectType = const Value.absent(), + this.mediaId = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ObjectMediaItemsCompanion.insert({ + this.id = const Value.absent(), + required int objectId, + required String objectType, + required int mediaId, + this.createdAt = const Value.absent(), + }) : objectId = Value(objectId), + objectType = Value(objectType), + mediaId = Value(mediaId); + static Insertable custom({ + Expression? id, + Expression? objectId, + Expression? objectType, + Expression? mediaId, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (objectId != null) 'object_id': objectId, + if (objectType != null) 'object_type': objectType, + if (mediaId != null) 'media_id': mediaId, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ObjectMediaItemsCompanion copyWith( + {Value? id, + Value? objectId, + Value? objectType, + Value? mediaId, + Value? createdAt}) { + return ObjectMediaItemsCompanion( + id: id ?? this.id, + objectId: objectId ?? this.objectId, + objectType: objectType ?? this.objectType, + mediaId: mediaId ?? this.mediaId, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (objectId.present) { + map['object_id'] = Variable(objectId.value); + } + if (objectType.present) { + map['object_type'] = Variable(objectType.value); + } + if (mediaId.present) { + map['media_id'] = Variable(mediaId.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ObjectMediaItemsCompanion(') + ..write('id: $id, ') + ..write('objectId: $objectId, ') + ..write('objectType: $objectType, ') + ..write('mediaId: $mediaId, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class DatabaseAtV27 extends GeneratedDatabase { + DatabaseAtV27(QueryExecutor e) : super(e); + late final Sessions sessions = Sessions(this); + late final Activities activities = Activities(this); + late final SessionActivities sessionActivities = SessionActivities(this); + late final Actions actions = Actions(this); + late final ActivityActions activityActions = ActivityActions(this); + late final MediaItems mediaItems = MediaItems(this); + late final ObjectMediaItems objectMediaItems = ObjectMediaItems(this); + @override + Iterable> get allTables => + allSchemaEntities.whereType>(); + @override + List get allSchemaEntities => [ + sessions, + activities, + sessionActivities, + actions, + activityActions, + mediaItems, + objectMediaItems + ]; + @override + int get schemaVersion => 27; +} diff --git a/test/drift/sendtrain/generated/schema_v28.dart b/test/drift/sendtrain/generated/schema_v28.dart new file mode 100644 index 0000000..2cb62c5 --- /dev/null +++ b/test/drift/sendtrain/generated/schema_v28.dart @@ -0,0 +1,2701 @@ +// dart format width=80 +// GENERATED CODE, DO NOT EDIT BY HAND. +// ignore_for_file: type=lint +import 'package:drift/drift.dart'; + +class Sessions extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + Sessions(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 32), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn content = GeneratedColumn( + 'body', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn status = GeneratedColumn( + 'status', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn achievements = GeneratedColumn( + 'achievements', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn address = GeneratedColumn( + 'address', aliasedName, true, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 256), + type: DriftSqlType.string, + requiredDuringInsert: false); + late final GeneratedColumn date = GeneratedColumn( + 'date', aliasedName, true, + type: DriftSqlType.dateTime, requiredDuringInsert: false); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, title, content, status, achievements, address, date, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'sessions'; + @override + Set get $primaryKey => {id}; + @override + SessionsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return SessionsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + content: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body'])!, + status: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}status'])!, + achievements: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}achievements']), + address: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}address']), + date: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}date']), + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + Sessions createAlias(String alias) { + return Sessions(attachedDatabase, alias); + } +} + +class SessionsData extends DataClass implements Insertable { + final int id; + final String title; + final String content; + final String status; + final String? achievements; + final String? address; + final DateTime? date; + final DateTime createdAt; + const SessionsData( + {required this.id, + required this.title, + required this.content, + required this.status, + this.achievements, + this.address, + this.date, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + map['body'] = Variable(content); + map['status'] = Variable(status); + if (!nullToAbsent || achievements != null) { + map['achievements'] = Variable(achievements); + } + if (!nullToAbsent || address != null) { + map['address'] = Variable(address); + } + if (!nullToAbsent || date != null) { + map['date'] = Variable(date); + } + map['created_at'] = Variable(createdAt); + return map; + } + + SessionsCompanion toCompanion(bool nullToAbsent) { + return SessionsCompanion( + id: Value(id), + title: Value(title), + content: Value(content), + status: Value(status), + achievements: achievements == null && nullToAbsent + ? const Value.absent() + : Value(achievements), + address: address == null && nullToAbsent + ? const Value.absent() + : Value(address), + date: date == null && nullToAbsent ? const Value.absent() : Value(date), + createdAt: Value(createdAt), + ); + } + + factory SessionsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return SessionsData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + content: serializer.fromJson(json['content']), + status: serializer.fromJson(json['status']), + achievements: serializer.fromJson(json['achievements']), + address: serializer.fromJson(json['address']), + date: serializer.fromJson(json['date']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'content': serializer.toJson(content), + 'status': serializer.toJson(status), + 'achievements': serializer.toJson(achievements), + 'address': serializer.toJson(address), + 'date': serializer.toJson(date), + 'createdAt': serializer.toJson(createdAt), + }; + } + + SessionsData copyWith( + {int? id, + String? title, + String? content, + String? status, + Value achievements = const Value.absent(), + Value address = const Value.absent(), + Value date = const Value.absent(), + DateTime? createdAt}) => + SessionsData( + id: id ?? this.id, + title: title ?? this.title, + content: content ?? this.content, + status: status ?? this.status, + achievements: + achievements.present ? achievements.value : this.achievements, + address: address.present ? address.value : this.address, + date: date.present ? date.value : this.date, + createdAt: createdAt ?? this.createdAt, + ); + SessionsData copyWithCompanion(SessionsCompanion data) { + return SessionsData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + content: data.content.present ? data.content.value : this.content, + status: data.status.present ? data.status.value : this.status, + achievements: data.achievements.present + ? data.achievements.value + : this.achievements, + address: data.address.present ? data.address.value : this.address, + date: data.date.present ? data.date.value : this.date, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('SessionsData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('content: $content, ') + ..write('status: $status, ') + ..write('achievements: $achievements, ') + ..write('address: $address, ') + ..write('date: $date, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash( + id, title, content, status, achievements, address, date, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is SessionsData && + other.id == this.id && + other.title == this.title && + other.content == this.content && + other.status == this.status && + other.achievements == this.achievements && + other.address == this.address && + other.date == this.date && + other.createdAt == this.createdAt); +} + +class SessionsCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value content; + final Value status; + final Value achievements; + final Value address; + final Value date; + final Value createdAt; + const SessionsCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.content = const Value.absent(), + this.status = const Value.absent(), + this.achievements = const Value.absent(), + this.address = const Value.absent(), + this.date = const Value.absent(), + this.createdAt = const Value.absent(), + }); + SessionsCompanion.insert({ + this.id = const Value.absent(), + required String title, + required String content, + required String status, + this.achievements = const Value.absent(), + this.address = const Value.absent(), + this.date = const Value.absent(), + this.createdAt = const Value.absent(), + }) : title = Value(title), + content = Value(content), + status = Value(status); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? content, + Expression? status, + Expression? achievements, + Expression? address, + Expression? date, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (content != null) 'body': content, + if (status != null) 'status': status, + if (achievements != null) 'achievements': achievements, + if (address != null) 'address': address, + if (date != null) 'date': date, + if (createdAt != null) 'created_at': createdAt, + }); + } + + SessionsCompanion copyWith( + {Value? id, + Value? title, + Value? content, + Value? status, + Value? achievements, + Value? address, + Value? date, + Value? createdAt}) { + return SessionsCompanion( + id: id ?? this.id, + title: title ?? this.title, + content: content ?? this.content, + status: status ?? this.status, + achievements: achievements ?? this.achievements, + address: address ?? this.address, + date: date ?? this.date, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (content.present) { + map['body'] = Variable(content.value); + } + if (status.present) { + map['status'] = Variable(status.value); + } + if (achievements.present) { + map['achievements'] = Variable(achievements.value); + } + if (address.present) { + map['address'] = Variable(address.value); + } + if (date.present) { + map['date'] = Variable(date.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('SessionsCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('content: $content, ') + ..write('status: $status, ') + ..write('achievements: $achievements, ') + ..write('address: $address, ') + ..write('date: $date, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class Activities extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + Activities(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 100), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn type = GeneratedColumn( + 'type', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn description = GeneratedColumn( + 'body', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn category = GeneratedColumn( + 'category', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn force = GeneratedColumn( + 'force', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn level = GeneratedColumn( + 'level', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn mechanic = GeneratedColumn( + 'mechanic', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn equipment = GeneratedColumn( + 'equipment', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn primaryMuscles = GeneratedColumn( + 'primary_muscles', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn secondaryMuscles = GeneratedColumn( + 'secondary_muscles', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => [ + id, + title, + type, + description, + category, + force, + level, + mechanic, + equipment, + primaryMuscles, + secondaryMuscles, + createdAt + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'activities'; + @override + Set get $primaryKey => {id}; + @override + ActivitiesData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ActivitiesData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + type: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}type']), + description: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body']), + category: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}category']), + force: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}force']), + level: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}level']), + mechanic: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}mechanic']), + equipment: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}equipment']), + primaryMuscles: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}primary_muscles']), + secondaryMuscles: attachedDatabase.typeMapping.read( + DriftSqlType.string, data['${effectivePrefix}secondary_muscles']), + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + Activities createAlias(String alias) { + return Activities(attachedDatabase, alias); + } +} + +class ActivitiesData extends DataClass implements Insertable { + final int id; + final String title; + final String? type; + final String? description; + final String? category; + final String? force; + final String? level; + final String? mechanic; + final String? equipment; + final String? primaryMuscles; + final String? secondaryMuscles; + final DateTime createdAt; + const ActivitiesData( + {required this.id, + required this.title, + this.type, + this.description, + this.category, + this.force, + this.level, + this.mechanic, + this.equipment, + this.primaryMuscles, + this.secondaryMuscles, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + if (!nullToAbsent || type != null) { + map['type'] = Variable(type); + } + if (!nullToAbsent || description != null) { + map['body'] = Variable(description); + } + if (!nullToAbsent || category != null) { + map['category'] = Variable(category); + } + if (!nullToAbsent || force != null) { + map['force'] = Variable(force); + } + if (!nullToAbsent || level != null) { + map['level'] = Variable(level); + } + if (!nullToAbsent || mechanic != null) { + map['mechanic'] = Variable(mechanic); + } + if (!nullToAbsent || equipment != null) { + map['equipment'] = Variable(equipment); + } + if (!nullToAbsent || primaryMuscles != null) { + map['primary_muscles'] = Variable(primaryMuscles); + } + if (!nullToAbsent || secondaryMuscles != null) { + map['secondary_muscles'] = Variable(secondaryMuscles); + } + map['created_at'] = Variable(createdAt); + return map; + } + + ActivitiesCompanion toCompanion(bool nullToAbsent) { + return ActivitiesCompanion( + id: Value(id), + title: Value(title), + type: type == null && nullToAbsent ? const Value.absent() : Value(type), + description: description == null && nullToAbsent + ? const Value.absent() + : Value(description), + category: category == null && nullToAbsent + ? const Value.absent() + : Value(category), + force: + force == null && nullToAbsent ? const Value.absent() : Value(force), + level: + level == null && nullToAbsent ? const Value.absent() : Value(level), + mechanic: mechanic == null && nullToAbsent + ? const Value.absent() + : Value(mechanic), + equipment: equipment == null && nullToAbsent + ? const Value.absent() + : Value(equipment), + primaryMuscles: primaryMuscles == null && nullToAbsent + ? const Value.absent() + : Value(primaryMuscles), + secondaryMuscles: secondaryMuscles == null && nullToAbsent + ? const Value.absent() + : Value(secondaryMuscles), + createdAt: Value(createdAt), + ); + } + + factory ActivitiesData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ActivitiesData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + type: serializer.fromJson(json['type']), + description: serializer.fromJson(json['description']), + category: serializer.fromJson(json['category']), + force: serializer.fromJson(json['force']), + level: serializer.fromJson(json['level']), + mechanic: serializer.fromJson(json['mechanic']), + equipment: serializer.fromJson(json['equipment']), + primaryMuscles: serializer.fromJson(json['primaryMuscles']), + secondaryMuscles: serializer.fromJson(json['secondaryMuscles']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'type': serializer.toJson(type), + 'description': serializer.toJson(description), + 'category': serializer.toJson(category), + 'force': serializer.toJson(force), + 'level': serializer.toJson(level), + 'mechanic': serializer.toJson(mechanic), + 'equipment': serializer.toJson(equipment), + 'primaryMuscles': serializer.toJson(primaryMuscles), + 'secondaryMuscles': serializer.toJson(secondaryMuscles), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ActivitiesData copyWith( + {int? id, + String? title, + Value type = const Value.absent(), + Value description = const Value.absent(), + Value category = const Value.absent(), + Value force = const Value.absent(), + Value level = const Value.absent(), + Value mechanic = const Value.absent(), + Value equipment = const Value.absent(), + Value primaryMuscles = const Value.absent(), + Value secondaryMuscles = const Value.absent(), + DateTime? createdAt}) => + ActivitiesData( + id: id ?? this.id, + title: title ?? this.title, + type: type.present ? type.value : this.type, + description: description.present ? description.value : this.description, + category: category.present ? category.value : this.category, + force: force.present ? force.value : this.force, + level: level.present ? level.value : this.level, + mechanic: mechanic.present ? mechanic.value : this.mechanic, + equipment: equipment.present ? equipment.value : this.equipment, + primaryMuscles: + primaryMuscles.present ? primaryMuscles.value : this.primaryMuscles, + secondaryMuscles: secondaryMuscles.present + ? secondaryMuscles.value + : this.secondaryMuscles, + createdAt: createdAt ?? this.createdAt, + ); + ActivitiesData copyWithCompanion(ActivitiesCompanion data) { + return ActivitiesData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + type: data.type.present ? data.type.value : this.type, + description: + data.description.present ? data.description.value : this.description, + category: data.category.present ? data.category.value : this.category, + force: data.force.present ? data.force.value : this.force, + level: data.level.present ? data.level.value : this.level, + mechanic: data.mechanic.present ? data.mechanic.value : this.mechanic, + equipment: data.equipment.present ? data.equipment.value : this.equipment, + primaryMuscles: data.primaryMuscles.present + ? data.primaryMuscles.value + : this.primaryMuscles, + secondaryMuscles: data.secondaryMuscles.present + ? data.secondaryMuscles.value + : this.secondaryMuscles, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ActivitiesData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('type: $type, ') + ..write('description: $description, ') + ..write('category: $category, ') + ..write('force: $force, ') + ..write('level: $level, ') + ..write('mechanic: $mechanic, ') + ..write('equipment: $equipment, ') + ..write('primaryMuscles: $primaryMuscles, ') + ..write('secondaryMuscles: $secondaryMuscles, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(id, title, type, description, category, force, + level, mechanic, equipment, primaryMuscles, secondaryMuscles, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ActivitiesData && + other.id == this.id && + other.title == this.title && + other.type == this.type && + other.description == this.description && + other.category == this.category && + other.force == this.force && + other.level == this.level && + other.mechanic == this.mechanic && + other.equipment == this.equipment && + other.primaryMuscles == this.primaryMuscles && + other.secondaryMuscles == this.secondaryMuscles && + other.createdAt == this.createdAt); +} + +class ActivitiesCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value type; + final Value description; + final Value category; + final Value force; + final Value level; + final Value mechanic; + final Value equipment; + final Value primaryMuscles; + final Value secondaryMuscles; + final Value createdAt; + const ActivitiesCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.type = const Value.absent(), + this.description = const Value.absent(), + this.category = const Value.absent(), + this.force = const Value.absent(), + this.level = const Value.absent(), + this.mechanic = const Value.absent(), + this.equipment = const Value.absent(), + this.primaryMuscles = const Value.absent(), + this.secondaryMuscles = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ActivitiesCompanion.insert({ + this.id = const Value.absent(), + required String title, + this.type = const Value.absent(), + this.description = const Value.absent(), + this.category = const Value.absent(), + this.force = const Value.absent(), + this.level = const Value.absent(), + this.mechanic = const Value.absent(), + this.equipment = const Value.absent(), + this.primaryMuscles = const Value.absent(), + this.secondaryMuscles = const Value.absent(), + this.createdAt = const Value.absent(), + }) : title = Value(title); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? type, + Expression? description, + Expression? category, + Expression? force, + Expression? level, + Expression? mechanic, + Expression? equipment, + Expression? primaryMuscles, + Expression? secondaryMuscles, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (type != null) 'type': type, + if (description != null) 'body': description, + if (category != null) 'category': category, + if (force != null) 'force': force, + if (level != null) 'level': level, + if (mechanic != null) 'mechanic': mechanic, + if (equipment != null) 'equipment': equipment, + if (primaryMuscles != null) 'primary_muscles': primaryMuscles, + if (secondaryMuscles != null) 'secondary_muscles': secondaryMuscles, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ActivitiesCompanion copyWith( + {Value? id, + Value? title, + Value? type, + Value? description, + Value? category, + Value? force, + Value? level, + Value? mechanic, + Value? equipment, + Value? primaryMuscles, + Value? secondaryMuscles, + Value? createdAt}) { + return ActivitiesCompanion( + id: id ?? this.id, + title: title ?? this.title, + type: type ?? this.type, + description: description ?? this.description, + category: category ?? this.category, + force: force ?? this.force, + level: level ?? this.level, + mechanic: mechanic ?? this.mechanic, + equipment: equipment ?? this.equipment, + primaryMuscles: primaryMuscles ?? this.primaryMuscles, + secondaryMuscles: secondaryMuscles ?? this.secondaryMuscles, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (type.present) { + map['type'] = Variable(type.value); + } + if (description.present) { + map['body'] = Variable(description.value); + } + if (category.present) { + map['category'] = Variable(category.value); + } + if (force.present) { + map['force'] = Variable(force.value); + } + if (level.present) { + map['level'] = Variable(level.value); + } + if (mechanic.present) { + map['mechanic'] = Variable(mechanic.value); + } + if (equipment.present) { + map['equipment'] = Variable(equipment.value); + } + if (primaryMuscles.present) { + map['primary_muscles'] = Variable(primaryMuscles.value); + } + if (secondaryMuscles.present) { + map['secondary_muscles'] = Variable(secondaryMuscles.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ActivitiesCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('type: $type, ') + ..write('description: $description, ') + ..write('category: $category, ') + ..write('force: $force, ') + ..write('level: $level, ') + ..write('mechanic: $mechanic, ') + ..write('equipment: $equipment, ') + ..write('primaryMuscles: $primaryMuscles, ') + ..write('secondaryMuscles: $secondaryMuscles, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class SessionActivities extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + SessionActivities(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn sessionId = GeneratedColumn( + 'session_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES sessions (id) ON DELETE CASCADE')); + late final GeneratedColumn activityId = GeneratedColumn( + 'activity_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES activities (id) ON DELETE CASCADE')); + late final GeneratedColumn position = GeneratedColumn( + 'position', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn results = GeneratedColumn( + 'results', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, sessionId, activityId, position, results, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'session_activities'; + @override + Set get $primaryKey => {id}; + @override + SessionActivitiesData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return SessionActivitiesData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + sessionId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}session_id'])!, + activityId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}activity_id'])!, + position: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}position'])!, + results: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}results']), + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + SessionActivities createAlias(String alias) { + return SessionActivities(attachedDatabase, alias); + } +} + +class SessionActivitiesData extends DataClass + implements Insertable { + final int id; + final int sessionId; + final int activityId; + final int position; + final String? results; + final DateTime createdAt; + const SessionActivitiesData( + {required this.id, + required this.sessionId, + required this.activityId, + required this.position, + this.results, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['session_id'] = Variable(sessionId); + map['activity_id'] = Variable(activityId); + map['position'] = Variable(position); + if (!nullToAbsent || results != null) { + map['results'] = Variable(results); + } + map['created_at'] = Variable(createdAt); + return map; + } + + SessionActivitiesCompanion toCompanion(bool nullToAbsent) { + return SessionActivitiesCompanion( + id: Value(id), + sessionId: Value(sessionId), + activityId: Value(activityId), + position: Value(position), + results: results == null && nullToAbsent + ? const Value.absent() + : Value(results), + createdAt: Value(createdAt), + ); + } + + factory SessionActivitiesData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return SessionActivitiesData( + id: serializer.fromJson(json['id']), + sessionId: serializer.fromJson(json['sessionId']), + activityId: serializer.fromJson(json['activityId']), + position: serializer.fromJson(json['position']), + results: serializer.fromJson(json['results']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'sessionId': serializer.toJson(sessionId), + 'activityId': serializer.toJson(activityId), + 'position': serializer.toJson(position), + 'results': serializer.toJson(results), + 'createdAt': serializer.toJson(createdAt), + }; + } + + SessionActivitiesData copyWith( + {int? id, + int? sessionId, + int? activityId, + int? position, + Value results = const Value.absent(), + DateTime? createdAt}) => + SessionActivitiesData( + id: id ?? this.id, + sessionId: sessionId ?? this.sessionId, + activityId: activityId ?? this.activityId, + position: position ?? this.position, + results: results.present ? results.value : this.results, + createdAt: createdAt ?? this.createdAt, + ); + SessionActivitiesData copyWithCompanion(SessionActivitiesCompanion data) { + return SessionActivitiesData( + id: data.id.present ? data.id.value : this.id, + sessionId: data.sessionId.present ? data.sessionId.value : this.sessionId, + activityId: + data.activityId.present ? data.activityId.value : this.activityId, + position: data.position.present ? data.position.value : this.position, + results: data.results.present ? data.results.value : this.results, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('SessionActivitiesData(') + ..write('id: $id, ') + ..write('sessionId: $sessionId, ') + ..write('activityId: $activityId, ') + ..write('position: $position, ') + ..write('results: $results, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(id, sessionId, activityId, position, results, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is SessionActivitiesData && + other.id == this.id && + other.sessionId == this.sessionId && + other.activityId == this.activityId && + other.position == this.position && + other.results == this.results && + other.createdAt == this.createdAt); +} + +class SessionActivitiesCompanion + extends UpdateCompanion { + final Value id; + final Value sessionId; + final Value activityId; + final Value position; + final Value results; + final Value createdAt; + const SessionActivitiesCompanion({ + this.id = const Value.absent(), + this.sessionId = const Value.absent(), + this.activityId = const Value.absent(), + this.position = const Value.absent(), + this.results = const Value.absent(), + this.createdAt = const Value.absent(), + }); + SessionActivitiesCompanion.insert({ + this.id = const Value.absent(), + required int sessionId, + required int activityId, + required int position, + this.results = const Value.absent(), + this.createdAt = const Value.absent(), + }) : sessionId = Value(sessionId), + activityId = Value(activityId), + position = Value(position); + static Insertable custom({ + Expression? id, + Expression? sessionId, + Expression? activityId, + Expression? position, + Expression? results, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (sessionId != null) 'session_id': sessionId, + if (activityId != null) 'activity_id': activityId, + if (position != null) 'position': position, + if (results != null) 'results': results, + if (createdAt != null) 'created_at': createdAt, + }); + } + + SessionActivitiesCompanion copyWith( + {Value? id, + Value? sessionId, + Value? activityId, + Value? position, + Value? results, + Value? createdAt}) { + return SessionActivitiesCompanion( + id: id ?? this.id, + sessionId: sessionId ?? this.sessionId, + activityId: activityId ?? this.activityId, + position: position ?? this.position, + results: results ?? this.results, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (sessionId.present) { + map['session_id'] = Variable(sessionId.value); + } + if (activityId.present) { + map['activity_id'] = Variable(activityId.value); + } + if (position.present) { + map['position'] = Variable(position.value); + } + if (results.present) { + map['results'] = Variable(results.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('SessionActivitiesCompanion(') + ..write('id: $id, ') + ..write('sessionId: $sessionId, ') + ..write('activityId: $activityId, ') + ..write('position: $position, ') + ..write('results: $results, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class Actions extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + Actions(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 64), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn description = GeneratedColumn( + 'body', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn totalSets = GeneratedColumn( + 'total_sets', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn totalReps = GeneratedColumn( + 'total_reps', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 1, maxTextLength: 32), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn restBeforeSets = GeneratedColumn( + 'rest_before_sets', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn restBetweenSets = GeneratedColumn( + 'rest_between_sets', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn restBetweenReps = GeneratedColumn( + 'rest_between_reps', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn restAfterSets = GeneratedColumn( + 'rest_after_sets', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn repType = GeneratedColumn( + 'rep_type', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn repLength = GeneratedColumn( + 'rep_length', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn repWeights = GeneratedColumn( + 'rep_weights', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn setWeights = GeneratedColumn( + 'set_weights', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn isAlternating = GeneratedColumn( + 'is_alternating', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("is_alternating" IN (0, 1))'), + defaultValue: Variable(false)); + late final GeneratedColumn tempo = GeneratedColumn( + 'tempo', aliasedName, true, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 6, maxTextLength: 36), + type: DriftSqlType.string, + requiredDuringInsert: false); + late final GeneratedColumn status = GeneratedColumn( + 'status', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: Variable('pending')); + late final GeneratedColumn state = GeneratedColumn( + 'state', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: Variable("{}")); + late final GeneratedColumn set = GeneratedColumn( + 'set', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => [ + id, + title, + description, + totalSets, + totalReps, + restBeforeSets, + restBetweenSets, + restBetweenReps, + restAfterSets, + repType, + repLength, + repWeights, + setWeights, + isAlternating, + tempo, + status, + state, + set, + createdAt + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'actions'; + @override + Set get $primaryKey => {id}; + @override + ActionsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ActionsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + description: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body'])!, + totalSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}total_sets'])!, + totalReps: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}total_reps'])!, + restBeforeSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_before_sets']), + restBetweenSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_between_sets']), + restBetweenReps: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_between_reps']), + restAfterSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_after_sets']), + repType: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}rep_type'])!, + repLength: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rep_length']), + repWeights: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}rep_weights']), + setWeights: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}set_weights']), + isAlternating: attachedDatabase.typeMapping + .read(DriftSqlType.bool, data['${effectivePrefix}is_alternating'])!, + tempo: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}tempo']), + status: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}status'])!, + state: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}state'])!, + set: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}set'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + Actions createAlias(String alias) { + return Actions(attachedDatabase, alias); + } +} + +class ActionsData extends DataClass implements Insertable { + final int id; + final String title; + final String description; + final int totalSets; + final String totalReps; + final int? restBeforeSets; + final int? restBetweenSets; + final int? restBetweenReps; + final int? restAfterSets; + final String repType; + final int? repLength; + final String? repWeights; + final String? setWeights; + final bool isAlternating; + final String? tempo; + final String status; + final String state; + final String set; + final DateTime createdAt; + const ActionsData( + {required this.id, + required this.title, + required this.description, + required this.totalSets, + required this.totalReps, + this.restBeforeSets, + this.restBetweenSets, + this.restBetweenReps, + this.restAfterSets, + required this.repType, + this.repLength, + this.repWeights, + this.setWeights, + required this.isAlternating, + this.tempo, + required this.status, + required this.state, + required this.set, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + map['body'] = Variable(description); + map['total_sets'] = Variable(totalSets); + map['total_reps'] = Variable(totalReps); + if (!nullToAbsent || restBeforeSets != null) { + map['rest_before_sets'] = Variable(restBeforeSets); + } + if (!nullToAbsent || restBetweenSets != null) { + map['rest_between_sets'] = Variable(restBetweenSets); + } + if (!nullToAbsent || restBetweenReps != null) { + map['rest_between_reps'] = Variable(restBetweenReps); + } + if (!nullToAbsent || restAfterSets != null) { + map['rest_after_sets'] = Variable(restAfterSets); + } + map['rep_type'] = Variable(repType); + if (!nullToAbsent || repLength != null) { + map['rep_length'] = Variable(repLength); + } + if (!nullToAbsent || repWeights != null) { + map['rep_weights'] = Variable(repWeights); + } + if (!nullToAbsent || setWeights != null) { + map['set_weights'] = Variable(setWeights); + } + map['is_alternating'] = Variable(isAlternating); + if (!nullToAbsent || tempo != null) { + map['tempo'] = Variable(tempo); + } + map['status'] = Variable(status); + map['state'] = Variable(state); + map['set'] = Variable(set); + map['created_at'] = Variable(createdAt); + return map; + } + + ActionsCompanion toCompanion(bool nullToAbsent) { + return ActionsCompanion( + id: Value(id), + title: Value(title), + description: Value(description), + totalSets: Value(totalSets), + totalReps: Value(totalReps), + restBeforeSets: restBeforeSets == null && nullToAbsent + ? const Value.absent() + : Value(restBeforeSets), + restBetweenSets: restBetweenSets == null && nullToAbsent + ? const Value.absent() + : Value(restBetweenSets), + restBetweenReps: restBetweenReps == null && nullToAbsent + ? const Value.absent() + : Value(restBetweenReps), + restAfterSets: restAfterSets == null && nullToAbsent + ? const Value.absent() + : Value(restAfterSets), + repType: Value(repType), + repLength: repLength == null && nullToAbsent + ? const Value.absent() + : Value(repLength), + repWeights: repWeights == null && nullToAbsent + ? const Value.absent() + : Value(repWeights), + setWeights: setWeights == null && nullToAbsent + ? const Value.absent() + : Value(setWeights), + isAlternating: Value(isAlternating), + tempo: + tempo == null && nullToAbsent ? const Value.absent() : Value(tempo), + status: Value(status), + state: Value(state), + set: Value(set), + createdAt: Value(createdAt), + ); + } + + factory ActionsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ActionsData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + description: serializer.fromJson(json['description']), + totalSets: serializer.fromJson(json['totalSets']), + totalReps: serializer.fromJson(json['totalReps']), + restBeforeSets: serializer.fromJson(json['restBeforeSets']), + restBetweenSets: serializer.fromJson(json['restBetweenSets']), + restBetweenReps: serializer.fromJson(json['restBetweenReps']), + restAfterSets: serializer.fromJson(json['restAfterSets']), + repType: serializer.fromJson(json['repType']), + repLength: serializer.fromJson(json['repLength']), + repWeights: serializer.fromJson(json['repWeights']), + setWeights: serializer.fromJson(json['setWeights']), + isAlternating: serializer.fromJson(json['isAlternating']), + tempo: serializer.fromJson(json['tempo']), + status: serializer.fromJson(json['status']), + state: serializer.fromJson(json['state']), + set: serializer.fromJson(json['set']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'description': serializer.toJson(description), + 'totalSets': serializer.toJson(totalSets), + 'totalReps': serializer.toJson(totalReps), + 'restBeforeSets': serializer.toJson(restBeforeSets), + 'restBetweenSets': serializer.toJson(restBetweenSets), + 'restBetweenReps': serializer.toJson(restBetweenReps), + 'restAfterSets': serializer.toJson(restAfterSets), + 'repType': serializer.toJson(repType), + 'repLength': serializer.toJson(repLength), + 'repWeights': serializer.toJson(repWeights), + 'setWeights': serializer.toJson(setWeights), + 'isAlternating': serializer.toJson(isAlternating), + 'tempo': serializer.toJson(tempo), + 'status': serializer.toJson(status), + 'state': serializer.toJson(state), + 'set': serializer.toJson(set), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ActionsData copyWith( + {int? id, + String? title, + String? description, + int? totalSets, + String? totalReps, + Value restBeforeSets = const Value.absent(), + Value restBetweenSets = const Value.absent(), + Value restBetweenReps = const Value.absent(), + Value restAfterSets = const Value.absent(), + String? repType, + Value repLength = const Value.absent(), + Value repWeights = const Value.absent(), + Value setWeights = const Value.absent(), + bool? isAlternating, + Value tempo = const Value.absent(), + String? status, + String? state, + String? set, + DateTime? createdAt}) => + ActionsData( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + totalSets: totalSets ?? this.totalSets, + totalReps: totalReps ?? this.totalReps, + restBeforeSets: + restBeforeSets.present ? restBeforeSets.value : this.restBeforeSets, + restBetweenSets: restBetweenSets.present + ? restBetweenSets.value + : this.restBetweenSets, + restBetweenReps: restBetweenReps.present + ? restBetweenReps.value + : this.restBetweenReps, + restAfterSets: + restAfterSets.present ? restAfterSets.value : this.restAfterSets, + repType: repType ?? this.repType, + repLength: repLength.present ? repLength.value : this.repLength, + repWeights: repWeights.present ? repWeights.value : this.repWeights, + setWeights: setWeights.present ? setWeights.value : this.setWeights, + isAlternating: isAlternating ?? this.isAlternating, + tempo: tempo.present ? tempo.value : this.tempo, + status: status ?? this.status, + state: state ?? this.state, + set: set ?? this.set, + createdAt: createdAt ?? this.createdAt, + ); + ActionsData copyWithCompanion(ActionsCompanion data) { + return ActionsData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + description: + data.description.present ? data.description.value : this.description, + totalSets: data.totalSets.present ? data.totalSets.value : this.totalSets, + totalReps: data.totalReps.present ? data.totalReps.value : this.totalReps, + restBeforeSets: data.restBeforeSets.present + ? data.restBeforeSets.value + : this.restBeforeSets, + restBetweenSets: data.restBetweenSets.present + ? data.restBetweenSets.value + : this.restBetweenSets, + restBetweenReps: data.restBetweenReps.present + ? data.restBetweenReps.value + : this.restBetweenReps, + restAfterSets: data.restAfterSets.present + ? data.restAfterSets.value + : this.restAfterSets, + repType: data.repType.present ? data.repType.value : this.repType, + repLength: data.repLength.present ? data.repLength.value : this.repLength, + repWeights: + data.repWeights.present ? data.repWeights.value : this.repWeights, + setWeights: + data.setWeights.present ? data.setWeights.value : this.setWeights, + isAlternating: data.isAlternating.present + ? data.isAlternating.value + : this.isAlternating, + tempo: data.tempo.present ? data.tempo.value : this.tempo, + status: data.status.present ? data.status.value : this.status, + state: data.state.present ? data.state.value : this.state, + set: data.set.present ? data.set.value : this.set, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ActionsData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('totalSets: $totalSets, ') + ..write('totalReps: $totalReps, ') + ..write('restBeforeSets: $restBeforeSets, ') + ..write('restBetweenSets: $restBetweenSets, ') + ..write('restBetweenReps: $restBetweenReps, ') + ..write('restAfterSets: $restAfterSets, ') + ..write('repType: $repType, ') + ..write('repLength: $repLength, ') + ..write('repWeights: $repWeights, ') + ..write('setWeights: $setWeights, ') + ..write('isAlternating: $isAlternating, ') + ..write('tempo: $tempo, ') + ..write('status: $status, ') + ..write('state: $state, ') + ..write('set: $set, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash( + id, + title, + description, + totalSets, + totalReps, + restBeforeSets, + restBetweenSets, + restBetweenReps, + restAfterSets, + repType, + repLength, + repWeights, + setWeights, + isAlternating, + tempo, + status, + state, + set, + createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ActionsData && + other.id == this.id && + other.title == this.title && + other.description == this.description && + other.totalSets == this.totalSets && + other.totalReps == this.totalReps && + other.restBeforeSets == this.restBeforeSets && + other.restBetweenSets == this.restBetweenSets && + other.restBetweenReps == this.restBetweenReps && + other.restAfterSets == this.restAfterSets && + other.repType == this.repType && + other.repLength == this.repLength && + other.repWeights == this.repWeights && + other.setWeights == this.setWeights && + other.isAlternating == this.isAlternating && + other.tempo == this.tempo && + other.status == this.status && + other.state == this.state && + other.set == this.set && + other.createdAt == this.createdAt); +} + +class ActionsCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value description; + final Value totalSets; + final Value totalReps; + final Value restBeforeSets; + final Value restBetweenSets; + final Value restBetweenReps; + final Value restAfterSets; + final Value repType; + final Value repLength; + final Value repWeights; + final Value setWeights; + final Value isAlternating; + final Value tempo; + final Value status; + final Value state; + final Value set; + final Value createdAt; + const ActionsCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.description = const Value.absent(), + this.totalSets = const Value.absent(), + this.totalReps = const Value.absent(), + this.restBeforeSets = const Value.absent(), + this.restBetweenSets = const Value.absent(), + this.restBetweenReps = const Value.absent(), + this.restAfterSets = const Value.absent(), + this.repType = const Value.absent(), + this.repLength = const Value.absent(), + this.repWeights = const Value.absent(), + this.setWeights = const Value.absent(), + this.isAlternating = const Value.absent(), + this.tempo = const Value.absent(), + this.status = const Value.absent(), + this.state = const Value.absent(), + this.set = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ActionsCompanion.insert({ + this.id = const Value.absent(), + required String title, + required String description, + required int totalSets, + required String totalReps, + this.restBeforeSets = const Value.absent(), + this.restBetweenSets = const Value.absent(), + this.restBetweenReps = const Value.absent(), + this.restAfterSets = const Value.absent(), + required String repType, + this.repLength = const Value.absent(), + this.repWeights = const Value.absent(), + this.setWeights = const Value.absent(), + this.isAlternating = const Value.absent(), + this.tempo = const Value.absent(), + this.status = const Value.absent(), + this.state = const Value.absent(), + required String set, + this.createdAt = const Value.absent(), + }) : title = Value(title), + description = Value(description), + totalSets = Value(totalSets), + totalReps = Value(totalReps), + repType = Value(repType), + set = Value(set); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? description, + Expression? totalSets, + Expression? totalReps, + Expression? restBeforeSets, + Expression? restBetweenSets, + Expression? restBetweenReps, + Expression? restAfterSets, + Expression? repType, + Expression? repLength, + Expression? repWeights, + Expression? setWeights, + Expression? isAlternating, + Expression? tempo, + Expression? status, + Expression? state, + Expression? set, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (description != null) 'body': description, + if (totalSets != null) 'total_sets': totalSets, + if (totalReps != null) 'total_reps': totalReps, + if (restBeforeSets != null) 'rest_before_sets': restBeforeSets, + if (restBetweenSets != null) 'rest_between_sets': restBetweenSets, + if (restBetweenReps != null) 'rest_between_reps': restBetweenReps, + if (restAfterSets != null) 'rest_after_sets': restAfterSets, + if (repType != null) 'rep_type': repType, + if (repLength != null) 'rep_length': repLength, + if (repWeights != null) 'rep_weights': repWeights, + if (setWeights != null) 'set_weights': setWeights, + if (isAlternating != null) 'is_alternating': isAlternating, + if (tempo != null) 'tempo': tempo, + if (status != null) 'status': status, + if (state != null) 'state': state, + if (set != null) 'set': set, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ActionsCompanion copyWith( + {Value? id, + Value? title, + Value? description, + Value? totalSets, + Value? totalReps, + Value? restBeforeSets, + Value? restBetweenSets, + Value? restBetweenReps, + Value? restAfterSets, + Value? repType, + Value? repLength, + Value? repWeights, + Value? setWeights, + Value? isAlternating, + Value? tempo, + Value? status, + Value? state, + Value? set, + Value? createdAt}) { + return ActionsCompanion( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + totalSets: totalSets ?? this.totalSets, + totalReps: totalReps ?? this.totalReps, + restBeforeSets: restBeforeSets ?? this.restBeforeSets, + restBetweenSets: restBetweenSets ?? this.restBetweenSets, + restBetweenReps: restBetweenReps ?? this.restBetweenReps, + restAfterSets: restAfterSets ?? this.restAfterSets, + repType: repType ?? this.repType, + repLength: repLength ?? this.repLength, + repWeights: repWeights ?? this.repWeights, + setWeights: setWeights ?? this.setWeights, + isAlternating: isAlternating ?? this.isAlternating, + tempo: tempo ?? this.tempo, + status: status ?? this.status, + state: state ?? this.state, + set: set ?? this.set, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (description.present) { + map['body'] = Variable(description.value); + } + if (totalSets.present) { + map['total_sets'] = Variable(totalSets.value); + } + if (totalReps.present) { + map['total_reps'] = Variable(totalReps.value); + } + if (restBeforeSets.present) { + map['rest_before_sets'] = Variable(restBeforeSets.value); + } + if (restBetweenSets.present) { + map['rest_between_sets'] = Variable(restBetweenSets.value); + } + if (restBetweenReps.present) { + map['rest_between_reps'] = Variable(restBetweenReps.value); + } + if (restAfterSets.present) { + map['rest_after_sets'] = Variable(restAfterSets.value); + } + if (repType.present) { + map['rep_type'] = Variable(repType.value); + } + if (repLength.present) { + map['rep_length'] = Variable(repLength.value); + } + if (repWeights.present) { + map['rep_weights'] = Variable(repWeights.value); + } + if (setWeights.present) { + map['set_weights'] = Variable(setWeights.value); + } + if (isAlternating.present) { + map['is_alternating'] = Variable(isAlternating.value); + } + if (tempo.present) { + map['tempo'] = Variable(tempo.value); + } + if (status.present) { + map['status'] = Variable(status.value); + } + if (state.present) { + map['state'] = Variable(state.value); + } + if (set.present) { + map['set'] = Variable(set.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ActionsCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('totalSets: $totalSets, ') + ..write('totalReps: $totalReps, ') + ..write('restBeforeSets: $restBeforeSets, ') + ..write('restBetweenSets: $restBetweenSets, ') + ..write('restBetweenReps: $restBetweenReps, ') + ..write('restAfterSets: $restAfterSets, ') + ..write('repType: $repType, ') + ..write('repLength: $repLength, ') + ..write('repWeights: $repWeights, ') + ..write('setWeights: $setWeights, ') + ..write('isAlternating: $isAlternating, ') + ..write('tempo: $tempo, ') + ..write('status: $status, ') + ..write('state: $state, ') + ..write('set: $set, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class ActivityActions extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + ActivityActions(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn activityId = GeneratedColumn( + 'activity_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES activities (id) ON DELETE CASCADE')); + late final GeneratedColumn actionId = GeneratedColumn( + 'action_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES actions (id) ON DELETE CASCADE')); + late final GeneratedColumn position = GeneratedColumn( + 'position', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, activityId, actionId, position, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'activity_actions'; + @override + Set get $primaryKey => {id}; + @override + ActivityActionsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ActivityActionsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + activityId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}activity_id'])!, + actionId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}action_id'])!, + position: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}position'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + ActivityActions createAlias(String alias) { + return ActivityActions(attachedDatabase, alias); + } +} + +class ActivityActionsData extends DataClass + implements Insertable { + final int id; + final int activityId; + final int actionId; + final int position; + final DateTime createdAt; + const ActivityActionsData( + {required this.id, + required this.activityId, + required this.actionId, + required this.position, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['activity_id'] = Variable(activityId); + map['action_id'] = Variable(actionId); + map['position'] = Variable(position); + map['created_at'] = Variable(createdAt); + return map; + } + + ActivityActionsCompanion toCompanion(bool nullToAbsent) { + return ActivityActionsCompanion( + id: Value(id), + activityId: Value(activityId), + actionId: Value(actionId), + position: Value(position), + createdAt: Value(createdAt), + ); + } + + factory ActivityActionsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ActivityActionsData( + id: serializer.fromJson(json['id']), + activityId: serializer.fromJson(json['activityId']), + actionId: serializer.fromJson(json['actionId']), + position: serializer.fromJson(json['position']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'activityId': serializer.toJson(activityId), + 'actionId': serializer.toJson(actionId), + 'position': serializer.toJson(position), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ActivityActionsData copyWith( + {int? id, + int? activityId, + int? actionId, + int? position, + DateTime? createdAt}) => + ActivityActionsData( + id: id ?? this.id, + activityId: activityId ?? this.activityId, + actionId: actionId ?? this.actionId, + position: position ?? this.position, + createdAt: createdAt ?? this.createdAt, + ); + ActivityActionsData copyWithCompanion(ActivityActionsCompanion data) { + return ActivityActionsData( + id: data.id.present ? data.id.value : this.id, + activityId: + data.activityId.present ? data.activityId.value : this.activityId, + actionId: data.actionId.present ? data.actionId.value : this.actionId, + position: data.position.present ? data.position.value : this.position, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ActivityActionsData(') + ..write('id: $id, ') + ..write('activityId: $activityId, ') + ..write('actionId: $actionId, ') + ..write('position: $position, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(id, activityId, actionId, position, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ActivityActionsData && + other.id == this.id && + other.activityId == this.activityId && + other.actionId == this.actionId && + other.position == this.position && + other.createdAt == this.createdAt); +} + +class ActivityActionsCompanion extends UpdateCompanion { + final Value id; + final Value activityId; + final Value actionId; + final Value position; + final Value createdAt; + const ActivityActionsCompanion({ + this.id = const Value.absent(), + this.activityId = const Value.absent(), + this.actionId = const Value.absent(), + this.position = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ActivityActionsCompanion.insert({ + this.id = const Value.absent(), + required int activityId, + required int actionId, + required int position, + this.createdAt = const Value.absent(), + }) : activityId = Value(activityId), + actionId = Value(actionId), + position = Value(position); + static Insertable custom({ + Expression? id, + Expression? activityId, + Expression? actionId, + Expression? position, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (activityId != null) 'activity_id': activityId, + if (actionId != null) 'action_id': actionId, + if (position != null) 'position': position, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ActivityActionsCompanion copyWith( + {Value? id, + Value? activityId, + Value? actionId, + Value? position, + Value? createdAt}) { + return ActivityActionsCompanion( + id: id ?? this.id, + activityId: activityId ?? this.activityId, + actionId: actionId ?? this.actionId, + position: position ?? this.position, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (activityId.present) { + map['activity_id'] = Variable(activityId.value); + } + if (actionId.present) { + map['action_id'] = Variable(actionId.value); + } + if (position.present) { + map['position'] = Variable(position.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ActivityActionsCompanion(') + ..write('id: $id, ') + ..write('activityId: $activityId, ') + ..write('actionId: $actionId, ') + ..write('position: $position, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class MediaItems extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + MediaItems(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 64), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn description = GeneratedColumn( + 'body', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn reference = GeneratedColumn( + 'reference', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn type = GeneratedColumn( + 'type', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, title, description, reference, type, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'media_items'; + @override + Set get $primaryKey => {id}; + @override + MediaItemsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return MediaItemsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + description: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body'])!, + reference: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}reference'])!, + type: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}type'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + MediaItems createAlias(String alias) { + return MediaItems(attachedDatabase, alias); + } +} + +class MediaItemsData extends DataClass implements Insertable { + final int id; + final String title; + final String description; + final String reference; + final String type; + final DateTime createdAt; + const MediaItemsData( + {required this.id, + required this.title, + required this.description, + required this.reference, + required this.type, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + map['body'] = Variable(description); + map['reference'] = Variable(reference); + map['type'] = Variable(type); + map['created_at'] = Variable(createdAt); + return map; + } + + MediaItemsCompanion toCompanion(bool nullToAbsent) { + return MediaItemsCompanion( + id: Value(id), + title: Value(title), + description: Value(description), + reference: Value(reference), + type: Value(type), + createdAt: Value(createdAt), + ); + } + + factory MediaItemsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return MediaItemsData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + description: serializer.fromJson(json['description']), + reference: serializer.fromJson(json['reference']), + type: serializer.fromJson(json['type']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'description': serializer.toJson(description), + 'reference': serializer.toJson(reference), + 'type': serializer.toJson(type), + 'createdAt': serializer.toJson(createdAt), + }; + } + + MediaItemsData copyWith( + {int? id, + String? title, + String? description, + String? reference, + String? type, + DateTime? createdAt}) => + MediaItemsData( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + reference: reference ?? this.reference, + type: type ?? this.type, + createdAt: createdAt ?? this.createdAt, + ); + MediaItemsData copyWithCompanion(MediaItemsCompanion data) { + return MediaItemsData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + description: + data.description.present ? data.description.value : this.description, + reference: data.reference.present ? data.reference.value : this.reference, + type: data.type.present ? data.type.value : this.type, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('MediaItemsData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('reference: $reference, ') + ..write('type: $type, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(id, title, description, reference, type, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is MediaItemsData && + other.id == this.id && + other.title == this.title && + other.description == this.description && + other.reference == this.reference && + other.type == this.type && + other.createdAt == this.createdAt); +} + +class MediaItemsCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value description; + final Value reference; + final Value type; + final Value createdAt; + const MediaItemsCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.description = const Value.absent(), + this.reference = const Value.absent(), + this.type = const Value.absent(), + this.createdAt = const Value.absent(), + }); + MediaItemsCompanion.insert({ + this.id = const Value.absent(), + required String title, + required String description, + required String reference, + required String type, + this.createdAt = const Value.absent(), + }) : title = Value(title), + description = Value(description), + reference = Value(reference), + type = Value(type); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? description, + Expression? reference, + Expression? type, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (description != null) 'body': description, + if (reference != null) 'reference': reference, + if (type != null) 'type': type, + if (createdAt != null) 'created_at': createdAt, + }); + } + + MediaItemsCompanion copyWith( + {Value? id, + Value? title, + Value? description, + Value? reference, + Value? type, + Value? createdAt}) { + return MediaItemsCompanion( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + reference: reference ?? this.reference, + type: type ?? this.type, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (description.present) { + map['body'] = Variable(description.value); + } + if (reference.present) { + map['reference'] = Variable(reference.value); + } + if (type.present) { + map['type'] = Variable(type.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('MediaItemsCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('reference: $reference, ') + ..write('type: $type, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class ObjectMediaItems extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + ObjectMediaItems(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn objectId = GeneratedColumn( + 'object_id', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn objectType = GeneratedColumn( + 'object_type', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn mediaId = GeneratedColumn( + 'media_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES media_items (id) ON DELETE CASCADE')); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, objectId, objectType, mediaId, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'object_media_items'; + @override + Set get $primaryKey => {id}; + @override + ObjectMediaItemsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ObjectMediaItemsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + objectId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}object_id'])!, + objectType: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}object_type'])!, + mediaId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}media_id'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + ObjectMediaItems createAlias(String alias) { + return ObjectMediaItems(attachedDatabase, alias); + } +} + +class ObjectMediaItemsData extends DataClass + implements Insertable { + final int id; + final int objectId; + final String objectType; + final int mediaId; + final DateTime createdAt; + const ObjectMediaItemsData( + {required this.id, + required this.objectId, + required this.objectType, + required this.mediaId, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['object_id'] = Variable(objectId); + map['object_type'] = Variable(objectType); + map['media_id'] = Variable(mediaId); + map['created_at'] = Variable(createdAt); + return map; + } + + ObjectMediaItemsCompanion toCompanion(bool nullToAbsent) { + return ObjectMediaItemsCompanion( + id: Value(id), + objectId: Value(objectId), + objectType: Value(objectType), + mediaId: Value(mediaId), + createdAt: Value(createdAt), + ); + } + + factory ObjectMediaItemsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ObjectMediaItemsData( + id: serializer.fromJson(json['id']), + objectId: serializer.fromJson(json['objectId']), + objectType: serializer.fromJson(json['objectType']), + mediaId: serializer.fromJson(json['mediaId']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'objectId': serializer.toJson(objectId), + 'objectType': serializer.toJson(objectType), + 'mediaId': serializer.toJson(mediaId), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ObjectMediaItemsData copyWith( + {int? id, + int? objectId, + String? objectType, + int? mediaId, + DateTime? createdAt}) => + ObjectMediaItemsData( + id: id ?? this.id, + objectId: objectId ?? this.objectId, + objectType: objectType ?? this.objectType, + mediaId: mediaId ?? this.mediaId, + createdAt: createdAt ?? this.createdAt, + ); + ObjectMediaItemsData copyWithCompanion(ObjectMediaItemsCompanion data) { + return ObjectMediaItemsData( + id: data.id.present ? data.id.value : this.id, + objectId: data.objectId.present ? data.objectId.value : this.objectId, + objectType: + data.objectType.present ? data.objectType.value : this.objectType, + mediaId: data.mediaId.present ? data.mediaId.value : this.mediaId, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ObjectMediaItemsData(') + ..write('id: $id, ') + ..write('objectId: $objectId, ') + ..write('objectType: $objectType, ') + ..write('mediaId: $mediaId, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(id, objectId, objectType, mediaId, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ObjectMediaItemsData && + other.id == this.id && + other.objectId == this.objectId && + other.objectType == this.objectType && + other.mediaId == this.mediaId && + other.createdAt == this.createdAt); +} + +class ObjectMediaItemsCompanion extends UpdateCompanion { + final Value id; + final Value objectId; + final Value objectType; + final Value mediaId; + final Value createdAt; + const ObjectMediaItemsCompanion({ + this.id = const Value.absent(), + this.objectId = const Value.absent(), + this.objectType = const Value.absent(), + this.mediaId = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ObjectMediaItemsCompanion.insert({ + this.id = const Value.absent(), + required int objectId, + required String objectType, + required int mediaId, + this.createdAt = const Value.absent(), + }) : objectId = Value(objectId), + objectType = Value(objectType), + mediaId = Value(mediaId); + static Insertable custom({ + Expression? id, + Expression? objectId, + Expression? objectType, + Expression? mediaId, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (objectId != null) 'object_id': objectId, + if (objectType != null) 'object_type': objectType, + if (mediaId != null) 'media_id': mediaId, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ObjectMediaItemsCompanion copyWith( + {Value? id, + Value? objectId, + Value? objectType, + Value? mediaId, + Value? createdAt}) { + return ObjectMediaItemsCompanion( + id: id ?? this.id, + objectId: objectId ?? this.objectId, + objectType: objectType ?? this.objectType, + mediaId: mediaId ?? this.mediaId, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (objectId.present) { + map['object_id'] = Variable(objectId.value); + } + if (objectType.present) { + map['object_type'] = Variable(objectType.value); + } + if (mediaId.present) { + map['media_id'] = Variable(mediaId.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ObjectMediaItemsCompanion(') + ..write('id: $id, ') + ..write('objectId: $objectId, ') + ..write('objectType: $objectType, ') + ..write('mediaId: $mediaId, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class DatabaseAtV28 extends GeneratedDatabase { + DatabaseAtV28(QueryExecutor e) : super(e); + late final Sessions sessions = Sessions(this); + late final Activities activities = Activities(this); + late final SessionActivities sessionActivities = SessionActivities(this); + late final Actions actions = Actions(this); + late final ActivityActions activityActions = ActivityActions(this); + late final MediaItems mediaItems = MediaItems(this); + late final ObjectMediaItems objectMediaItems = ObjectMediaItems(this); + @override + Iterable> get allTables => + allSchemaEntities.whereType>(); + @override + List get allSchemaEntities => [ + sessions, + activities, + sessionActivities, + actions, + activityActions, + mediaItems, + objectMediaItems + ]; + @override + int get schemaVersion => 28; +} diff --git a/test/drift/sendtrain/generated/schema_v29.dart b/test/drift/sendtrain/generated/schema_v29.dart new file mode 100644 index 0000000..07bff1f --- /dev/null +++ b/test/drift/sendtrain/generated/schema_v29.dart @@ -0,0 +1,2702 @@ +// dart format width=80 +// GENERATED CODE, DO NOT EDIT BY HAND. +// ignore_for_file: type=lint +import 'package:drift/drift.dart'; + +class Sessions extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + Sessions(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 32), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn content = GeneratedColumn( + 'body', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn status = GeneratedColumn( + 'status', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn achievements = GeneratedColumn( + 'achievements', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn address = GeneratedColumn( + 'address', aliasedName, true, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 256), + type: DriftSqlType.string, + requiredDuringInsert: false); + late final GeneratedColumn date = GeneratedColumn( + 'date', aliasedName, true, + type: DriftSqlType.dateTime, requiredDuringInsert: false); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, title, content, status, achievements, address, date, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'sessions'; + @override + Set get $primaryKey => {id}; + @override + SessionsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return SessionsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + content: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body'])!, + status: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}status'])!, + achievements: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}achievements']), + address: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}address']), + date: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}date']), + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + Sessions createAlias(String alias) { + return Sessions(attachedDatabase, alias); + } +} + +class SessionsData extends DataClass implements Insertable { + final int id; + final String title; + final String content; + final String status; + final String? achievements; + final String? address; + final DateTime? date; + final DateTime createdAt; + const SessionsData( + {required this.id, + required this.title, + required this.content, + required this.status, + this.achievements, + this.address, + this.date, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + map['body'] = Variable(content); + map['status'] = Variable(status); + if (!nullToAbsent || achievements != null) { + map['achievements'] = Variable(achievements); + } + if (!nullToAbsent || address != null) { + map['address'] = Variable(address); + } + if (!nullToAbsent || date != null) { + map['date'] = Variable(date); + } + map['created_at'] = Variable(createdAt); + return map; + } + + SessionsCompanion toCompanion(bool nullToAbsent) { + return SessionsCompanion( + id: Value(id), + title: Value(title), + content: Value(content), + status: Value(status), + achievements: achievements == null && nullToAbsent + ? const Value.absent() + : Value(achievements), + address: address == null && nullToAbsent + ? const Value.absent() + : Value(address), + date: date == null && nullToAbsent ? const Value.absent() : Value(date), + createdAt: Value(createdAt), + ); + } + + factory SessionsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return SessionsData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + content: serializer.fromJson(json['content']), + status: serializer.fromJson(json['status']), + achievements: serializer.fromJson(json['achievements']), + address: serializer.fromJson(json['address']), + date: serializer.fromJson(json['date']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'content': serializer.toJson(content), + 'status': serializer.toJson(status), + 'achievements': serializer.toJson(achievements), + 'address': serializer.toJson(address), + 'date': serializer.toJson(date), + 'createdAt': serializer.toJson(createdAt), + }; + } + + SessionsData copyWith( + {int? id, + String? title, + String? content, + String? status, + Value achievements = const Value.absent(), + Value address = const Value.absent(), + Value date = const Value.absent(), + DateTime? createdAt}) => + SessionsData( + id: id ?? this.id, + title: title ?? this.title, + content: content ?? this.content, + status: status ?? this.status, + achievements: + achievements.present ? achievements.value : this.achievements, + address: address.present ? address.value : this.address, + date: date.present ? date.value : this.date, + createdAt: createdAt ?? this.createdAt, + ); + SessionsData copyWithCompanion(SessionsCompanion data) { + return SessionsData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + content: data.content.present ? data.content.value : this.content, + status: data.status.present ? data.status.value : this.status, + achievements: data.achievements.present + ? data.achievements.value + : this.achievements, + address: data.address.present ? data.address.value : this.address, + date: data.date.present ? data.date.value : this.date, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('SessionsData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('content: $content, ') + ..write('status: $status, ') + ..write('achievements: $achievements, ') + ..write('address: $address, ') + ..write('date: $date, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash( + id, title, content, status, achievements, address, date, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is SessionsData && + other.id == this.id && + other.title == this.title && + other.content == this.content && + other.status == this.status && + other.achievements == this.achievements && + other.address == this.address && + other.date == this.date && + other.createdAt == this.createdAt); +} + +class SessionsCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value content; + final Value status; + final Value achievements; + final Value address; + final Value date; + final Value createdAt; + const SessionsCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.content = const Value.absent(), + this.status = const Value.absent(), + this.achievements = const Value.absent(), + this.address = const Value.absent(), + this.date = const Value.absent(), + this.createdAt = const Value.absent(), + }); + SessionsCompanion.insert({ + this.id = const Value.absent(), + required String title, + required String content, + required String status, + this.achievements = const Value.absent(), + this.address = const Value.absent(), + this.date = const Value.absent(), + this.createdAt = const Value.absent(), + }) : title = Value(title), + content = Value(content), + status = Value(status); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? content, + Expression? status, + Expression? achievements, + Expression? address, + Expression? date, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (content != null) 'body': content, + if (status != null) 'status': status, + if (achievements != null) 'achievements': achievements, + if (address != null) 'address': address, + if (date != null) 'date': date, + if (createdAt != null) 'created_at': createdAt, + }); + } + + SessionsCompanion copyWith( + {Value? id, + Value? title, + Value? content, + Value? status, + Value? achievements, + Value? address, + Value? date, + Value? createdAt}) { + return SessionsCompanion( + id: id ?? this.id, + title: title ?? this.title, + content: content ?? this.content, + status: status ?? this.status, + achievements: achievements ?? this.achievements, + address: address ?? this.address, + date: date ?? this.date, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (content.present) { + map['body'] = Variable(content.value); + } + if (status.present) { + map['status'] = Variable(status.value); + } + if (achievements.present) { + map['achievements'] = Variable(achievements.value); + } + if (address.present) { + map['address'] = Variable(address.value); + } + if (date.present) { + map['date'] = Variable(date.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('SessionsCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('content: $content, ') + ..write('status: $status, ') + ..write('achievements: $achievements, ') + ..write('address: $address, ') + ..write('date: $date, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class Activities extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + Activities(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 100), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn type = GeneratedColumn( + 'type', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn description = GeneratedColumn( + 'body', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn category = GeneratedColumn( + 'category', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn force = GeneratedColumn( + 'force', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn level = GeneratedColumn( + 'level', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn mechanic = GeneratedColumn( + 'mechanic', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn equipment = GeneratedColumn( + 'equipment', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn primaryMuscles = GeneratedColumn( + 'primary_muscles', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn secondaryMuscles = GeneratedColumn( + 'secondary_muscles', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => [ + id, + title, + type, + description, + category, + force, + level, + mechanic, + equipment, + primaryMuscles, + secondaryMuscles, + createdAt + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'activities'; + @override + Set get $primaryKey => {id}; + @override + ActivitiesData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ActivitiesData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + type: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}type']), + description: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body']), + category: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}category']), + force: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}force']), + level: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}level']), + mechanic: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}mechanic']), + equipment: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}equipment']), + primaryMuscles: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}primary_muscles']), + secondaryMuscles: attachedDatabase.typeMapping.read( + DriftSqlType.string, data['${effectivePrefix}secondary_muscles']), + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + Activities createAlias(String alias) { + return Activities(attachedDatabase, alias); + } +} + +class ActivitiesData extends DataClass implements Insertable { + final int id; + final String title; + final String? type; + final String? description; + final String? category; + final String? force; + final String? level; + final String? mechanic; + final String? equipment; + final String? primaryMuscles; + final String? secondaryMuscles; + final DateTime createdAt; + const ActivitiesData( + {required this.id, + required this.title, + this.type, + this.description, + this.category, + this.force, + this.level, + this.mechanic, + this.equipment, + this.primaryMuscles, + this.secondaryMuscles, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + if (!nullToAbsent || type != null) { + map['type'] = Variable(type); + } + if (!nullToAbsent || description != null) { + map['body'] = Variable(description); + } + if (!nullToAbsent || category != null) { + map['category'] = Variable(category); + } + if (!nullToAbsent || force != null) { + map['force'] = Variable(force); + } + if (!nullToAbsent || level != null) { + map['level'] = Variable(level); + } + if (!nullToAbsent || mechanic != null) { + map['mechanic'] = Variable(mechanic); + } + if (!nullToAbsent || equipment != null) { + map['equipment'] = Variable(equipment); + } + if (!nullToAbsent || primaryMuscles != null) { + map['primary_muscles'] = Variable(primaryMuscles); + } + if (!nullToAbsent || secondaryMuscles != null) { + map['secondary_muscles'] = Variable(secondaryMuscles); + } + map['created_at'] = Variable(createdAt); + return map; + } + + ActivitiesCompanion toCompanion(bool nullToAbsent) { + return ActivitiesCompanion( + id: Value(id), + title: Value(title), + type: type == null && nullToAbsent ? const Value.absent() : Value(type), + description: description == null && nullToAbsent + ? const Value.absent() + : Value(description), + category: category == null && nullToAbsent + ? const Value.absent() + : Value(category), + force: + force == null && nullToAbsent ? const Value.absent() : Value(force), + level: + level == null && nullToAbsent ? const Value.absent() : Value(level), + mechanic: mechanic == null && nullToAbsent + ? const Value.absent() + : Value(mechanic), + equipment: equipment == null && nullToAbsent + ? const Value.absent() + : Value(equipment), + primaryMuscles: primaryMuscles == null && nullToAbsent + ? const Value.absent() + : Value(primaryMuscles), + secondaryMuscles: secondaryMuscles == null && nullToAbsent + ? const Value.absent() + : Value(secondaryMuscles), + createdAt: Value(createdAt), + ); + } + + factory ActivitiesData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ActivitiesData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + type: serializer.fromJson(json['type']), + description: serializer.fromJson(json['description']), + category: serializer.fromJson(json['category']), + force: serializer.fromJson(json['force']), + level: serializer.fromJson(json['level']), + mechanic: serializer.fromJson(json['mechanic']), + equipment: serializer.fromJson(json['equipment']), + primaryMuscles: serializer.fromJson(json['primaryMuscles']), + secondaryMuscles: serializer.fromJson(json['secondaryMuscles']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'type': serializer.toJson(type), + 'description': serializer.toJson(description), + 'category': serializer.toJson(category), + 'force': serializer.toJson(force), + 'level': serializer.toJson(level), + 'mechanic': serializer.toJson(mechanic), + 'equipment': serializer.toJson(equipment), + 'primaryMuscles': serializer.toJson(primaryMuscles), + 'secondaryMuscles': serializer.toJson(secondaryMuscles), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ActivitiesData copyWith( + {int? id, + String? title, + Value type = const Value.absent(), + Value description = const Value.absent(), + Value category = const Value.absent(), + Value force = const Value.absent(), + Value level = const Value.absent(), + Value mechanic = const Value.absent(), + Value equipment = const Value.absent(), + Value primaryMuscles = const Value.absent(), + Value secondaryMuscles = const Value.absent(), + DateTime? createdAt}) => + ActivitiesData( + id: id ?? this.id, + title: title ?? this.title, + type: type.present ? type.value : this.type, + description: description.present ? description.value : this.description, + category: category.present ? category.value : this.category, + force: force.present ? force.value : this.force, + level: level.present ? level.value : this.level, + mechanic: mechanic.present ? mechanic.value : this.mechanic, + equipment: equipment.present ? equipment.value : this.equipment, + primaryMuscles: + primaryMuscles.present ? primaryMuscles.value : this.primaryMuscles, + secondaryMuscles: secondaryMuscles.present + ? secondaryMuscles.value + : this.secondaryMuscles, + createdAt: createdAt ?? this.createdAt, + ); + ActivitiesData copyWithCompanion(ActivitiesCompanion data) { + return ActivitiesData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + type: data.type.present ? data.type.value : this.type, + description: + data.description.present ? data.description.value : this.description, + category: data.category.present ? data.category.value : this.category, + force: data.force.present ? data.force.value : this.force, + level: data.level.present ? data.level.value : this.level, + mechanic: data.mechanic.present ? data.mechanic.value : this.mechanic, + equipment: data.equipment.present ? data.equipment.value : this.equipment, + primaryMuscles: data.primaryMuscles.present + ? data.primaryMuscles.value + : this.primaryMuscles, + secondaryMuscles: data.secondaryMuscles.present + ? data.secondaryMuscles.value + : this.secondaryMuscles, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ActivitiesData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('type: $type, ') + ..write('description: $description, ') + ..write('category: $category, ') + ..write('force: $force, ') + ..write('level: $level, ') + ..write('mechanic: $mechanic, ') + ..write('equipment: $equipment, ') + ..write('primaryMuscles: $primaryMuscles, ') + ..write('secondaryMuscles: $secondaryMuscles, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(id, title, type, description, category, force, + level, mechanic, equipment, primaryMuscles, secondaryMuscles, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ActivitiesData && + other.id == this.id && + other.title == this.title && + other.type == this.type && + other.description == this.description && + other.category == this.category && + other.force == this.force && + other.level == this.level && + other.mechanic == this.mechanic && + other.equipment == this.equipment && + other.primaryMuscles == this.primaryMuscles && + other.secondaryMuscles == this.secondaryMuscles && + other.createdAt == this.createdAt); +} + +class ActivitiesCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value type; + final Value description; + final Value category; + final Value force; + final Value level; + final Value mechanic; + final Value equipment; + final Value primaryMuscles; + final Value secondaryMuscles; + final Value createdAt; + const ActivitiesCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.type = const Value.absent(), + this.description = const Value.absent(), + this.category = const Value.absent(), + this.force = const Value.absent(), + this.level = const Value.absent(), + this.mechanic = const Value.absent(), + this.equipment = const Value.absent(), + this.primaryMuscles = const Value.absent(), + this.secondaryMuscles = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ActivitiesCompanion.insert({ + this.id = const Value.absent(), + required String title, + this.type = const Value.absent(), + this.description = const Value.absent(), + this.category = const Value.absent(), + this.force = const Value.absent(), + this.level = const Value.absent(), + this.mechanic = const Value.absent(), + this.equipment = const Value.absent(), + this.primaryMuscles = const Value.absent(), + this.secondaryMuscles = const Value.absent(), + this.createdAt = const Value.absent(), + }) : title = Value(title); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? type, + Expression? description, + Expression? category, + Expression? force, + Expression? level, + Expression? mechanic, + Expression? equipment, + Expression? primaryMuscles, + Expression? secondaryMuscles, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (type != null) 'type': type, + if (description != null) 'body': description, + if (category != null) 'category': category, + if (force != null) 'force': force, + if (level != null) 'level': level, + if (mechanic != null) 'mechanic': mechanic, + if (equipment != null) 'equipment': equipment, + if (primaryMuscles != null) 'primary_muscles': primaryMuscles, + if (secondaryMuscles != null) 'secondary_muscles': secondaryMuscles, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ActivitiesCompanion copyWith( + {Value? id, + Value? title, + Value? type, + Value? description, + Value? category, + Value? force, + Value? level, + Value? mechanic, + Value? equipment, + Value? primaryMuscles, + Value? secondaryMuscles, + Value? createdAt}) { + return ActivitiesCompanion( + id: id ?? this.id, + title: title ?? this.title, + type: type ?? this.type, + description: description ?? this.description, + category: category ?? this.category, + force: force ?? this.force, + level: level ?? this.level, + mechanic: mechanic ?? this.mechanic, + equipment: equipment ?? this.equipment, + primaryMuscles: primaryMuscles ?? this.primaryMuscles, + secondaryMuscles: secondaryMuscles ?? this.secondaryMuscles, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (type.present) { + map['type'] = Variable(type.value); + } + if (description.present) { + map['body'] = Variable(description.value); + } + if (category.present) { + map['category'] = Variable(category.value); + } + if (force.present) { + map['force'] = Variable(force.value); + } + if (level.present) { + map['level'] = Variable(level.value); + } + if (mechanic.present) { + map['mechanic'] = Variable(mechanic.value); + } + if (equipment.present) { + map['equipment'] = Variable(equipment.value); + } + if (primaryMuscles.present) { + map['primary_muscles'] = Variable(primaryMuscles.value); + } + if (secondaryMuscles.present) { + map['secondary_muscles'] = Variable(secondaryMuscles.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ActivitiesCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('type: $type, ') + ..write('description: $description, ') + ..write('category: $category, ') + ..write('force: $force, ') + ..write('level: $level, ') + ..write('mechanic: $mechanic, ') + ..write('equipment: $equipment, ') + ..write('primaryMuscles: $primaryMuscles, ') + ..write('secondaryMuscles: $secondaryMuscles, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class SessionActivities extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + SessionActivities(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn sessionId = GeneratedColumn( + 'session_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES sessions (id) ON DELETE CASCADE')); + late final GeneratedColumn activityId = GeneratedColumn( + 'activity_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES activities (id) ON DELETE CASCADE')); + late final GeneratedColumn position = GeneratedColumn( + 'position', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn results = GeneratedColumn( + 'results', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, sessionId, activityId, position, results, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'session_activities'; + @override + Set get $primaryKey => {id}; + @override + SessionActivitiesData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return SessionActivitiesData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + sessionId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}session_id'])!, + activityId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}activity_id'])!, + position: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}position'])!, + results: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}results']), + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + SessionActivities createAlias(String alias) { + return SessionActivities(attachedDatabase, alias); + } +} + +class SessionActivitiesData extends DataClass + implements Insertable { + final int id; + final int sessionId; + final int activityId; + final int position; + final String? results; + final DateTime createdAt; + const SessionActivitiesData( + {required this.id, + required this.sessionId, + required this.activityId, + required this.position, + this.results, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['session_id'] = Variable(sessionId); + map['activity_id'] = Variable(activityId); + map['position'] = Variable(position); + if (!nullToAbsent || results != null) { + map['results'] = Variable(results); + } + map['created_at'] = Variable(createdAt); + return map; + } + + SessionActivitiesCompanion toCompanion(bool nullToAbsent) { + return SessionActivitiesCompanion( + id: Value(id), + sessionId: Value(sessionId), + activityId: Value(activityId), + position: Value(position), + results: results == null && nullToAbsent + ? const Value.absent() + : Value(results), + createdAt: Value(createdAt), + ); + } + + factory SessionActivitiesData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return SessionActivitiesData( + id: serializer.fromJson(json['id']), + sessionId: serializer.fromJson(json['sessionId']), + activityId: serializer.fromJson(json['activityId']), + position: serializer.fromJson(json['position']), + results: serializer.fromJson(json['results']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'sessionId': serializer.toJson(sessionId), + 'activityId': serializer.toJson(activityId), + 'position': serializer.toJson(position), + 'results': serializer.toJson(results), + 'createdAt': serializer.toJson(createdAt), + }; + } + + SessionActivitiesData copyWith( + {int? id, + int? sessionId, + int? activityId, + int? position, + Value results = const Value.absent(), + DateTime? createdAt}) => + SessionActivitiesData( + id: id ?? this.id, + sessionId: sessionId ?? this.sessionId, + activityId: activityId ?? this.activityId, + position: position ?? this.position, + results: results.present ? results.value : this.results, + createdAt: createdAt ?? this.createdAt, + ); + SessionActivitiesData copyWithCompanion(SessionActivitiesCompanion data) { + return SessionActivitiesData( + id: data.id.present ? data.id.value : this.id, + sessionId: data.sessionId.present ? data.sessionId.value : this.sessionId, + activityId: + data.activityId.present ? data.activityId.value : this.activityId, + position: data.position.present ? data.position.value : this.position, + results: data.results.present ? data.results.value : this.results, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('SessionActivitiesData(') + ..write('id: $id, ') + ..write('sessionId: $sessionId, ') + ..write('activityId: $activityId, ') + ..write('position: $position, ') + ..write('results: $results, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(id, sessionId, activityId, position, results, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is SessionActivitiesData && + other.id == this.id && + other.sessionId == this.sessionId && + other.activityId == this.activityId && + other.position == this.position && + other.results == this.results && + other.createdAt == this.createdAt); +} + +class SessionActivitiesCompanion + extends UpdateCompanion { + final Value id; + final Value sessionId; + final Value activityId; + final Value position; + final Value results; + final Value createdAt; + const SessionActivitiesCompanion({ + this.id = const Value.absent(), + this.sessionId = const Value.absent(), + this.activityId = const Value.absent(), + this.position = const Value.absent(), + this.results = const Value.absent(), + this.createdAt = const Value.absent(), + }); + SessionActivitiesCompanion.insert({ + this.id = const Value.absent(), + required int sessionId, + required int activityId, + required int position, + this.results = const Value.absent(), + this.createdAt = const Value.absent(), + }) : sessionId = Value(sessionId), + activityId = Value(activityId), + position = Value(position); + static Insertable custom({ + Expression? id, + Expression? sessionId, + Expression? activityId, + Expression? position, + Expression? results, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (sessionId != null) 'session_id': sessionId, + if (activityId != null) 'activity_id': activityId, + if (position != null) 'position': position, + if (results != null) 'results': results, + if (createdAt != null) 'created_at': createdAt, + }); + } + + SessionActivitiesCompanion copyWith( + {Value? id, + Value? sessionId, + Value? activityId, + Value? position, + Value? results, + Value? createdAt}) { + return SessionActivitiesCompanion( + id: id ?? this.id, + sessionId: sessionId ?? this.sessionId, + activityId: activityId ?? this.activityId, + position: position ?? this.position, + results: results ?? this.results, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (sessionId.present) { + map['session_id'] = Variable(sessionId.value); + } + if (activityId.present) { + map['activity_id'] = Variable(activityId.value); + } + if (position.present) { + map['position'] = Variable(position.value); + } + if (results.present) { + map['results'] = Variable(results.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('SessionActivitiesCompanion(') + ..write('id: $id, ') + ..write('sessionId: $sessionId, ') + ..write('activityId: $activityId, ') + ..write('position: $position, ') + ..write('results: $results, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class Actions extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + Actions(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 64), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn description = GeneratedColumn( + 'body', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn totalSets = GeneratedColumn( + 'total_sets', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn totalReps = GeneratedColumn( + 'total_reps', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 1, maxTextLength: 32), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn restBeforeSets = GeneratedColumn( + 'rest_before_sets', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn restBetweenSets = GeneratedColumn( + 'rest_between_sets', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn restBetweenReps = GeneratedColumn( + 'rest_between_reps', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn restAfterSets = GeneratedColumn( + 'rest_after_sets', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn repType = GeneratedColumn( + 'rep_type', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn repLength = GeneratedColumn( + 'rep_length', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn repWeights = GeneratedColumn( + 'rep_weights', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn setWeights = GeneratedColumn( + 'set_weights', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn isAlternating = GeneratedColumn( + 'is_alternating', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("is_alternating" IN (0, 1))'), + defaultValue: Variable(false)); + late final GeneratedColumn tempo = GeneratedColumn( + 'tempo', aliasedName, true, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 6, maxTextLength: 36), + type: DriftSqlType.string, + requiredDuringInsert: false); + late final GeneratedColumn status = GeneratedColumn( + 'status', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: Variable('pending')); + late final GeneratedColumn state = GeneratedColumn( + 'state', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: + Variable("{'currentSet': 1, 'currentRep': 1, 'currentTime': 0}")); + late final GeneratedColumn set = GeneratedColumn( + 'set', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => [ + id, + title, + description, + totalSets, + totalReps, + restBeforeSets, + restBetweenSets, + restBetweenReps, + restAfterSets, + repType, + repLength, + repWeights, + setWeights, + isAlternating, + tempo, + status, + state, + set, + createdAt + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'actions'; + @override + Set get $primaryKey => {id}; + @override + ActionsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ActionsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + description: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body'])!, + totalSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}total_sets'])!, + totalReps: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}total_reps'])!, + restBeforeSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_before_sets']), + restBetweenSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_between_sets']), + restBetweenReps: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_between_reps']), + restAfterSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_after_sets']), + repType: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}rep_type'])!, + repLength: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rep_length']), + repWeights: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}rep_weights']), + setWeights: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}set_weights']), + isAlternating: attachedDatabase.typeMapping + .read(DriftSqlType.bool, data['${effectivePrefix}is_alternating'])!, + tempo: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}tempo']), + status: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}status'])!, + state: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}state'])!, + set: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}set'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + Actions createAlias(String alias) { + return Actions(attachedDatabase, alias); + } +} + +class ActionsData extends DataClass implements Insertable { + final int id; + final String title; + final String description; + final int totalSets; + final String totalReps; + final int? restBeforeSets; + final int? restBetweenSets; + final int? restBetweenReps; + final int? restAfterSets; + final String repType; + final int? repLength; + final String? repWeights; + final String? setWeights; + final bool isAlternating; + final String? tempo; + final String status; + final String state; + final String set; + final DateTime createdAt; + const ActionsData( + {required this.id, + required this.title, + required this.description, + required this.totalSets, + required this.totalReps, + this.restBeforeSets, + this.restBetweenSets, + this.restBetweenReps, + this.restAfterSets, + required this.repType, + this.repLength, + this.repWeights, + this.setWeights, + required this.isAlternating, + this.tempo, + required this.status, + required this.state, + required this.set, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + map['body'] = Variable(description); + map['total_sets'] = Variable(totalSets); + map['total_reps'] = Variable(totalReps); + if (!nullToAbsent || restBeforeSets != null) { + map['rest_before_sets'] = Variable(restBeforeSets); + } + if (!nullToAbsent || restBetweenSets != null) { + map['rest_between_sets'] = Variable(restBetweenSets); + } + if (!nullToAbsent || restBetweenReps != null) { + map['rest_between_reps'] = Variable(restBetweenReps); + } + if (!nullToAbsent || restAfterSets != null) { + map['rest_after_sets'] = Variable(restAfterSets); + } + map['rep_type'] = Variable(repType); + if (!nullToAbsent || repLength != null) { + map['rep_length'] = Variable(repLength); + } + if (!nullToAbsent || repWeights != null) { + map['rep_weights'] = Variable(repWeights); + } + if (!nullToAbsent || setWeights != null) { + map['set_weights'] = Variable(setWeights); + } + map['is_alternating'] = Variable(isAlternating); + if (!nullToAbsent || tempo != null) { + map['tempo'] = Variable(tempo); + } + map['status'] = Variable(status); + map['state'] = Variable(state); + map['set'] = Variable(set); + map['created_at'] = Variable(createdAt); + return map; + } + + ActionsCompanion toCompanion(bool nullToAbsent) { + return ActionsCompanion( + id: Value(id), + title: Value(title), + description: Value(description), + totalSets: Value(totalSets), + totalReps: Value(totalReps), + restBeforeSets: restBeforeSets == null && nullToAbsent + ? const Value.absent() + : Value(restBeforeSets), + restBetweenSets: restBetweenSets == null && nullToAbsent + ? const Value.absent() + : Value(restBetweenSets), + restBetweenReps: restBetweenReps == null && nullToAbsent + ? const Value.absent() + : Value(restBetweenReps), + restAfterSets: restAfterSets == null && nullToAbsent + ? const Value.absent() + : Value(restAfterSets), + repType: Value(repType), + repLength: repLength == null && nullToAbsent + ? const Value.absent() + : Value(repLength), + repWeights: repWeights == null && nullToAbsent + ? const Value.absent() + : Value(repWeights), + setWeights: setWeights == null && nullToAbsent + ? const Value.absent() + : Value(setWeights), + isAlternating: Value(isAlternating), + tempo: + tempo == null && nullToAbsent ? const Value.absent() : Value(tempo), + status: Value(status), + state: Value(state), + set: Value(set), + createdAt: Value(createdAt), + ); + } + + factory ActionsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ActionsData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + description: serializer.fromJson(json['description']), + totalSets: serializer.fromJson(json['totalSets']), + totalReps: serializer.fromJson(json['totalReps']), + restBeforeSets: serializer.fromJson(json['restBeforeSets']), + restBetweenSets: serializer.fromJson(json['restBetweenSets']), + restBetweenReps: serializer.fromJson(json['restBetweenReps']), + restAfterSets: serializer.fromJson(json['restAfterSets']), + repType: serializer.fromJson(json['repType']), + repLength: serializer.fromJson(json['repLength']), + repWeights: serializer.fromJson(json['repWeights']), + setWeights: serializer.fromJson(json['setWeights']), + isAlternating: serializer.fromJson(json['isAlternating']), + tempo: serializer.fromJson(json['tempo']), + status: serializer.fromJson(json['status']), + state: serializer.fromJson(json['state']), + set: serializer.fromJson(json['set']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'description': serializer.toJson(description), + 'totalSets': serializer.toJson(totalSets), + 'totalReps': serializer.toJson(totalReps), + 'restBeforeSets': serializer.toJson(restBeforeSets), + 'restBetweenSets': serializer.toJson(restBetweenSets), + 'restBetweenReps': serializer.toJson(restBetweenReps), + 'restAfterSets': serializer.toJson(restAfterSets), + 'repType': serializer.toJson(repType), + 'repLength': serializer.toJson(repLength), + 'repWeights': serializer.toJson(repWeights), + 'setWeights': serializer.toJson(setWeights), + 'isAlternating': serializer.toJson(isAlternating), + 'tempo': serializer.toJson(tempo), + 'status': serializer.toJson(status), + 'state': serializer.toJson(state), + 'set': serializer.toJson(set), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ActionsData copyWith( + {int? id, + String? title, + String? description, + int? totalSets, + String? totalReps, + Value restBeforeSets = const Value.absent(), + Value restBetweenSets = const Value.absent(), + Value restBetweenReps = const Value.absent(), + Value restAfterSets = const Value.absent(), + String? repType, + Value repLength = const Value.absent(), + Value repWeights = const Value.absent(), + Value setWeights = const Value.absent(), + bool? isAlternating, + Value tempo = const Value.absent(), + String? status, + String? state, + String? set, + DateTime? createdAt}) => + ActionsData( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + totalSets: totalSets ?? this.totalSets, + totalReps: totalReps ?? this.totalReps, + restBeforeSets: + restBeforeSets.present ? restBeforeSets.value : this.restBeforeSets, + restBetweenSets: restBetweenSets.present + ? restBetweenSets.value + : this.restBetweenSets, + restBetweenReps: restBetweenReps.present + ? restBetweenReps.value + : this.restBetweenReps, + restAfterSets: + restAfterSets.present ? restAfterSets.value : this.restAfterSets, + repType: repType ?? this.repType, + repLength: repLength.present ? repLength.value : this.repLength, + repWeights: repWeights.present ? repWeights.value : this.repWeights, + setWeights: setWeights.present ? setWeights.value : this.setWeights, + isAlternating: isAlternating ?? this.isAlternating, + tempo: tempo.present ? tempo.value : this.tempo, + status: status ?? this.status, + state: state ?? this.state, + set: set ?? this.set, + createdAt: createdAt ?? this.createdAt, + ); + ActionsData copyWithCompanion(ActionsCompanion data) { + return ActionsData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + description: + data.description.present ? data.description.value : this.description, + totalSets: data.totalSets.present ? data.totalSets.value : this.totalSets, + totalReps: data.totalReps.present ? data.totalReps.value : this.totalReps, + restBeforeSets: data.restBeforeSets.present + ? data.restBeforeSets.value + : this.restBeforeSets, + restBetweenSets: data.restBetweenSets.present + ? data.restBetweenSets.value + : this.restBetweenSets, + restBetweenReps: data.restBetweenReps.present + ? data.restBetweenReps.value + : this.restBetweenReps, + restAfterSets: data.restAfterSets.present + ? data.restAfterSets.value + : this.restAfterSets, + repType: data.repType.present ? data.repType.value : this.repType, + repLength: data.repLength.present ? data.repLength.value : this.repLength, + repWeights: + data.repWeights.present ? data.repWeights.value : this.repWeights, + setWeights: + data.setWeights.present ? data.setWeights.value : this.setWeights, + isAlternating: data.isAlternating.present + ? data.isAlternating.value + : this.isAlternating, + tempo: data.tempo.present ? data.tempo.value : this.tempo, + status: data.status.present ? data.status.value : this.status, + state: data.state.present ? data.state.value : this.state, + set: data.set.present ? data.set.value : this.set, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ActionsData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('totalSets: $totalSets, ') + ..write('totalReps: $totalReps, ') + ..write('restBeforeSets: $restBeforeSets, ') + ..write('restBetweenSets: $restBetweenSets, ') + ..write('restBetweenReps: $restBetweenReps, ') + ..write('restAfterSets: $restAfterSets, ') + ..write('repType: $repType, ') + ..write('repLength: $repLength, ') + ..write('repWeights: $repWeights, ') + ..write('setWeights: $setWeights, ') + ..write('isAlternating: $isAlternating, ') + ..write('tempo: $tempo, ') + ..write('status: $status, ') + ..write('state: $state, ') + ..write('set: $set, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash( + id, + title, + description, + totalSets, + totalReps, + restBeforeSets, + restBetweenSets, + restBetweenReps, + restAfterSets, + repType, + repLength, + repWeights, + setWeights, + isAlternating, + tempo, + status, + state, + set, + createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ActionsData && + other.id == this.id && + other.title == this.title && + other.description == this.description && + other.totalSets == this.totalSets && + other.totalReps == this.totalReps && + other.restBeforeSets == this.restBeforeSets && + other.restBetweenSets == this.restBetweenSets && + other.restBetweenReps == this.restBetweenReps && + other.restAfterSets == this.restAfterSets && + other.repType == this.repType && + other.repLength == this.repLength && + other.repWeights == this.repWeights && + other.setWeights == this.setWeights && + other.isAlternating == this.isAlternating && + other.tempo == this.tempo && + other.status == this.status && + other.state == this.state && + other.set == this.set && + other.createdAt == this.createdAt); +} + +class ActionsCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value description; + final Value totalSets; + final Value totalReps; + final Value restBeforeSets; + final Value restBetweenSets; + final Value restBetweenReps; + final Value restAfterSets; + final Value repType; + final Value repLength; + final Value repWeights; + final Value setWeights; + final Value isAlternating; + final Value tempo; + final Value status; + final Value state; + final Value set; + final Value createdAt; + const ActionsCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.description = const Value.absent(), + this.totalSets = const Value.absent(), + this.totalReps = const Value.absent(), + this.restBeforeSets = const Value.absent(), + this.restBetweenSets = const Value.absent(), + this.restBetweenReps = const Value.absent(), + this.restAfterSets = const Value.absent(), + this.repType = const Value.absent(), + this.repLength = const Value.absent(), + this.repWeights = const Value.absent(), + this.setWeights = const Value.absent(), + this.isAlternating = const Value.absent(), + this.tempo = const Value.absent(), + this.status = const Value.absent(), + this.state = const Value.absent(), + this.set = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ActionsCompanion.insert({ + this.id = const Value.absent(), + required String title, + required String description, + required int totalSets, + required String totalReps, + this.restBeforeSets = const Value.absent(), + this.restBetweenSets = const Value.absent(), + this.restBetweenReps = const Value.absent(), + this.restAfterSets = const Value.absent(), + required String repType, + this.repLength = const Value.absent(), + this.repWeights = const Value.absent(), + this.setWeights = const Value.absent(), + this.isAlternating = const Value.absent(), + this.tempo = const Value.absent(), + this.status = const Value.absent(), + this.state = const Value.absent(), + required String set, + this.createdAt = const Value.absent(), + }) : title = Value(title), + description = Value(description), + totalSets = Value(totalSets), + totalReps = Value(totalReps), + repType = Value(repType), + set = Value(set); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? description, + Expression? totalSets, + Expression? totalReps, + Expression? restBeforeSets, + Expression? restBetweenSets, + Expression? restBetweenReps, + Expression? restAfterSets, + Expression? repType, + Expression? repLength, + Expression? repWeights, + Expression? setWeights, + Expression? isAlternating, + Expression? tempo, + Expression? status, + Expression? state, + Expression? set, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (description != null) 'body': description, + if (totalSets != null) 'total_sets': totalSets, + if (totalReps != null) 'total_reps': totalReps, + if (restBeforeSets != null) 'rest_before_sets': restBeforeSets, + if (restBetweenSets != null) 'rest_between_sets': restBetweenSets, + if (restBetweenReps != null) 'rest_between_reps': restBetweenReps, + if (restAfterSets != null) 'rest_after_sets': restAfterSets, + if (repType != null) 'rep_type': repType, + if (repLength != null) 'rep_length': repLength, + if (repWeights != null) 'rep_weights': repWeights, + if (setWeights != null) 'set_weights': setWeights, + if (isAlternating != null) 'is_alternating': isAlternating, + if (tempo != null) 'tempo': tempo, + if (status != null) 'status': status, + if (state != null) 'state': state, + if (set != null) 'set': set, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ActionsCompanion copyWith( + {Value? id, + Value? title, + Value? description, + Value? totalSets, + Value? totalReps, + Value? restBeforeSets, + Value? restBetweenSets, + Value? restBetweenReps, + Value? restAfterSets, + Value? repType, + Value? repLength, + Value? repWeights, + Value? setWeights, + Value? isAlternating, + Value? tempo, + Value? status, + Value? state, + Value? set, + Value? createdAt}) { + return ActionsCompanion( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + totalSets: totalSets ?? this.totalSets, + totalReps: totalReps ?? this.totalReps, + restBeforeSets: restBeforeSets ?? this.restBeforeSets, + restBetweenSets: restBetweenSets ?? this.restBetweenSets, + restBetweenReps: restBetweenReps ?? this.restBetweenReps, + restAfterSets: restAfterSets ?? this.restAfterSets, + repType: repType ?? this.repType, + repLength: repLength ?? this.repLength, + repWeights: repWeights ?? this.repWeights, + setWeights: setWeights ?? this.setWeights, + isAlternating: isAlternating ?? this.isAlternating, + tempo: tempo ?? this.tempo, + status: status ?? this.status, + state: state ?? this.state, + set: set ?? this.set, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (description.present) { + map['body'] = Variable(description.value); + } + if (totalSets.present) { + map['total_sets'] = Variable(totalSets.value); + } + if (totalReps.present) { + map['total_reps'] = Variable(totalReps.value); + } + if (restBeforeSets.present) { + map['rest_before_sets'] = Variable(restBeforeSets.value); + } + if (restBetweenSets.present) { + map['rest_between_sets'] = Variable(restBetweenSets.value); + } + if (restBetweenReps.present) { + map['rest_between_reps'] = Variable(restBetweenReps.value); + } + if (restAfterSets.present) { + map['rest_after_sets'] = Variable(restAfterSets.value); + } + if (repType.present) { + map['rep_type'] = Variable(repType.value); + } + if (repLength.present) { + map['rep_length'] = Variable(repLength.value); + } + if (repWeights.present) { + map['rep_weights'] = Variable(repWeights.value); + } + if (setWeights.present) { + map['set_weights'] = Variable(setWeights.value); + } + if (isAlternating.present) { + map['is_alternating'] = Variable(isAlternating.value); + } + if (tempo.present) { + map['tempo'] = Variable(tempo.value); + } + if (status.present) { + map['status'] = Variable(status.value); + } + if (state.present) { + map['state'] = Variable(state.value); + } + if (set.present) { + map['set'] = Variable(set.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ActionsCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('totalSets: $totalSets, ') + ..write('totalReps: $totalReps, ') + ..write('restBeforeSets: $restBeforeSets, ') + ..write('restBetweenSets: $restBetweenSets, ') + ..write('restBetweenReps: $restBetweenReps, ') + ..write('restAfterSets: $restAfterSets, ') + ..write('repType: $repType, ') + ..write('repLength: $repLength, ') + ..write('repWeights: $repWeights, ') + ..write('setWeights: $setWeights, ') + ..write('isAlternating: $isAlternating, ') + ..write('tempo: $tempo, ') + ..write('status: $status, ') + ..write('state: $state, ') + ..write('set: $set, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class ActivityActions extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + ActivityActions(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn activityId = GeneratedColumn( + 'activity_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES activities (id) ON DELETE CASCADE')); + late final GeneratedColumn actionId = GeneratedColumn( + 'action_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES actions (id) ON DELETE CASCADE')); + late final GeneratedColumn position = GeneratedColumn( + 'position', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, activityId, actionId, position, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'activity_actions'; + @override + Set get $primaryKey => {id}; + @override + ActivityActionsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ActivityActionsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + activityId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}activity_id'])!, + actionId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}action_id'])!, + position: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}position'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + ActivityActions createAlias(String alias) { + return ActivityActions(attachedDatabase, alias); + } +} + +class ActivityActionsData extends DataClass + implements Insertable { + final int id; + final int activityId; + final int actionId; + final int position; + final DateTime createdAt; + const ActivityActionsData( + {required this.id, + required this.activityId, + required this.actionId, + required this.position, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['activity_id'] = Variable(activityId); + map['action_id'] = Variable(actionId); + map['position'] = Variable(position); + map['created_at'] = Variable(createdAt); + return map; + } + + ActivityActionsCompanion toCompanion(bool nullToAbsent) { + return ActivityActionsCompanion( + id: Value(id), + activityId: Value(activityId), + actionId: Value(actionId), + position: Value(position), + createdAt: Value(createdAt), + ); + } + + factory ActivityActionsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ActivityActionsData( + id: serializer.fromJson(json['id']), + activityId: serializer.fromJson(json['activityId']), + actionId: serializer.fromJson(json['actionId']), + position: serializer.fromJson(json['position']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'activityId': serializer.toJson(activityId), + 'actionId': serializer.toJson(actionId), + 'position': serializer.toJson(position), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ActivityActionsData copyWith( + {int? id, + int? activityId, + int? actionId, + int? position, + DateTime? createdAt}) => + ActivityActionsData( + id: id ?? this.id, + activityId: activityId ?? this.activityId, + actionId: actionId ?? this.actionId, + position: position ?? this.position, + createdAt: createdAt ?? this.createdAt, + ); + ActivityActionsData copyWithCompanion(ActivityActionsCompanion data) { + return ActivityActionsData( + id: data.id.present ? data.id.value : this.id, + activityId: + data.activityId.present ? data.activityId.value : this.activityId, + actionId: data.actionId.present ? data.actionId.value : this.actionId, + position: data.position.present ? data.position.value : this.position, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ActivityActionsData(') + ..write('id: $id, ') + ..write('activityId: $activityId, ') + ..write('actionId: $actionId, ') + ..write('position: $position, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(id, activityId, actionId, position, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ActivityActionsData && + other.id == this.id && + other.activityId == this.activityId && + other.actionId == this.actionId && + other.position == this.position && + other.createdAt == this.createdAt); +} + +class ActivityActionsCompanion extends UpdateCompanion { + final Value id; + final Value activityId; + final Value actionId; + final Value position; + final Value createdAt; + const ActivityActionsCompanion({ + this.id = const Value.absent(), + this.activityId = const Value.absent(), + this.actionId = const Value.absent(), + this.position = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ActivityActionsCompanion.insert({ + this.id = const Value.absent(), + required int activityId, + required int actionId, + required int position, + this.createdAt = const Value.absent(), + }) : activityId = Value(activityId), + actionId = Value(actionId), + position = Value(position); + static Insertable custom({ + Expression? id, + Expression? activityId, + Expression? actionId, + Expression? position, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (activityId != null) 'activity_id': activityId, + if (actionId != null) 'action_id': actionId, + if (position != null) 'position': position, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ActivityActionsCompanion copyWith( + {Value? id, + Value? activityId, + Value? actionId, + Value? position, + Value? createdAt}) { + return ActivityActionsCompanion( + id: id ?? this.id, + activityId: activityId ?? this.activityId, + actionId: actionId ?? this.actionId, + position: position ?? this.position, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (activityId.present) { + map['activity_id'] = Variable(activityId.value); + } + if (actionId.present) { + map['action_id'] = Variable(actionId.value); + } + if (position.present) { + map['position'] = Variable(position.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ActivityActionsCompanion(') + ..write('id: $id, ') + ..write('activityId: $activityId, ') + ..write('actionId: $actionId, ') + ..write('position: $position, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class MediaItems extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + MediaItems(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 64), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn description = GeneratedColumn( + 'body', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn reference = GeneratedColumn( + 'reference', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn type = GeneratedColumn( + 'type', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, title, description, reference, type, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'media_items'; + @override + Set get $primaryKey => {id}; + @override + MediaItemsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return MediaItemsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + description: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body'])!, + reference: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}reference'])!, + type: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}type'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + MediaItems createAlias(String alias) { + return MediaItems(attachedDatabase, alias); + } +} + +class MediaItemsData extends DataClass implements Insertable { + final int id; + final String title; + final String description; + final String reference; + final String type; + final DateTime createdAt; + const MediaItemsData( + {required this.id, + required this.title, + required this.description, + required this.reference, + required this.type, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + map['body'] = Variable(description); + map['reference'] = Variable(reference); + map['type'] = Variable(type); + map['created_at'] = Variable(createdAt); + return map; + } + + MediaItemsCompanion toCompanion(bool nullToAbsent) { + return MediaItemsCompanion( + id: Value(id), + title: Value(title), + description: Value(description), + reference: Value(reference), + type: Value(type), + createdAt: Value(createdAt), + ); + } + + factory MediaItemsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return MediaItemsData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + description: serializer.fromJson(json['description']), + reference: serializer.fromJson(json['reference']), + type: serializer.fromJson(json['type']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'description': serializer.toJson(description), + 'reference': serializer.toJson(reference), + 'type': serializer.toJson(type), + 'createdAt': serializer.toJson(createdAt), + }; + } + + MediaItemsData copyWith( + {int? id, + String? title, + String? description, + String? reference, + String? type, + DateTime? createdAt}) => + MediaItemsData( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + reference: reference ?? this.reference, + type: type ?? this.type, + createdAt: createdAt ?? this.createdAt, + ); + MediaItemsData copyWithCompanion(MediaItemsCompanion data) { + return MediaItemsData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + description: + data.description.present ? data.description.value : this.description, + reference: data.reference.present ? data.reference.value : this.reference, + type: data.type.present ? data.type.value : this.type, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('MediaItemsData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('reference: $reference, ') + ..write('type: $type, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(id, title, description, reference, type, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is MediaItemsData && + other.id == this.id && + other.title == this.title && + other.description == this.description && + other.reference == this.reference && + other.type == this.type && + other.createdAt == this.createdAt); +} + +class MediaItemsCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value description; + final Value reference; + final Value type; + final Value createdAt; + const MediaItemsCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.description = const Value.absent(), + this.reference = const Value.absent(), + this.type = const Value.absent(), + this.createdAt = const Value.absent(), + }); + MediaItemsCompanion.insert({ + this.id = const Value.absent(), + required String title, + required String description, + required String reference, + required String type, + this.createdAt = const Value.absent(), + }) : title = Value(title), + description = Value(description), + reference = Value(reference), + type = Value(type); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? description, + Expression? reference, + Expression? type, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (description != null) 'body': description, + if (reference != null) 'reference': reference, + if (type != null) 'type': type, + if (createdAt != null) 'created_at': createdAt, + }); + } + + MediaItemsCompanion copyWith( + {Value? id, + Value? title, + Value? description, + Value? reference, + Value? type, + Value? createdAt}) { + return MediaItemsCompanion( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + reference: reference ?? this.reference, + type: type ?? this.type, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (description.present) { + map['body'] = Variable(description.value); + } + if (reference.present) { + map['reference'] = Variable(reference.value); + } + if (type.present) { + map['type'] = Variable(type.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('MediaItemsCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('reference: $reference, ') + ..write('type: $type, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class ObjectMediaItems extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + ObjectMediaItems(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn objectId = GeneratedColumn( + 'object_id', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn objectType = GeneratedColumn( + 'object_type', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn mediaId = GeneratedColumn( + 'media_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES media_items (id) ON DELETE CASCADE')); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, objectId, objectType, mediaId, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'object_media_items'; + @override + Set get $primaryKey => {id}; + @override + ObjectMediaItemsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ObjectMediaItemsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + objectId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}object_id'])!, + objectType: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}object_type'])!, + mediaId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}media_id'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + ObjectMediaItems createAlias(String alias) { + return ObjectMediaItems(attachedDatabase, alias); + } +} + +class ObjectMediaItemsData extends DataClass + implements Insertable { + final int id; + final int objectId; + final String objectType; + final int mediaId; + final DateTime createdAt; + const ObjectMediaItemsData( + {required this.id, + required this.objectId, + required this.objectType, + required this.mediaId, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['object_id'] = Variable(objectId); + map['object_type'] = Variable(objectType); + map['media_id'] = Variable(mediaId); + map['created_at'] = Variable(createdAt); + return map; + } + + ObjectMediaItemsCompanion toCompanion(bool nullToAbsent) { + return ObjectMediaItemsCompanion( + id: Value(id), + objectId: Value(objectId), + objectType: Value(objectType), + mediaId: Value(mediaId), + createdAt: Value(createdAt), + ); + } + + factory ObjectMediaItemsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ObjectMediaItemsData( + id: serializer.fromJson(json['id']), + objectId: serializer.fromJson(json['objectId']), + objectType: serializer.fromJson(json['objectType']), + mediaId: serializer.fromJson(json['mediaId']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'objectId': serializer.toJson(objectId), + 'objectType': serializer.toJson(objectType), + 'mediaId': serializer.toJson(mediaId), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ObjectMediaItemsData copyWith( + {int? id, + int? objectId, + String? objectType, + int? mediaId, + DateTime? createdAt}) => + ObjectMediaItemsData( + id: id ?? this.id, + objectId: objectId ?? this.objectId, + objectType: objectType ?? this.objectType, + mediaId: mediaId ?? this.mediaId, + createdAt: createdAt ?? this.createdAt, + ); + ObjectMediaItemsData copyWithCompanion(ObjectMediaItemsCompanion data) { + return ObjectMediaItemsData( + id: data.id.present ? data.id.value : this.id, + objectId: data.objectId.present ? data.objectId.value : this.objectId, + objectType: + data.objectType.present ? data.objectType.value : this.objectType, + mediaId: data.mediaId.present ? data.mediaId.value : this.mediaId, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ObjectMediaItemsData(') + ..write('id: $id, ') + ..write('objectId: $objectId, ') + ..write('objectType: $objectType, ') + ..write('mediaId: $mediaId, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(id, objectId, objectType, mediaId, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ObjectMediaItemsData && + other.id == this.id && + other.objectId == this.objectId && + other.objectType == this.objectType && + other.mediaId == this.mediaId && + other.createdAt == this.createdAt); +} + +class ObjectMediaItemsCompanion extends UpdateCompanion { + final Value id; + final Value objectId; + final Value objectType; + final Value mediaId; + final Value createdAt; + const ObjectMediaItemsCompanion({ + this.id = const Value.absent(), + this.objectId = const Value.absent(), + this.objectType = const Value.absent(), + this.mediaId = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ObjectMediaItemsCompanion.insert({ + this.id = const Value.absent(), + required int objectId, + required String objectType, + required int mediaId, + this.createdAt = const Value.absent(), + }) : objectId = Value(objectId), + objectType = Value(objectType), + mediaId = Value(mediaId); + static Insertable custom({ + Expression? id, + Expression? objectId, + Expression? objectType, + Expression? mediaId, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (objectId != null) 'object_id': objectId, + if (objectType != null) 'object_type': objectType, + if (mediaId != null) 'media_id': mediaId, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ObjectMediaItemsCompanion copyWith( + {Value? id, + Value? objectId, + Value? objectType, + Value? mediaId, + Value? createdAt}) { + return ObjectMediaItemsCompanion( + id: id ?? this.id, + objectId: objectId ?? this.objectId, + objectType: objectType ?? this.objectType, + mediaId: mediaId ?? this.mediaId, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (objectId.present) { + map['object_id'] = Variable(objectId.value); + } + if (objectType.present) { + map['object_type'] = Variable(objectType.value); + } + if (mediaId.present) { + map['media_id'] = Variable(mediaId.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ObjectMediaItemsCompanion(') + ..write('id: $id, ') + ..write('objectId: $objectId, ') + ..write('objectType: $objectType, ') + ..write('mediaId: $mediaId, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class DatabaseAtV29 extends GeneratedDatabase { + DatabaseAtV29(QueryExecutor e) : super(e); + late final Sessions sessions = Sessions(this); + late final Activities activities = Activities(this); + late final SessionActivities sessionActivities = SessionActivities(this); + late final Actions actions = Actions(this); + late final ActivityActions activityActions = ActivityActions(this); + late final MediaItems mediaItems = MediaItems(this); + late final ObjectMediaItems objectMediaItems = ObjectMediaItems(this); + @override + Iterable> get allTables => + allSchemaEntities.whereType>(); + @override + List get allSchemaEntities => [ + sessions, + activities, + sessionActivities, + actions, + activityActions, + mediaItems, + objectMediaItems + ]; + @override + int get schemaVersion => 29; +} diff --git a/test/drift/sendtrain/generated/schema_v30.dart b/test/drift/sendtrain/generated/schema_v30.dart new file mode 100644 index 0000000..e2f9e5c --- /dev/null +++ b/test/drift/sendtrain/generated/schema_v30.dart @@ -0,0 +1,2702 @@ +// dart format width=80 +// GENERATED CODE, DO NOT EDIT BY HAND. +// ignore_for_file: type=lint +import 'package:drift/drift.dart'; + +class Sessions extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + Sessions(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 32), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn content = GeneratedColumn( + 'body', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn status = GeneratedColumn( + 'status', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn achievements = GeneratedColumn( + 'achievements', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn address = GeneratedColumn( + 'address', aliasedName, true, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 256), + type: DriftSqlType.string, + requiredDuringInsert: false); + late final GeneratedColumn date = GeneratedColumn( + 'date', aliasedName, true, + type: DriftSqlType.dateTime, requiredDuringInsert: false); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, title, content, status, achievements, address, date, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'sessions'; + @override + Set get $primaryKey => {id}; + @override + SessionsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return SessionsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + content: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body'])!, + status: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}status'])!, + achievements: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}achievements']), + address: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}address']), + date: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}date']), + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + Sessions createAlias(String alias) { + return Sessions(attachedDatabase, alias); + } +} + +class SessionsData extends DataClass implements Insertable { + final int id; + final String title; + final String content; + final String status; + final String? achievements; + final String? address; + final DateTime? date; + final DateTime createdAt; + const SessionsData( + {required this.id, + required this.title, + required this.content, + required this.status, + this.achievements, + this.address, + this.date, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + map['body'] = Variable(content); + map['status'] = Variable(status); + if (!nullToAbsent || achievements != null) { + map['achievements'] = Variable(achievements); + } + if (!nullToAbsent || address != null) { + map['address'] = Variable(address); + } + if (!nullToAbsent || date != null) { + map['date'] = Variable(date); + } + map['created_at'] = Variable(createdAt); + return map; + } + + SessionsCompanion toCompanion(bool nullToAbsent) { + return SessionsCompanion( + id: Value(id), + title: Value(title), + content: Value(content), + status: Value(status), + achievements: achievements == null && nullToAbsent + ? const Value.absent() + : Value(achievements), + address: address == null && nullToAbsent + ? const Value.absent() + : Value(address), + date: date == null && nullToAbsent ? const Value.absent() : Value(date), + createdAt: Value(createdAt), + ); + } + + factory SessionsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return SessionsData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + content: serializer.fromJson(json['content']), + status: serializer.fromJson(json['status']), + achievements: serializer.fromJson(json['achievements']), + address: serializer.fromJson(json['address']), + date: serializer.fromJson(json['date']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'content': serializer.toJson(content), + 'status': serializer.toJson(status), + 'achievements': serializer.toJson(achievements), + 'address': serializer.toJson(address), + 'date': serializer.toJson(date), + 'createdAt': serializer.toJson(createdAt), + }; + } + + SessionsData copyWith( + {int? id, + String? title, + String? content, + String? status, + Value achievements = const Value.absent(), + Value address = const Value.absent(), + Value date = const Value.absent(), + DateTime? createdAt}) => + SessionsData( + id: id ?? this.id, + title: title ?? this.title, + content: content ?? this.content, + status: status ?? this.status, + achievements: + achievements.present ? achievements.value : this.achievements, + address: address.present ? address.value : this.address, + date: date.present ? date.value : this.date, + createdAt: createdAt ?? this.createdAt, + ); + SessionsData copyWithCompanion(SessionsCompanion data) { + return SessionsData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + content: data.content.present ? data.content.value : this.content, + status: data.status.present ? data.status.value : this.status, + achievements: data.achievements.present + ? data.achievements.value + : this.achievements, + address: data.address.present ? data.address.value : this.address, + date: data.date.present ? data.date.value : this.date, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('SessionsData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('content: $content, ') + ..write('status: $status, ') + ..write('achievements: $achievements, ') + ..write('address: $address, ') + ..write('date: $date, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash( + id, title, content, status, achievements, address, date, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is SessionsData && + other.id == this.id && + other.title == this.title && + other.content == this.content && + other.status == this.status && + other.achievements == this.achievements && + other.address == this.address && + other.date == this.date && + other.createdAt == this.createdAt); +} + +class SessionsCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value content; + final Value status; + final Value achievements; + final Value address; + final Value date; + final Value createdAt; + const SessionsCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.content = const Value.absent(), + this.status = const Value.absent(), + this.achievements = const Value.absent(), + this.address = const Value.absent(), + this.date = const Value.absent(), + this.createdAt = const Value.absent(), + }); + SessionsCompanion.insert({ + this.id = const Value.absent(), + required String title, + required String content, + required String status, + this.achievements = const Value.absent(), + this.address = const Value.absent(), + this.date = const Value.absent(), + this.createdAt = const Value.absent(), + }) : title = Value(title), + content = Value(content), + status = Value(status); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? content, + Expression? status, + Expression? achievements, + Expression? address, + Expression? date, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (content != null) 'body': content, + if (status != null) 'status': status, + if (achievements != null) 'achievements': achievements, + if (address != null) 'address': address, + if (date != null) 'date': date, + if (createdAt != null) 'created_at': createdAt, + }); + } + + SessionsCompanion copyWith( + {Value? id, + Value? title, + Value? content, + Value? status, + Value? achievements, + Value? address, + Value? date, + Value? createdAt}) { + return SessionsCompanion( + id: id ?? this.id, + title: title ?? this.title, + content: content ?? this.content, + status: status ?? this.status, + achievements: achievements ?? this.achievements, + address: address ?? this.address, + date: date ?? this.date, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (content.present) { + map['body'] = Variable(content.value); + } + if (status.present) { + map['status'] = Variable(status.value); + } + if (achievements.present) { + map['achievements'] = Variable(achievements.value); + } + if (address.present) { + map['address'] = Variable(address.value); + } + if (date.present) { + map['date'] = Variable(date.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('SessionsCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('content: $content, ') + ..write('status: $status, ') + ..write('achievements: $achievements, ') + ..write('address: $address, ') + ..write('date: $date, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class Activities extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + Activities(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 100), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn type = GeneratedColumn( + 'type', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn description = GeneratedColumn( + 'body', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn category = GeneratedColumn( + 'category', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn force = GeneratedColumn( + 'force', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn level = GeneratedColumn( + 'level', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn mechanic = GeneratedColumn( + 'mechanic', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn equipment = GeneratedColumn( + 'equipment', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn primaryMuscles = GeneratedColumn( + 'primary_muscles', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn secondaryMuscles = GeneratedColumn( + 'secondary_muscles', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => [ + id, + title, + type, + description, + category, + force, + level, + mechanic, + equipment, + primaryMuscles, + secondaryMuscles, + createdAt + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'activities'; + @override + Set get $primaryKey => {id}; + @override + ActivitiesData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ActivitiesData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + type: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}type']), + description: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body']), + category: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}category']), + force: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}force']), + level: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}level']), + mechanic: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}mechanic']), + equipment: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}equipment']), + primaryMuscles: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}primary_muscles']), + secondaryMuscles: attachedDatabase.typeMapping.read( + DriftSqlType.string, data['${effectivePrefix}secondary_muscles']), + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + Activities createAlias(String alias) { + return Activities(attachedDatabase, alias); + } +} + +class ActivitiesData extends DataClass implements Insertable { + final int id; + final String title; + final String? type; + final String? description; + final String? category; + final String? force; + final String? level; + final String? mechanic; + final String? equipment; + final String? primaryMuscles; + final String? secondaryMuscles; + final DateTime createdAt; + const ActivitiesData( + {required this.id, + required this.title, + this.type, + this.description, + this.category, + this.force, + this.level, + this.mechanic, + this.equipment, + this.primaryMuscles, + this.secondaryMuscles, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + if (!nullToAbsent || type != null) { + map['type'] = Variable(type); + } + if (!nullToAbsent || description != null) { + map['body'] = Variable(description); + } + if (!nullToAbsent || category != null) { + map['category'] = Variable(category); + } + if (!nullToAbsent || force != null) { + map['force'] = Variable(force); + } + if (!nullToAbsent || level != null) { + map['level'] = Variable(level); + } + if (!nullToAbsent || mechanic != null) { + map['mechanic'] = Variable(mechanic); + } + if (!nullToAbsent || equipment != null) { + map['equipment'] = Variable(equipment); + } + if (!nullToAbsent || primaryMuscles != null) { + map['primary_muscles'] = Variable(primaryMuscles); + } + if (!nullToAbsent || secondaryMuscles != null) { + map['secondary_muscles'] = Variable(secondaryMuscles); + } + map['created_at'] = Variable(createdAt); + return map; + } + + ActivitiesCompanion toCompanion(bool nullToAbsent) { + return ActivitiesCompanion( + id: Value(id), + title: Value(title), + type: type == null && nullToAbsent ? const Value.absent() : Value(type), + description: description == null && nullToAbsent + ? const Value.absent() + : Value(description), + category: category == null && nullToAbsent + ? const Value.absent() + : Value(category), + force: + force == null && nullToAbsent ? const Value.absent() : Value(force), + level: + level == null && nullToAbsent ? const Value.absent() : Value(level), + mechanic: mechanic == null && nullToAbsent + ? const Value.absent() + : Value(mechanic), + equipment: equipment == null && nullToAbsent + ? const Value.absent() + : Value(equipment), + primaryMuscles: primaryMuscles == null && nullToAbsent + ? const Value.absent() + : Value(primaryMuscles), + secondaryMuscles: secondaryMuscles == null && nullToAbsent + ? const Value.absent() + : Value(secondaryMuscles), + createdAt: Value(createdAt), + ); + } + + factory ActivitiesData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ActivitiesData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + type: serializer.fromJson(json['type']), + description: serializer.fromJson(json['description']), + category: serializer.fromJson(json['category']), + force: serializer.fromJson(json['force']), + level: serializer.fromJson(json['level']), + mechanic: serializer.fromJson(json['mechanic']), + equipment: serializer.fromJson(json['equipment']), + primaryMuscles: serializer.fromJson(json['primaryMuscles']), + secondaryMuscles: serializer.fromJson(json['secondaryMuscles']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'type': serializer.toJson(type), + 'description': serializer.toJson(description), + 'category': serializer.toJson(category), + 'force': serializer.toJson(force), + 'level': serializer.toJson(level), + 'mechanic': serializer.toJson(mechanic), + 'equipment': serializer.toJson(equipment), + 'primaryMuscles': serializer.toJson(primaryMuscles), + 'secondaryMuscles': serializer.toJson(secondaryMuscles), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ActivitiesData copyWith( + {int? id, + String? title, + Value type = const Value.absent(), + Value description = const Value.absent(), + Value category = const Value.absent(), + Value force = const Value.absent(), + Value level = const Value.absent(), + Value mechanic = const Value.absent(), + Value equipment = const Value.absent(), + Value primaryMuscles = const Value.absent(), + Value secondaryMuscles = const Value.absent(), + DateTime? createdAt}) => + ActivitiesData( + id: id ?? this.id, + title: title ?? this.title, + type: type.present ? type.value : this.type, + description: description.present ? description.value : this.description, + category: category.present ? category.value : this.category, + force: force.present ? force.value : this.force, + level: level.present ? level.value : this.level, + mechanic: mechanic.present ? mechanic.value : this.mechanic, + equipment: equipment.present ? equipment.value : this.equipment, + primaryMuscles: + primaryMuscles.present ? primaryMuscles.value : this.primaryMuscles, + secondaryMuscles: secondaryMuscles.present + ? secondaryMuscles.value + : this.secondaryMuscles, + createdAt: createdAt ?? this.createdAt, + ); + ActivitiesData copyWithCompanion(ActivitiesCompanion data) { + return ActivitiesData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + type: data.type.present ? data.type.value : this.type, + description: + data.description.present ? data.description.value : this.description, + category: data.category.present ? data.category.value : this.category, + force: data.force.present ? data.force.value : this.force, + level: data.level.present ? data.level.value : this.level, + mechanic: data.mechanic.present ? data.mechanic.value : this.mechanic, + equipment: data.equipment.present ? data.equipment.value : this.equipment, + primaryMuscles: data.primaryMuscles.present + ? data.primaryMuscles.value + : this.primaryMuscles, + secondaryMuscles: data.secondaryMuscles.present + ? data.secondaryMuscles.value + : this.secondaryMuscles, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ActivitiesData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('type: $type, ') + ..write('description: $description, ') + ..write('category: $category, ') + ..write('force: $force, ') + ..write('level: $level, ') + ..write('mechanic: $mechanic, ') + ..write('equipment: $equipment, ') + ..write('primaryMuscles: $primaryMuscles, ') + ..write('secondaryMuscles: $secondaryMuscles, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(id, title, type, description, category, force, + level, mechanic, equipment, primaryMuscles, secondaryMuscles, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ActivitiesData && + other.id == this.id && + other.title == this.title && + other.type == this.type && + other.description == this.description && + other.category == this.category && + other.force == this.force && + other.level == this.level && + other.mechanic == this.mechanic && + other.equipment == this.equipment && + other.primaryMuscles == this.primaryMuscles && + other.secondaryMuscles == this.secondaryMuscles && + other.createdAt == this.createdAt); +} + +class ActivitiesCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value type; + final Value description; + final Value category; + final Value force; + final Value level; + final Value mechanic; + final Value equipment; + final Value primaryMuscles; + final Value secondaryMuscles; + final Value createdAt; + const ActivitiesCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.type = const Value.absent(), + this.description = const Value.absent(), + this.category = const Value.absent(), + this.force = const Value.absent(), + this.level = const Value.absent(), + this.mechanic = const Value.absent(), + this.equipment = const Value.absent(), + this.primaryMuscles = const Value.absent(), + this.secondaryMuscles = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ActivitiesCompanion.insert({ + this.id = const Value.absent(), + required String title, + this.type = const Value.absent(), + this.description = const Value.absent(), + this.category = const Value.absent(), + this.force = const Value.absent(), + this.level = const Value.absent(), + this.mechanic = const Value.absent(), + this.equipment = const Value.absent(), + this.primaryMuscles = const Value.absent(), + this.secondaryMuscles = const Value.absent(), + this.createdAt = const Value.absent(), + }) : title = Value(title); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? type, + Expression? description, + Expression? category, + Expression? force, + Expression? level, + Expression? mechanic, + Expression? equipment, + Expression? primaryMuscles, + Expression? secondaryMuscles, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (type != null) 'type': type, + if (description != null) 'body': description, + if (category != null) 'category': category, + if (force != null) 'force': force, + if (level != null) 'level': level, + if (mechanic != null) 'mechanic': mechanic, + if (equipment != null) 'equipment': equipment, + if (primaryMuscles != null) 'primary_muscles': primaryMuscles, + if (secondaryMuscles != null) 'secondary_muscles': secondaryMuscles, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ActivitiesCompanion copyWith( + {Value? id, + Value? title, + Value? type, + Value? description, + Value? category, + Value? force, + Value? level, + Value? mechanic, + Value? equipment, + Value? primaryMuscles, + Value? secondaryMuscles, + Value? createdAt}) { + return ActivitiesCompanion( + id: id ?? this.id, + title: title ?? this.title, + type: type ?? this.type, + description: description ?? this.description, + category: category ?? this.category, + force: force ?? this.force, + level: level ?? this.level, + mechanic: mechanic ?? this.mechanic, + equipment: equipment ?? this.equipment, + primaryMuscles: primaryMuscles ?? this.primaryMuscles, + secondaryMuscles: secondaryMuscles ?? this.secondaryMuscles, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (type.present) { + map['type'] = Variable(type.value); + } + if (description.present) { + map['body'] = Variable(description.value); + } + if (category.present) { + map['category'] = Variable(category.value); + } + if (force.present) { + map['force'] = Variable(force.value); + } + if (level.present) { + map['level'] = Variable(level.value); + } + if (mechanic.present) { + map['mechanic'] = Variable(mechanic.value); + } + if (equipment.present) { + map['equipment'] = Variable(equipment.value); + } + if (primaryMuscles.present) { + map['primary_muscles'] = Variable(primaryMuscles.value); + } + if (secondaryMuscles.present) { + map['secondary_muscles'] = Variable(secondaryMuscles.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ActivitiesCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('type: $type, ') + ..write('description: $description, ') + ..write('category: $category, ') + ..write('force: $force, ') + ..write('level: $level, ') + ..write('mechanic: $mechanic, ') + ..write('equipment: $equipment, ') + ..write('primaryMuscles: $primaryMuscles, ') + ..write('secondaryMuscles: $secondaryMuscles, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class SessionActivities extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + SessionActivities(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn sessionId = GeneratedColumn( + 'session_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES sessions (id) ON DELETE CASCADE')); + late final GeneratedColumn activityId = GeneratedColumn( + 'activity_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES activities (id) ON DELETE CASCADE')); + late final GeneratedColumn position = GeneratedColumn( + 'position', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn results = GeneratedColumn( + 'results', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, sessionId, activityId, position, results, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'session_activities'; + @override + Set get $primaryKey => {id}; + @override + SessionActivitiesData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return SessionActivitiesData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + sessionId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}session_id'])!, + activityId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}activity_id'])!, + position: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}position'])!, + results: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}results']), + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + SessionActivities createAlias(String alias) { + return SessionActivities(attachedDatabase, alias); + } +} + +class SessionActivitiesData extends DataClass + implements Insertable { + final int id; + final int sessionId; + final int activityId; + final int position; + final String? results; + final DateTime createdAt; + const SessionActivitiesData( + {required this.id, + required this.sessionId, + required this.activityId, + required this.position, + this.results, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['session_id'] = Variable(sessionId); + map['activity_id'] = Variable(activityId); + map['position'] = Variable(position); + if (!nullToAbsent || results != null) { + map['results'] = Variable(results); + } + map['created_at'] = Variable(createdAt); + return map; + } + + SessionActivitiesCompanion toCompanion(bool nullToAbsent) { + return SessionActivitiesCompanion( + id: Value(id), + sessionId: Value(sessionId), + activityId: Value(activityId), + position: Value(position), + results: results == null && nullToAbsent + ? const Value.absent() + : Value(results), + createdAt: Value(createdAt), + ); + } + + factory SessionActivitiesData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return SessionActivitiesData( + id: serializer.fromJson(json['id']), + sessionId: serializer.fromJson(json['sessionId']), + activityId: serializer.fromJson(json['activityId']), + position: serializer.fromJson(json['position']), + results: serializer.fromJson(json['results']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'sessionId': serializer.toJson(sessionId), + 'activityId': serializer.toJson(activityId), + 'position': serializer.toJson(position), + 'results': serializer.toJson(results), + 'createdAt': serializer.toJson(createdAt), + }; + } + + SessionActivitiesData copyWith( + {int? id, + int? sessionId, + int? activityId, + int? position, + Value results = const Value.absent(), + DateTime? createdAt}) => + SessionActivitiesData( + id: id ?? this.id, + sessionId: sessionId ?? this.sessionId, + activityId: activityId ?? this.activityId, + position: position ?? this.position, + results: results.present ? results.value : this.results, + createdAt: createdAt ?? this.createdAt, + ); + SessionActivitiesData copyWithCompanion(SessionActivitiesCompanion data) { + return SessionActivitiesData( + id: data.id.present ? data.id.value : this.id, + sessionId: data.sessionId.present ? data.sessionId.value : this.sessionId, + activityId: + data.activityId.present ? data.activityId.value : this.activityId, + position: data.position.present ? data.position.value : this.position, + results: data.results.present ? data.results.value : this.results, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('SessionActivitiesData(') + ..write('id: $id, ') + ..write('sessionId: $sessionId, ') + ..write('activityId: $activityId, ') + ..write('position: $position, ') + ..write('results: $results, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(id, sessionId, activityId, position, results, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is SessionActivitiesData && + other.id == this.id && + other.sessionId == this.sessionId && + other.activityId == this.activityId && + other.position == this.position && + other.results == this.results && + other.createdAt == this.createdAt); +} + +class SessionActivitiesCompanion + extends UpdateCompanion { + final Value id; + final Value sessionId; + final Value activityId; + final Value position; + final Value results; + final Value createdAt; + const SessionActivitiesCompanion({ + this.id = const Value.absent(), + this.sessionId = const Value.absent(), + this.activityId = const Value.absent(), + this.position = const Value.absent(), + this.results = const Value.absent(), + this.createdAt = const Value.absent(), + }); + SessionActivitiesCompanion.insert({ + this.id = const Value.absent(), + required int sessionId, + required int activityId, + required int position, + this.results = const Value.absent(), + this.createdAt = const Value.absent(), + }) : sessionId = Value(sessionId), + activityId = Value(activityId), + position = Value(position); + static Insertable custom({ + Expression? id, + Expression? sessionId, + Expression? activityId, + Expression? position, + Expression? results, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (sessionId != null) 'session_id': sessionId, + if (activityId != null) 'activity_id': activityId, + if (position != null) 'position': position, + if (results != null) 'results': results, + if (createdAt != null) 'created_at': createdAt, + }); + } + + SessionActivitiesCompanion copyWith( + {Value? id, + Value? sessionId, + Value? activityId, + Value? position, + Value? results, + Value? createdAt}) { + return SessionActivitiesCompanion( + id: id ?? this.id, + sessionId: sessionId ?? this.sessionId, + activityId: activityId ?? this.activityId, + position: position ?? this.position, + results: results ?? this.results, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (sessionId.present) { + map['session_id'] = Variable(sessionId.value); + } + if (activityId.present) { + map['activity_id'] = Variable(activityId.value); + } + if (position.present) { + map['position'] = Variable(position.value); + } + if (results.present) { + map['results'] = Variable(results.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('SessionActivitiesCompanion(') + ..write('id: $id, ') + ..write('sessionId: $sessionId, ') + ..write('activityId: $activityId, ') + ..write('position: $position, ') + ..write('results: $results, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class Actions extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + Actions(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 64), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn description = GeneratedColumn( + 'body', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn totalSets = GeneratedColumn( + 'total_sets', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn totalReps = GeneratedColumn( + 'total_reps', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 1, maxTextLength: 32), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn restBeforeSets = GeneratedColumn( + 'rest_before_sets', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn restBetweenSets = GeneratedColumn( + 'rest_between_sets', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn restBetweenReps = GeneratedColumn( + 'rest_between_reps', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn restAfterSets = GeneratedColumn( + 'rest_after_sets', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn repType = GeneratedColumn( + 'rep_type', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn repLength = GeneratedColumn( + 'rep_length', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn repWeights = GeneratedColumn( + 'rep_weights', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn setWeights = GeneratedColumn( + 'set_weights', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn isAlternating = GeneratedColumn( + 'is_alternating', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("is_alternating" IN (0, 1))'), + defaultValue: Variable(false)); + late final GeneratedColumn tempo = GeneratedColumn( + 'tempo', aliasedName, true, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 6, maxTextLength: 36), + type: DriftSqlType.string, + requiredDuringInsert: false); + late final GeneratedColumn status = GeneratedColumn( + 'status', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: Variable('pending')); + late final GeneratedColumn state = GeneratedColumn( + 'state', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: + Variable("{'currentSet': 1, 'currentRep': 1, 'currentTime': 0}")); + late final GeneratedColumn set = GeneratedColumn( + 'set', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => [ + id, + title, + description, + totalSets, + totalReps, + restBeforeSets, + restBetweenSets, + restBetweenReps, + restAfterSets, + repType, + repLength, + repWeights, + setWeights, + isAlternating, + tempo, + status, + state, + set, + createdAt + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'actions'; + @override + Set get $primaryKey => {id}; + @override + ActionsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ActionsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + description: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body'])!, + totalSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}total_sets'])!, + totalReps: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}total_reps'])!, + restBeforeSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_before_sets']), + restBetweenSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_between_sets']), + restBetweenReps: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_between_reps']), + restAfterSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_after_sets']), + repType: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}rep_type'])!, + repLength: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rep_length']), + repWeights: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}rep_weights']), + setWeights: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}set_weights']), + isAlternating: attachedDatabase.typeMapping + .read(DriftSqlType.bool, data['${effectivePrefix}is_alternating'])!, + tempo: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}tempo']), + status: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}status'])!, + state: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}state'])!, + set: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}set'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + Actions createAlias(String alias) { + return Actions(attachedDatabase, alias); + } +} + +class ActionsData extends DataClass implements Insertable { + final int id; + final String title; + final String description; + final int totalSets; + final String totalReps; + final int? restBeforeSets; + final int? restBetweenSets; + final int? restBetweenReps; + final int? restAfterSets; + final String repType; + final int? repLength; + final String? repWeights; + final String? setWeights; + final bool isAlternating; + final String? tempo; + final String status; + final String state; + final String set; + final DateTime createdAt; + const ActionsData( + {required this.id, + required this.title, + required this.description, + required this.totalSets, + required this.totalReps, + this.restBeforeSets, + this.restBetweenSets, + this.restBetweenReps, + this.restAfterSets, + required this.repType, + this.repLength, + this.repWeights, + this.setWeights, + required this.isAlternating, + this.tempo, + required this.status, + required this.state, + required this.set, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + map['body'] = Variable(description); + map['total_sets'] = Variable(totalSets); + map['total_reps'] = Variable(totalReps); + if (!nullToAbsent || restBeforeSets != null) { + map['rest_before_sets'] = Variable(restBeforeSets); + } + if (!nullToAbsent || restBetweenSets != null) { + map['rest_between_sets'] = Variable(restBetweenSets); + } + if (!nullToAbsent || restBetweenReps != null) { + map['rest_between_reps'] = Variable(restBetweenReps); + } + if (!nullToAbsent || restAfterSets != null) { + map['rest_after_sets'] = Variable(restAfterSets); + } + map['rep_type'] = Variable(repType); + if (!nullToAbsent || repLength != null) { + map['rep_length'] = Variable(repLength); + } + if (!nullToAbsent || repWeights != null) { + map['rep_weights'] = Variable(repWeights); + } + if (!nullToAbsent || setWeights != null) { + map['set_weights'] = Variable(setWeights); + } + map['is_alternating'] = Variable(isAlternating); + if (!nullToAbsent || tempo != null) { + map['tempo'] = Variable(tempo); + } + map['status'] = Variable(status); + map['state'] = Variable(state); + map['set'] = Variable(set); + map['created_at'] = Variable(createdAt); + return map; + } + + ActionsCompanion toCompanion(bool nullToAbsent) { + return ActionsCompanion( + id: Value(id), + title: Value(title), + description: Value(description), + totalSets: Value(totalSets), + totalReps: Value(totalReps), + restBeforeSets: restBeforeSets == null && nullToAbsent + ? const Value.absent() + : Value(restBeforeSets), + restBetweenSets: restBetweenSets == null && nullToAbsent + ? const Value.absent() + : Value(restBetweenSets), + restBetweenReps: restBetweenReps == null && nullToAbsent + ? const Value.absent() + : Value(restBetweenReps), + restAfterSets: restAfterSets == null && nullToAbsent + ? const Value.absent() + : Value(restAfterSets), + repType: Value(repType), + repLength: repLength == null && nullToAbsent + ? const Value.absent() + : Value(repLength), + repWeights: repWeights == null && nullToAbsent + ? const Value.absent() + : Value(repWeights), + setWeights: setWeights == null && nullToAbsent + ? const Value.absent() + : Value(setWeights), + isAlternating: Value(isAlternating), + tempo: + tempo == null && nullToAbsent ? const Value.absent() : Value(tempo), + status: Value(status), + state: Value(state), + set: Value(set), + createdAt: Value(createdAt), + ); + } + + factory ActionsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ActionsData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + description: serializer.fromJson(json['description']), + totalSets: serializer.fromJson(json['totalSets']), + totalReps: serializer.fromJson(json['totalReps']), + restBeforeSets: serializer.fromJson(json['restBeforeSets']), + restBetweenSets: serializer.fromJson(json['restBetweenSets']), + restBetweenReps: serializer.fromJson(json['restBetweenReps']), + restAfterSets: serializer.fromJson(json['restAfterSets']), + repType: serializer.fromJson(json['repType']), + repLength: serializer.fromJson(json['repLength']), + repWeights: serializer.fromJson(json['repWeights']), + setWeights: serializer.fromJson(json['setWeights']), + isAlternating: serializer.fromJson(json['isAlternating']), + tempo: serializer.fromJson(json['tempo']), + status: serializer.fromJson(json['status']), + state: serializer.fromJson(json['state']), + set: serializer.fromJson(json['set']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'description': serializer.toJson(description), + 'totalSets': serializer.toJson(totalSets), + 'totalReps': serializer.toJson(totalReps), + 'restBeforeSets': serializer.toJson(restBeforeSets), + 'restBetweenSets': serializer.toJson(restBetweenSets), + 'restBetweenReps': serializer.toJson(restBetweenReps), + 'restAfterSets': serializer.toJson(restAfterSets), + 'repType': serializer.toJson(repType), + 'repLength': serializer.toJson(repLength), + 'repWeights': serializer.toJson(repWeights), + 'setWeights': serializer.toJson(setWeights), + 'isAlternating': serializer.toJson(isAlternating), + 'tempo': serializer.toJson(tempo), + 'status': serializer.toJson(status), + 'state': serializer.toJson(state), + 'set': serializer.toJson(set), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ActionsData copyWith( + {int? id, + String? title, + String? description, + int? totalSets, + String? totalReps, + Value restBeforeSets = const Value.absent(), + Value restBetweenSets = const Value.absent(), + Value restBetweenReps = const Value.absent(), + Value restAfterSets = const Value.absent(), + String? repType, + Value repLength = const Value.absent(), + Value repWeights = const Value.absent(), + Value setWeights = const Value.absent(), + bool? isAlternating, + Value tempo = const Value.absent(), + String? status, + String? state, + String? set, + DateTime? createdAt}) => + ActionsData( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + totalSets: totalSets ?? this.totalSets, + totalReps: totalReps ?? this.totalReps, + restBeforeSets: + restBeforeSets.present ? restBeforeSets.value : this.restBeforeSets, + restBetweenSets: restBetweenSets.present + ? restBetweenSets.value + : this.restBetweenSets, + restBetweenReps: restBetweenReps.present + ? restBetweenReps.value + : this.restBetweenReps, + restAfterSets: + restAfterSets.present ? restAfterSets.value : this.restAfterSets, + repType: repType ?? this.repType, + repLength: repLength.present ? repLength.value : this.repLength, + repWeights: repWeights.present ? repWeights.value : this.repWeights, + setWeights: setWeights.present ? setWeights.value : this.setWeights, + isAlternating: isAlternating ?? this.isAlternating, + tempo: tempo.present ? tempo.value : this.tempo, + status: status ?? this.status, + state: state ?? this.state, + set: set ?? this.set, + createdAt: createdAt ?? this.createdAt, + ); + ActionsData copyWithCompanion(ActionsCompanion data) { + return ActionsData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + description: + data.description.present ? data.description.value : this.description, + totalSets: data.totalSets.present ? data.totalSets.value : this.totalSets, + totalReps: data.totalReps.present ? data.totalReps.value : this.totalReps, + restBeforeSets: data.restBeforeSets.present + ? data.restBeforeSets.value + : this.restBeforeSets, + restBetweenSets: data.restBetweenSets.present + ? data.restBetweenSets.value + : this.restBetweenSets, + restBetweenReps: data.restBetweenReps.present + ? data.restBetweenReps.value + : this.restBetweenReps, + restAfterSets: data.restAfterSets.present + ? data.restAfterSets.value + : this.restAfterSets, + repType: data.repType.present ? data.repType.value : this.repType, + repLength: data.repLength.present ? data.repLength.value : this.repLength, + repWeights: + data.repWeights.present ? data.repWeights.value : this.repWeights, + setWeights: + data.setWeights.present ? data.setWeights.value : this.setWeights, + isAlternating: data.isAlternating.present + ? data.isAlternating.value + : this.isAlternating, + tempo: data.tempo.present ? data.tempo.value : this.tempo, + status: data.status.present ? data.status.value : this.status, + state: data.state.present ? data.state.value : this.state, + set: data.set.present ? data.set.value : this.set, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ActionsData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('totalSets: $totalSets, ') + ..write('totalReps: $totalReps, ') + ..write('restBeforeSets: $restBeforeSets, ') + ..write('restBetweenSets: $restBetweenSets, ') + ..write('restBetweenReps: $restBetweenReps, ') + ..write('restAfterSets: $restAfterSets, ') + ..write('repType: $repType, ') + ..write('repLength: $repLength, ') + ..write('repWeights: $repWeights, ') + ..write('setWeights: $setWeights, ') + ..write('isAlternating: $isAlternating, ') + ..write('tempo: $tempo, ') + ..write('status: $status, ') + ..write('state: $state, ') + ..write('set: $set, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash( + id, + title, + description, + totalSets, + totalReps, + restBeforeSets, + restBetweenSets, + restBetweenReps, + restAfterSets, + repType, + repLength, + repWeights, + setWeights, + isAlternating, + tempo, + status, + state, + set, + createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ActionsData && + other.id == this.id && + other.title == this.title && + other.description == this.description && + other.totalSets == this.totalSets && + other.totalReps == this.totalReps && + other.restBeforeSets == this.restBeforeSets && + other.restBetweenSets == this.restBetweenSets && + other.restBetweenReps == this.restBetweenReps && + other.restAfterSets == this.restAfterSets && + other.repType == this.repType && + other.repLength == this.repLength && + other.repWeights == this.repWeights && + other.setWeights == this.setWeights && + other.isAlternating == this.isAlternating && + other.tempo == this.tempo && + other.status == this.status && + other.state == this.state && + other.set == this.set && + other.createdAt == this.createdAt); +} + +class ActionsCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value description; + final Value totalSets; + final Value totalReps; + final Value restBeforeSets; + final Value restBetweenSets; + final Value restBetweenReps; + final Value restAfterSets; + final Value repType; + final Value repLength; + final Value repWeights; + final Value setWeights; + final Value isAlternating; + final Value tempo; + final Value status; + final Value state; + final Value set; + final Value createdAt; + const ActionsCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.description = const Value.absent(), + this.totalSets = const Value.absent(), + this.totalReps = const Value.absent(), + this.restBeforeSets = const Value.absent(), + this.restBetweenSets = const Value.absent(), + this.restBetweenReps = const Value.absent(), + this.restAfterSets = const Value.absent(), + this.repType = const Value.absent(), + this.repLength = const Value.absent(), + this.repWeights = const Value.absent(), + this.setWeights = const Value.absent(), + this.isAlternating = const Value.absent(), + this.tempo = const Value.absent(), + this.status = const Value.absent(), + this.state = const Value.absent(), + this.set = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ActionsCompanion.insert({ + this.id = const Value.absent(), + required String title, + required String description, + required int totalSets, + required String totalReps, + this.restBeforeSets = const Value.absent(), + this.restBetweenSets = const Value.absent(), + this.restBetweenReps = const Value.absent(), + this.restAfterSets = const Value.absent(), + required String repType, + this.repLength = const Value.absent(), + this.repWeights = const Value.absent(), + this.setWeights = const Value.absent(), + this.isAlternating = const Value.absent(), + this.tempo = const Value.absent(), + this.status = const Value.absent(), + this.state = const Value.absent(), + required String set, + this.createdAt = const Value.absent(), + }) : title = Value(title), + description = Value(description), + totalSets = Value(totalSets), + totalReps = Value(totalReps), + repType = Value(repType), + set = Value(set); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? description, + Expression? totalSets, + Expression? totalReps, + Expression? restBeforeSets, + Expression? restBetweenSets, + Expression? restBetweenReps, + Expression? restAfterSets, + Expression? repType, + Expression? repLength, + Expression? repWeights, + Expression? setWeights, + Expression? isAlternating, + Expression? tempo, + Expression? status, + Expression? state, + Expression? set, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (description != null) 'body': description, + if (totalSets != null) 'total_sets': totalSets, + if (totalReps != null) 'total_reps': totalReps, + if (restBeforeSets != null) 'rest_before_sets': restBeforeSets, + if (restBetweenSets != null) 'rest_between_sets': restBetweenSets, + if (restBetweenReps != null) 'rest_between_reps': restBetweenReps, + if (restAfterSets != null) 'rest_after_sets': restAfterSets, + if (repType != null) 'rep_type': repType, + if (repLength != null) 'rep_length': repLength, + if (repWeights != null) 'rep_weights': repWeights, + if (setWeights != null) 'set_weights': setWeights, + if (isAlternating != null) 'is_alternating': isAlternating, + if (tempo != null) 'tempo': tempo, + if (status != null) 'status': status, + if (state != null) 'state': state, + if (set != null) 'set': set, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ActionsCompanion copyWith( + {Value? id, + Value? title, + Value? description, + Value? totalSets, + Value? totalReps, + Value? restBeforeSets, + Value? restBetweenSets, + Value? restBetweenReps, + Value? restAfterSets, + Value? repType, + Value? repLength, + Value? repWeights, + Value? setWeights, + Value? isAlternating, + Value? tempo, + Value? status, + Value? state, + Value? set, + Value? createdAt}) { + return ActionsCompanion( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + totalSets: totalSets ?? this.totalSets, + totalReps: totalReps ?? this.totalReps, + restBeforeSets: restBeforeSets ?? this.restBeforeSets, + restBetweenSets: restBetweenSets ?? this.restBetweenSets, + restBetweenReps: restBetweenReps ?? this.restBetweenReps, + restAfterSets: restAfterSets ?? this.restAfterSets, + repType: repType ?? this.repType, + repLength: repLength ?? this.repLength, + repWeights: repWeights ?? this.repWeights, + setWeights: setWeights ?? this.setWeights, + isAlternating: isAlternating ?? this.isAlternating, + tempo: tempo ?? this.tempo, + status: status ?? this.status, + state: state ?? this.state, + set: set ?? this.set, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (description.present) { + map['body'] = Variable(description.value); + } + if (totalSets.present) { + map['total_sets'] = Variable(totalSets.value); + } + if (totalReps.present) { + map['total_reps'] = Variable(totalReps.value); + } + if (restBeforeSets.present) { + map['rest_before_sets'] = Variable(restBeforeSets.value); + } + if (restBetweenSets.present) { + map['rest_between_sets'] = Variable(restBetweenSets.value); + } + if (restBetweenReps.present) { + map['rest_between_reps'] = Variable(restBetweenReps.value); + } + if (restAfterSets.present) { + map['rest_after_sets'] = Variable(restAfterSets.value); + } + if (repType.present) { + map['rep_type'] = Variable(repType.value); + } + if (repLength.present) { + map['rep_length'] = Variable(repLength.value); + } + if (repWeights.present) { + map['rep_weights'] = Variable(repWeights.value); + } + if (setWeights.present) { + map['set_weights'] = Variable(setWeights.value); + } + if (isAlternating.present) { + map['is_alternating'] = Variable(isAlternating.value); + } + if (tempo.present) { + map['tempo'] = Variable(tempo.value); + } + if (status.present) { + map['status'] = Variable(status.value); + } + if (state.present) { + map['state'] = Variable(state.value); + } + if (set.present) { + map['set'] = Variable(set.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ActionsCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('totalSets: $totalSets, ') + ..write('totalReps: $totalReps, ') + ..write('restBeforeSets: $restBeforeSets, ') + ..write('restBetweenSets: $restBetweenSets, ') + ..write('restBetweenReps: $restBetweenReps, ') + ..write('restAfterSets: $restAfterSets, ') + ..write('repType: $repType, ') + ..write('repLength: $repLength, ') + ..write('repWeights: $repWeights, ') + ..write('setWeights: $setWeights, ') + ..write('isAlternating: $isAlternating, ') + ..write('tempo: $tempo, ') + ..write('status: $status, ') + ..write('state: $state, ') + ..write('set: $set, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class ActivityActions extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + ActivityActions(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn activityId = GeneratedColumn( + 'activity_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES activities (id) ON DELETE CASCADE')); + late final GeneratedColumn actionId = GeneratedColumn( + 'action_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES actions (id) ON DELETE CASCADE')); + late final GeneratedColumn position = GeneratedColumn( + 'position', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, activityId, actionId, position, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'activity_actions'; + @override + Set get $primaryKey => {id}; + @override + ActivityActionsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ActivityActionsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + activityId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}activity_id'])!, + actionId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}action_id'])!, + position: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}position'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + ActivityActions createAlias(String alias) { + return ActivityActions(attachedDatabase, alias); + } +} + +class ActivityActionsData extends DataClass + implements Insertable { + final int id; + final int activityId; + final int actionId; + final int position; + final DateTime createdAt; + const ActivityActionsData( + {required this.id, + required this.activityId, + required this.actionId, + required this.position, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['activity_id'] = Variable(activityId); + map['action_id'] = Variable(actionId); + map['position'] = Variable(position); + map['created_at'] = Variable(createdAt); + return map; + } + + ActivityActionsCompanion toCompanion(bool nullToAbsent) { + return ActivityActionsCompanion( + id: Value(id), + activityId: Value(activityId), + actionId: Value(actionId), + position: Value(position), + createdAt: Value(createdAt), + ); + } + + factory ActivityActionsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ActivityActionsData( + id: serializer.fromJson(json['id']), + activityId: serializer.fromJson(json['activityId']), + actionId: serializer.fromJson(json['actionId']), + position: serializer.fromJson(json['position']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'activityId': serializer.toJson(activityId), + 'actionId': serializer.toJson(actionId), + 'position': serializer.toJson(position), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ActivityActionsData copyWith( + {int? id, + int? activityId, + int? actionId, + int? position, + DateTime? createdAt}) => + ActivityActionsData( + id: id ?? this.id, + activityId: activityId ?? this.activityId, + actionId: actionId ?? this.actionId, + position: position ?? this.position, + createdAt: createdAt ?? this.createdAt, + ); + ActivityActionsData copyWithCompanion(ActivityActionsCompanion data) { + return ActivityActionsData( + id: data.id.present ? data.id.value : this.id, + activityId: + data.activityId.present ? data.activityId.value : this.activityId, + actionId: data.actionId.present ? data.actionId.value : this.actionId, + position: data.position.present ? data.position.value : this.position, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ActivityActionsData(') + ..write('id: $id, ') + ..write('activityId: $activityId, ') + ..write('actionId: $actionId, ') + ..write('position: $position, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(id, activityId, actionId, position, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ActivityActionsData && + other.id == this.id && + other.activityId == this.activityId && + other.actionId == this.actionId && + other.position == this.position && + other.createdAt == this.createdAt); +} + +class ActivityActionsCompanion extends UpdateCompanion { + final Value id; + final Value activityId; + final Value actionId; + final Value position; + final Value createdAt; + const ActivityActionsCompanion({ + this.id = const Value.absent(), + this.activityId = const Value.absent(), + this.actionId = const Value.absent(), + this.position = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ActivityActionsCompanion.insert({ + this.id = const Value.absent(), + required int activityId, + required int actionId, + required int position, + this.createdAt = const Value.absent(), + }) : activityId = Value(activityId), + actionId = Value(actionId), + position = Value(position); + static Insertable custom({ + Expression? id, + Expression? activityId, + Expression? actionId, + Expression? position, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (activityId != null) 'activity_id': activityId, + if (actionId != null) 'action_id': actionId, + if (position != null) 'position': position, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ActivityActionsCompanion copyWith( + {Value? id, + Value? activityId, + Value? actionId, + Value? position, + Value? createdAt}) { + return ActivityActionsCompanion( + id: id ?? this.id, + activityId: activityId ?? this.activityId, + actionId: actionId ?? this.actionId, + position: position ?? this.position, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (activityId.present) { + map['activity_id'] = Variable(activityId.value); + } + if (actionId.present) { + map['action_id'] = Variable(actionId.value); + } + if (position.present) { + map['position'] = Variable(position.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ActivityActionsCompanion(') + ..write('id: $id, ') + ..write('activityId: $activityId, ') + ..write('actionId: $actionId, ') + ..write('position: $position, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class MediaItems extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + MediaItems(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 64), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn description = GeneratedColumn( + 'body', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn reference = GeneratedColumn( + 'reference', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn type = GeneratedColumn( + 'type', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, title, description, reference, type, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'media_items'; + @override + Set get $primaryKey => {id}; + @override + MediaItemsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return MediaItemsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + description: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body'])!, + reference: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}reference'])!, + type: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}type'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + MediaItems createAlias(String alias) { + return MediaItems(attachedDatabase, alias); + } +} + +class MediaItemsData extends DataClass implements Insertable { + final int id; + final String title; + final String description; + final String reference; + final String type; + final DateTime createdAt; + const MediaItemsData( + {required this.id, + required this.title, + required this.description, + required this.reference, + required this.type, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + map['body'] = Variable(description); + map['reference'] = Variable(reference); + map['type'] = Variable(type); + map['created_at'] = Variable(createdAt); + return map; + } + + MediaItemsCompanion toCompanion(bool nullToAbsent) { + return MediaItemsCompanion( + id: Value(id), + title: Value(title), + description: Value(description), + reference: Value(reference), + type: Value(type), + createdAt: Value(createdAt), + ); + } + + factory MediaItemsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return MediaItemsData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + description: serializer.fromJson(json['description']), + reference: serializer.fromJson(json['reference']), + type: serializer.fromJson(json['type']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'description': serializer.toJson(description), + 'reference': serializer.toJson(reference), + 'type': serializer.toJson(type), + 'createdAt': serializer.toJson(createdAt), + }; + } + + MediaItemsData copyWith( + {int? id, + String? title, + String? description, + String? reference, + String? type, + DateTime? createdAt}) => + MediaItemsData( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + reference: reference ?? this.reference, + type: type ?? this.type, + createdAt: createdAt ?? this.createdAt, + ); + MediaItemsData copyWithCompanion(MediaItemsCompanion data) { + return MediaItemsData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + description: + data.description.present ? data.description.value : this.description, + reference: data.reference.present ? data.reference.value : this.reference, + type: data.type.present ? data.type.value : this.type, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('MediaItemsData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('reference: $reference, ') + ..write('type: $type, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(id, title, description, reference, type, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is MediaItemsData && + other.id == this.id && + other.title == this.title && + other.description == this.description && + other.reference == this.reference && + other.type == this.type && + other.createdAt == this.createdAt); +} + +class MediaItemsCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value description; + final Value reference; + final Value type; + final Value createdAt; + const MediaItemsCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.description = const Value.absent(), + this.reference = const Value.absent(), + this.type = const Value.absent(), + this.createdAt = const Value.absent(), + }); + MediaItemsCompanion.insert({ + this.id = const Value.absent(), + required String title, + required String description, + required String reference, + required String type, + this.createdAt = const Value.absent(), + }) : title = Value(title), + description = Value(description), + reference = Value(reference), + type = Value(type); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? description, + Expression? reference, + Expression? type, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (description != null) 'body': description, + if (reference != null) 'reference': reference, + if (type != null) 'type': type, + if (createdAt != null) 'created_at': createdAt, + }); + } + + MediaItemsCompanion copyWith( + {Value? id, + Value? title, + Value? description, + Value? reference, + Value? type, + Value? createdAt}) { + return MediaItemsCompanion( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + reference: reference ?? this.reference, + type: type ?? this.type, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (description.present) { + map['body'] = Variable(description.value); + } + if (reference.present) { + map['reference'] = Variable(reference.value); + } + if (type.present) { + map['type'] = Variable(type.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('MediaItemsCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('reference: $reference, ') + ..write('type: $type, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class ObjectMediaItems extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + ObjectMediaItems(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn objectId = GeneratedColumn( + 'object_id', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn objectType = GeneratedColumn( + 'object_type', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn mediaId = GeneratedColumn( + 'media_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES media_items (id) ON DELETE CASCADE')); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, objectId, objectType, mediaId, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'object_media_items'; + @override + Set get $primaryKey => {id}; + @override + ObjectMediaItemsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ObjectMediaItemsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + objectId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}object_id'])!, + objectType: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}object_type'])!, + mediaId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}media_id'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + ObjectMediaItems createAlias(String alias) { + return ObjectMediaItems(attachedDatabase, alias); + } +} + +class ObjectMediaItemsData extends DataClass + implements Insertable { + final int id; + final int objectId; + final String objectType; + final int mediaId; + final DateTime createdAt; + const ObjectMediaItemsData( + {required this.id, + required this.objectId, + required this.objectType, + required this.mediaId, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['object_id'] = Variable(objectId); + map['object_type'] = Variable(objectType); + map['media_id'] = Variable(mediaId); + map['created_at'] = Variable(createdAt); + return map; + } + + ObjectMediaItemsCompanion toCompanion(bool nullToAbsent) { + return ObjectMediaItemsCompanion( + id: Value(id), + objectId: Value(objectId), + objectType: Value(objectType), + mediaId: Value(mediaId), + createdAt: Value(createdAt), + ); + } + + factory ObjectMediaItemsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ObjectMediaItemsData( + id: serializer.fromJson(json['id']), + objectId: serializer.fromJson(json['objectId']), + objectType: serializer.fromJson(json['objectType']), + mediaId: serializer.fromJson(json['mediaId']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'objectId': serializer.toJson(objectId), + 'objectType': serializer.toJson(objectType), + 'mediaId': serializer.toJson(mediaId), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ObjectMediaItemsData copyWith( + {int? id, + int? objectId, + String? objectType, + int? mediaId, + DateTime? createdAt}) => + ObjectMediaItemsData( + id: id ?? this.id, + objectId: objectId ?? this.objectId, + objectType: objectType ?? this.objectType, + mediaId: mediaId ?? this.mediaId, + createdAt: createdAt ?? this.createdAt, + ); + ObjectMediaItemsData copyWithCompanion(ObjectMediaItemsCompanion data) { + return ObjectMediaItemsData( + id: data.id.present ? data.id.value : this.id, + objectId: data.objectId.present ? data.objectId.value : this.objectId, + objectType: + data.objectType.present ? data.objectType.value : this.objectType, + mediaId: data.mediaId.present ? data.mediaId.value : this.mediaId, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ObjectMediaItemsData(') + ..write('id: $id, ') + ..write('objectId: $objectId, ') + ..write('objectType: $objectType, ') + ..write('mediaId: $mediaId, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(id, objectId, objectType, mediaId, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ObjectMediaItemsData && + other.id == this.id && + other.objectId == this.objectId && + other.objectType == this.objectType && + other.mediaId == this.mediaId && + other.createdAt == this.createdAt); +} + +class ObjectMediaItemsCompanion extends UpdateCompanion { + final Value id; + final Value objectId; + final Value objectType; + final Value mediaId; + final Value createdAt; + const ObjectMediaItemsCompanion({ + this.id = const Value.absent(), + this.objectId = const Value.absent(), + this.objectType = const Value.absent(), + this.mediaId = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ObjectMediaItemsCompanion.insert({ + this.id = const Value.absent(), + required int objectId, + required String objectType, + required int mediaId, + this.createdAt = const Value.absent(), + }) : objectId = Value(objectId), + objectType = Value(objectType), + mediaId = Value(mediaId); + static Insertable custom({ + Expression? id, + Expression? objectId, + Expression? objectType, + Expression? mediaId, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (objectId != null) 'object_id': objectId, + if (objectType != null) 'object_type': objectType, + if (mediaId != null) 'media_id': mediaId, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ObjectMediaItemsCompanion copyWith( + {Value? id, + Value? objectId, + Value? objectType, + Value? mediaId, + Value? createdAt}) { + return ObjectMediaItemsCompanion( + id: id ?? this.id, + objectId: objectId ?? this.objectId, + objectType: objectType ?? this.objectType, + mediaId: mediaId ?? this.mediaId, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (objectId.present) { + map['object_id'] = Variable(objectId.value); + } + if (objectType.present) { + map['object_type'] = Variable(objectType.value); + } + if (mediaId.present) { + map['media_id'] = Variable(mediaId.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ObjectMediaItemsCompanion(') + ..write('id: $id, ') + ..write('objectId: $objectId, ') + ..write('objectType: $objectType, ') + ..write('mediaId: $mediaId, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class DatabaseAtV30 extends GeneratedDatabase { + DatabaseAtV30(QueryExecutor e) : super(e); + late final Sessions sessions = Sessions(this); + late final Activities activities = Activities(this); + late final SessionActivities sessionActivities = SessionActivities(this); + late final Actions actions = Actions(this); + late final ActivityActions activityActions = ActivityActions(this); + late final MediaItems mediaItems = MediaItems(this); + late final ObjectMediaItems objectMediaItems = ObjectMediaItems(this); + @override + Iterable> get allTables => + allSchemaEntities.whereType>(); + @override + List get allSchemaEntities => [ + sessions, + activities, + sessionActivities, + actions, + activityActions, + mediaItems, + objectMediaItems + ]; + @override + int get schemaVersion => 30; +} diff --git a/test/drift/sendtrain/generated/schema_v31.dart b/test/drift/sendtrain/generated/schema_v31.dart new file mode 100644 index 0000000..5d5d4d3 --- /dev/null +++ b/test/drift/sendtrain/generated/schema_v31.dart @@ -0,0 +1,2702 @@ +// dart format width=80 +// GENERATED CODE, DO NOT EDIT BY HAND. +// ignore_for_file: type=lint +import 'package:drift/drift.dart'; + +class Sessions extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + Sessions(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 32), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn content = GeneratedColumn( + 'body', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn status = GeneratedColumn( + 'status', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn achievements = GeneratedColumn( + 'achievements', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn address = GeneratedColumn( + 'address', aliasedName, true, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 256), + type: DriftSqlType.string, + requiredDuringInsert: false); + late final GeneratedColumn date = GeneratedColumn( + 'date', aliasedName, true, + type: DriftSqlType.dateTime, requiredDuringInsert: false); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, title, content, status, achievements, address, date, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'sessions'; + @override + Set get $primaryKey => {id}; + @override + SessionsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return SessionsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + content: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body'])!, + status: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}status'])!, + achievements: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}achievements']), + address: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}address']), + date: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}date']), + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + Sessions createAlias(String alias) { + return Sessions(attachedDatabase, alias); + } +} + +class SessionsData extends DataClass implements Insertable { + final int id; + final String title; + final String content; + final String status; + final String? achievements; + final String? address; + final DateTime? date; + final DateTime createdAt; + const SessionsData( + {required this.id, + required this.title, + required this.content, + required this.status, + this.achievements, + this.address, + this.date, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + map['body'] = Variable(content); + map['status'] = Variable(status); + if (!nullToAbsent || achievements != null) { + map['achievements'] = Variable(achievements); + } + if (!nullToAbsent || address != null) { + map['address'] = Variable(address); + } + if (!nullToAbsent || date != null) { + map['date'] = Variable(date); + } + map['created_at'] = Variable(createdAt); + return map; + } + + SessionsCompanion toCompanion(bool nullToAbsent) { + return SessionsCompanion( + id: Value(id), + title: Value(title), + content: Value(content), + status: Value(status), + achievements: achievements == null && nullToAbsent + ? const Value.absent() + : Value(achievements), + address: address == null && nullToAbsent + ? const Value.absent() + : Value(address), + date: date == null && nullToAbsent ? const Value.absent() : Value(date), + createdAt: Value(createdAt), + ); + } + + factory SessionsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return SessionsData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + content: serializer.fromJson(json['content']), + status: serializer.fromJson(json['status']), + achievements: serializer.fromJson(json['achievements']), + address: serializer.fromJson(json['address']), + date: serializer.fromJson(json['date']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'content': serializer.toJson(content), + 'status': serializer.toJson(status), + 'achievements': serializer.toJson(achievements), + 'address': serializer.toJson(address), + 'date': serializer.toJson(date), + 'createdAt': serializer.toJson(createdAt), + }; + } + + SessionsData copyWith( + {int? id, + String? title, + String? content, + String? status, + Value achievements = const Value.absent(), + Value address = const Value.absent(), + Value date = const Value.absent(), + DateTime? createdAt}) => + SessionsData( + id: id ?? this.id, + title: title ?? this.title, + content: content ?? this.content, + status: status ?? this.status, + achievements: + achievements.present ? achievements.value : this.achievements, + address: address.present ? address.value : this.address, + date: date.present ? date.value : this.date, + createdAt: createdAt ?? this.createdAt, + ); + SessionsData copyWithCompanion(SessionsCompanion data) { + return SessionsData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + content: data.content.present ? data.content.value : this.content, + status: data.status.present ? data.status.value : this.status, + achievements: data.achievements.present + ? data.achievements.value + : this.achievements, + address: data.address.present ? data.address.value : this.address, + date: data.date.present ? data.date.value : this.date, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('SessionsData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('content: $content, ') + ..write('status: $status, ') + ..write('achievements: $achievements, ') + ..write('address: $address, ') + ..write('date: $date, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash( + id, title, content, status, achievements, address, date, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is SessionsData && + other.id == this.id && + other.title == this.title && + other.content == this.content && + other.status == this.status && + other.achievements == this.achievements && + other.address == this.address && + other.date == this.date && + other.createdAt == this.createdAt); +} + +class SessionsCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value content; + final Value status; + final Value achievements; + final Value address; + final Value date; + final Value createdAt; + const SessionsCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.content = const Value.absent(), + this.status = const Value.absent(), + this.achievements = const Value.absent(), + this.address = const Value.absent(), + this.date = const Value.absent(), + this.createdAt = const Value.absent(), + }); + SessionsCompanion.insert({ + this.id = const Value.absent(), + required String title, + required String content, + required String status, + this.achievements = const Value.absent(), + this.address = const Value.absent(), + this.date = const Value.absent(), + this.createdAt = const Value.absent(), + }) : title = Value(title), + content = Value(content), + status = Value(status); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? content, + Expression? status, + Expression? achievements, + Expression? address, + Expression? date, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (content != null) 'body': content, + if (status != null) 'status': status, + if (achievements != null) 'achievements': achievements, + if (address != null) 'address': address, + if (date != null) 'date': date, + if (createdAt != null) 'created_at': createdAt, + }); + } + + SessionsCompanion copyWith( + {Value? id, + Value? title, + Value? content, + Value? status, + Value? achievements, + Value? address, + Value? date, + Value? createdAt}) { + return SessionsCompanion( + id: id ?? this.id, + title: title ?? this.title, + content: content ?? this.content, + status: status ?? this.status, + achievements: achievements ?? this.achievements, + address: address ?? this.address, + date: date ?? this.date, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (content.present) { + map['body'] = Variable(content.value); + } + if (status.present) { + map['status'] = Variable(status.value); + } + if (achievements.present) { + map['achievements'] = Variable(achievements.value); + } + if (address.present) { + map['address'] = Variable(address.value); + } + if (date.present) { + map['date'] = Variable(date.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('SessionsCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('content: $content, ') + ..write('status: $status, ') + ..write('achievements: $achievements, ') + ..write('address: $address, ') + ..write('date: $date, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class Activities extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + Activities(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 100), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn type = GeneratedColumn( + 'type', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn description = GeneratedColumn( + 'body', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn category = GeneratedColumn( + 'category', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn force = GeneratedColumn( + 'force', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn level = GeneratedColumn( + 'level', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn mechanic = GeneratedColumn( + 'mechanic', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn equipment = GeneratedColumn( + 'equipment', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn primaryMuscles = GeneratedColumn( + 'primary_muscles', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn secondaryMuscles = GeneratedColumn( + 'secondary_muscles', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => [ + id, + title, + type, + description, + category, + force, + level, + mechanic, + equipment, + primaryMuscles, + secondaryMuscles, + createdAt + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'activities'; + @override + Set get $primaryKey => {id}; + @override + ActivitiesData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ActivitiesData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + type: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}type']), + description: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body']), + category: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}category']), + force: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}force']), + level: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}level']), + mechanic: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}mechanic']), + equipment: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}equipment']), + primaryMuscles: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}primary_muscles']), + secondaryMuscles: attachedDatabase.typeMapping.read( + DriftSqlType.string, data['${effectivePrefix}secondary_muscles']), + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + Activities createAlias(String alias) { + return Activities(attachedDatabase, alias); + } +} + +class ActivitiesData extends DataClass implements Insertable { + final int id; + final String title; + final String? type; + final String? description; + final String? category; + final String? force; + final String? level; + final String? mechanic; + final String? equipment; + final String? primaryMuscles; + final String? secondaryMuscles; + final DateTime createdAt; + const ActivitiesData( + {required this.id, + required this.title, + this.type, + this.description, + this.category, + this.force, + this.level, + this.mechanic, + this.equipment, + this.primaryMuscles, + this.secondaryMuscles, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + if (!nullToAbsent || type != null) { + map['type'] = Variable(type); + } + if (!nullToAbsent || description != null) { + map['body'] = Variable(description); + } + if (!nullToAbsent || category != null) { + map['category'] = Variable(category); + } + if (!nullToAbsent || force != null) { + map['force'] = Variable(force); + } + if (!nullToAbsent || level != null) { + map['level'] = Variable(level); + } + if (!nullToAbsent || mechanic != null) { + map['mechanic'] = Variable(mechanic); + } + if (!nullToAbsent || equipment != null) { + map['equipment'] = Variable(equipment); + } + if (!nullToAbsent || primaryMuscles != null) { + map['primary_muscles'] = Variable(primaryMuscles); + } + if (!nullToAbsent || secondaryMuscles != null) { + map['secondary_muscles'] = Variable(secondaryMuscles); + } + map['created_at'] = Variable(createdAt); + return map; + } + + ActivitiesCompanion toCompanion(bool nullToAbsent) { + return ActivitiesCompanion( + id: Value(id), + title: Value(title), + type: type == null && nullToAbsent ? const Value.absent() : Value(type), + description: description == null && nullToAbsent + ? const Value.absent() + : Value(description), + category: category == null && nullToAbsent + ? const Value.absent() + : Value(category), + force: + force == null && nullToAbsent ? const Value.absent() : Value(force), + level: + level == null && nullToAbsent ? const Value.absent() : Value(level), + mechanic: mechanic == null && nullToAbsent + ? const Value.absent() + : Value(mechanic), + equipment: equipment == null && nullToAbsent + ? const Value.absent() + : Value(equipment), + primaryMuscles: primaryMuscles == null && nullToAbsent + ? const Value.absent() + : Value(primaryMuscles), + secondaryMuscles: secondaryMuscles == null && nullToAbsent + ? const Value.absent() + : Value(secondaryMuscles), + createdAt: Value(createdAt), + ); + } + + factory ActivitiesData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ActivitiesData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + type: serializer.fromJson(json['type']), + description: serializer.fromJson(json['description']), + category: serializer.fromJson(json['category']), + force: serializer.fromJson(json['force']), + level: serializer.fromJson(json['level']), + mechanic: serializer.fromJson(json['mechanic']), + equipment: serializer.fromJson(json['equipment']), + primaryMuscles: serializer.fromJson(json['primaryMuscles']), + secondaryMuscles: serializer.fromJson(json['secondaryMuscles']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'type': serializer.toJson(type), + 'description': serializer.toJson(description), + 'category': serializer.toJson(category), + 'force': serializer.toJson(force), + 'level': serializer.toJson(level), + 'mechanic': serializer.toJson(mechanic), + 'equipment': serializer.toJson(equipment), + 'primaryMuscles': serializer.toJson(primaryMuscles), + 'secondaryMuscles': serializer.toJson(secondaryMuscles), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ActivitiesData copyWith( + {int? id, + String? title, + Value type = const Value.absent(), + Value description = const Value.absent(), + Value category = const Value.absent(), + Value force = const Value.absent(), + Value level = const Value.absent(), + Value mechanic = const Value.absent(), + Value equipment = const Value.absent(), + Value primaryMuscles = const Value.absent(), + Value secondaryMuscles = const Value.absent(), + DateTime? createdAt}) => + ActivitiesData( + id: id ?? this.id, + title: title ?? this.title, + type: type.present ? type.value : this.type, + description: description.present ? description.value : this.description, + category: category.present ? category.value : this.category, + force: force.present ? force.value : this.force, + level: level.present ? level.value : this.level, + mechanic: mechanic.present ? mechanic.value : this.mechanic, + equipment: equipment.present ? equipment.value : this.equipment, + primaryMuscles: + primaryMuscles.present ? primaryMuscles.value : this.primaryMuscles, + secondaryMuscles: secondaryMuscles.present + ? secondaryMuscles.value + : this.secondaryMuscles, + createdAt: createdAt ?? this.createdAt, + ); + ActivitiesData copyWithCompanion(ActivitiesCompanion data) { + return ActivitiesData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + type: data.type.present ? data.type.value : this.type, + description: + data.description.present ? data.description.value : this.description, + category: data.category.present ? data.category.value : this.category, + force: data.force.present ? data.force.value : this.force, + level: data.level.present ? data.level.value : this.level, + mechanic: data.mechanic.present ? data.mechanic.value : this.mechanic, + equipment: data.equipment.present ? data.equipment.value : this.equipment, + primaryMuscles: data.primaryMuscles.present + ? data.primaryMuscles.value + : this.primaryMuscles, + secondaryMuscles: data.secondaryMuscles.present + ? data.secondaryMuscles.value + : this.secondaryMuscles, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ActivitiesData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('type: $type, ') + ..write('description: $description, ') + ..write('category: $category, ') + ..write('force: $force, ') + ..write('level: $level, ') + ..write('mechanic: $mechanic, ') + ..write('equipment: $equipment, ') + ..write('primaryMuscles: $primaryMuscles, ') + ..write('secondaryMuscles: $secondaryMuscles, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(id, title, type, description, category, force, + level, mechanic, equipment, primaryMuscles, secondaryMuscles, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ActivitiesData && + other.id == this.id && + other.title == this.title && + other.type == this.type && + other.description == this.description && + other.category == this.category && + other.force == this.force && + other.level == this.level && + other.mechanic == this.mechanic && + other.equipment == this.equipment && + other.primaryMuscles == this.primaryMuscles && + other.secondaryMuscles == this.secondaryMuscles && + other.createdAt == this.createdAt); +} + +class ActivitiesCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value type; + final Value description; + final Value category; + final Value force; + final Value level; + final Value mechanic; + final Value equipment; + final Value primaryMuscles; + final Value secondaryMuscles; + final Value createdAt; + const ActivitiesCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.type = const Value.absent(), + this.description = const Value.absent(), + this.category = const Value.absent(), + this.force = const Value.absent(), + this.level = const Value.absent(), + this.mechanic = const Value.absent(), + this.equipment = const Value.absent(), + this.primaryMuscles = const Value.absent(), + this.secondaryMuscles = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ActivitiesCompanion.insert({ + this.id = const Value.absent(), + required String title, + this.type = const Value.absent(), + this.description = const Value.absent(), + this.category = const Value.absent(), + this.force = const Value.absent(), + this.level = const Value.absent(), + this.mechanic = const Value.absent(), + this.equipment = const Value.absent(), + this.primaryMuscles = const Value.absent(), + this.secondaryMuscles = const Value.absent(), + this.createdAt = const Value.absent(), + }) : title = Value(title); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? type, + Expression? description, + Expression? category, + Expression? force, + Expression? level, + Expression? mechanic, + Expression? equipment, + Expression? primaryMuscles, + Expression? secondaryMuscles, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (type != null) 'type': type, + if (description != null) 'body': description, + if (category != null) 'category': category, + if (force != null) 'force': force, + if (level != null) 'level': level, + if (mechanic != null) 'mechanic': mechanic, + if (equipment != null) 'equipment': equipment, + if (primaryMuscles != null) 'primary_muscles': primaryMuscles, + if (secondaryMuscles != null) 'secondary_muscles': secondaryMuscles, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ActivitiesCompanion copyWith( + {Value? id, + Value? title, + Value? type, + Value? description, + Value? category, + Value? force, + Value? level, + Value? mechanic, + Value? equipment, + Value? primaryMuscles, + Value? secondaryMuscles, + Value? createdAt}) { + return ActivitiesCompanion( + id: id ?? this.id, + title: title ?? this.title, + type: type ?? this.type, + description: description ?? this.description, + category: category ?? this.category, + force: force ?? this.force, + level: level ?? this.level, + mechanic: mechanic ?? this.mechanic, + equipment: equipment ?? this.equipment, + primaryMuscles: primaryMuscles ?? this.primaryMuscles, + secondaryMuscles: secondaryMuscles ?? this.secondaryMuscles, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (type.present) { + map['type'] = Variable(type.value); + } + if (description.present) { + map['body'] = Variable(description.value); + } + if (category.present) { + map['category'] = Variable(category.value); + } + if (force.present) { + map['force'] = Variable(force.value); + } + if (level.present) { + map['level'] = Variable(level.value); + } + if (mechanic.present) { + map['mechanic'] = Variable(mechanic.value); + } + if (equipment.present) { + map['equipment'] = Variable(equipment.value); + } + if (primaryMuscles.present) { + map['primary_muscles'] = Variable(primaryMuscles.value); + } + if (secondaryMuscles.present) { + map['secondary_muscles'] = Variable(secondaryMuscles.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ActivitiesCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('type: $type, ') + ..write('description: $description, ') + ..write('category: $category, ') + ..write('force: $force, ') + ..write('level: $level, ') + ..write('mechanic: $mechanic, ') + ..write('equipment: $equipment, ') + ..write('primaryMuscles: $primaryMuscles, ') + ..write('secondaryMuscles: $secondaryMuscles, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class SessionActivities extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + SessionActivities(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn sessionId = GeneratedColumn( + 'session_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES sessions (id) ON DELETE CASCADE')); + late final GeneratedColumn activityId = GeneratedColumn( + 'activity_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES activities (id) ON DELETE CASCADE')); + late final GeneratedColumn position = GeneratedColumn( + 'position', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn results = GeneratedColumn( + 'results', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, sessionId, activityId, position, results, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'session_activities'; + @override + Set get $primaryKey => {id}; + @override + SessionActivitiesData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return SessionActivitiesData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + sessionId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}session_id'])!, + activityId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}activity_id'])!, + position: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}position'])!, + results: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}results']), + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + SessionActivities createAlias(String alias) { + return SessionActivities(attachedDatabase, alias); + } +} + +class SessionActivitiesData extends DataClass + implements Insertable { + final int id; + final int sessionId; + final int activityId; + final int position; + final String? results; + final DateTime createdAt; + const SessionActivitiesData( + {required this.id, + required this.sessionId, + required this.activityId, + required this.position, + this.results, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['session_id'] = Variable(sessionId); + map['activity_id'] = Variable(activityId); + map['position'] = Variable(position); + if (!nullToAbsent || results != null) { + map['results'] = Variable(results); + } + map['created_at'] = Variable(createdAt); + return map; + } + + SessionActivitiesCompanion toCompanion(bool nullToAbsent) { + return SessionActivitiesCompanion( + id: Value(id), + sessionId: Value(sessionId), + activityId: Value(activityId), + position: Value(position), + results: results == null && nullToAbsent + ? const Value.absent() + : Value(results), + createdAt: Value(createdAt), + ); + } + + factory SessionActivitiesData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return SessionActivitiesData( + id: serializer.fromJson(json['id']), + sessionId: serializer.fromJson(json['sessionId']), + activityId: serializer.fromJson(json['activityId']), + position: serializer.fromJson(json['position']), + results: serializer.fromJson(json['results']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'sessionId': serializer.toJson(sessionId), + 'activityId': serializer.toJson(activityId), + 'position': serializer.toJson(position), + 'results': serializer.toJson(results), + 'createdAt': serializer.toJson(createdAt), + }; + } + + SessionActivitiesData copyWith( + {int? id, + int? sessionId, + int? activityId, + int? position, + Value results = const Value.absent(), + DateTime? createdAt}) => + SessionActivitiesData( + id: id ?? this.id, + sessionId: sessionId ?? this.sessionId, + activityId: activityId ?? this.activityId, + position: position ?? this.position, + results: results.present ? results.value : this.results, + createdAt: createdAt ?? this.createdAt, + ); + SessionActivitiesData copyWithCompanion(SessionActivitiesCompanion data) { + return SessionActivitiesData( + id: data.id.present ? data.id.value : this.id, + sessionId: data.sessionId.present ? data.sessionId.value : this.sessionId, + activityId: + data.activityId.present ? data.activityId.value : this.activityId, + position: data.position.present ? data.position.value : this.position, + results: data.results.present ? data.results.value : this.results, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('SessionActivitiesData(') + ..write('id: $id, ') + ..write('sessionId: $sessionId, ') + ..write('activityId: $activityId, ') + ..write('position: $position, ') + ..write('results: $results, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(id, sessionId, activityId, position, results, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is SessionActivitiesData && + other.id == this.id && + other.sessionId == this.sessionId && + other.activityId == this.activityId && + other.position == this.position && + other.results == this.results && + other.createdAt == this.createdAt); +} + +class SessionActivitiesCompanion + extends UpdateCompanion { + final Value id; + final Value sessionId; + final Value activityId; + final Value position; + final Value results; + final Value createdAt; + const SessionActivitiesCompanion({ + this.id = const Value.absent(), + this.sessionId = const Value.absent(), + this.activityId = const Value.absent(), + this.position = const Value.absent(), + this.results = const Value.absent(), + this.createdAt = const Value.absent(), + }); + SessionActivitiesCompanion.insert({ + this.id = const Value.absent(), + required int sessionId, + required int activityId, + required int position, + this.results = const Value.absent(), + this.createdAt = const Value.absent(), + }) : sessionId = Value(sessionId), + activityId = Value(activityId), + position = Value(position); + static Insertable custom({ + Expression? id, + Expression? sessionId, + Expression? activityId, + Expression? position, + Expression? results, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (sessionId != null) 'session_id': sessionId, + if (activityId != null) 'activity_id': activityId, + if (position != null) 'position': position, + if (results != null) 'results': results, + if (createdAt != null) 'created_at': createdAt, + }); + } + + SessionActivitiesCompanion copyWith( + {Value? id, + Value? sessionId, + Value? activityId, + Value? position, + Value? results, + Value? createdAt}) { + return SessionActivitiesCompanion( + id: id ?? this.id, + sessionId: sessionId ?? this.sessionId, + activityId: activityId ?? this.activityId, + position: position ?? this.position, + results: results ?? this.results, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (sessionId.present) { + map['session_id'] = Variable(sessionId.value); + } + if (activityId.present) { + map['activity_id'] = Variable(activityId.value); + } + if (position.present) { + map['position'] = Variable(position.value); + } + if (results.present) { + map['results'] = Variable(results.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('SessionActivitiesCompanion(') + ..write('id: $id, ') + ..write('sessionId: $sessionId, ') + ..write('activityId: $activityId, ') + ..write('position: $position, ') + ..write('results: $results, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class Actions extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + Actions(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 64), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn description = GeneratedColumn( + 'body', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn totalSets = GeneratedColumn( + 'total_sets', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn totalReps = GeneratedColumn( + 'total_reps', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 1, maxTextLength: 32), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn restBeforeSets = GeneratedColumn( + 'rest_before_sets', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn restBetweenSets = GeneratedColumn( + 'rest_between_sets', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn restBetweenReps = GeneratedColumn( + 'rest_between_reps', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn restAfterSets = GeneratedColumn( + 'rest_after_sets', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn repType = GeneratedColumn( + 'rep_type', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn repLength = GeneratedColumn( + 'rep_length', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn repWeights = GeneratedColumn( + 'rep_weights', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn setWeights = GeneratedColumn( + 'set_weights', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn isAlternating = GeneratedColumn( + 'is_alternating', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("is_alternating" IN (0, 1))'), + defaultValue: Variable(false)); + late final GeneratedColumn tempo = GeneratedColumn( + 'tempo', aliasedName, true, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 6, maxTextLength: 36), + type: DriftSqlType.string, + requiredDuringInsert: false); + late final GeneratedColumn status = GeneratedColumn( + 'status', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: Variable('pending')); + late final GeneratedColumn state = GeneratedColumn( + 'state', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: Variable( + "{\"currentSet\": 1, \"currentRep\": 1, \"currentTime\": 0}")); + late final GeneratedColumn set = GeneratedColumn( + 'set', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => [ + id, + title, + description, + totalSets, + totalReps, + restBeforeSets, + restBetweenSets, + restBetweenReps, + restAfterSets, + repType, + repLength, + repWeights, + setWeights, + isAlternating, + tempo, + status, + state, + set, + createdAt + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'actions'; + @override + Set get $primaryKey => {id}; + @override + ActionsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ActionsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + description: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body'])!, + totalSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}total_sets'])!, + totalReps: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}total_reps'])!, + restBeforeSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_before_sets']), + restBetweenSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_between_sets']), + restBetweenReps: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_between_reps']), + restAfterSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_after_sets']), + repType: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}rep_type'])!, + repLength: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rep_length']), + repWeights: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}rep_weights']), + setWeights: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}set_weights']), + isAlternating: attachedDatabase.typeMapping + .read(DriftSqlType.bool, data['${effectivePrefix}is_alternating'])!, + tempo: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}tempo']), + status: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}status'])!, + state: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}state'])!, + set: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}set'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + Actions createAlias(String alias) { + return Actions(attachedDatabase, alias); + } +} + +class ActionsData extends DataClass implements Insertable { + final int id; + final String title; + final String description; + final int totalSets; + final String totalReps; + final int? restBeforeSets; + final int? restBetweenSets; + final int? restBetweenReps; + final int? restAfterSets; + final String repType; + final int? repLength; + final String? repWeights; + final String? setWeights; + final bool isAlternating; + final String? tempo; + final String status; + final String state; + final String set; + final DateTime createdAt; + const ActionsData( + {required this.id, + required this.title, + required this.description, + required this.totalSets, + required this.totalReps, + this.restBeforeSets, + this.restBetweenSets, + this.restBetweenReps, + this.restAfterSets, + required this.repType, + this.repLength, + this.repWeights, + this.setWeights, + required this.isAlternating, + this.tempo, + required this.status, + required this.state, + required this.set, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + map['body'] = Variable(description); + map['total_sets'] = Variable(totalSets); + map['total_reps'] = Variable(totalReps); + if (!nullToAbsent || restBeforeSets != null) { + map['rest_before_sets'] = Variable(restBeforeSets); + } + if (!nullToAbsent || restBetweenSets != null) { + map['rest_between_sets'] = Variable(restBetweenSets); + } + if (!nullToAbsent || restBetweenReps != null) { + map['rest_between_reps'] = Variable(restBetweenReps); + } + if (!nullToAbsent || restAfterSets != null) { + map['rest_after_sets'] = Variable(restAfterSets); + } + map['rep_type'] = Variable(repType); + if (!nullToAbsent || repLength != null) { + map['rep_length'] = Variable(repLength); + } + if (!nullToAbsent || repWeights != null) { + map['rep_weights'] = Variable(repWeights); + } + if (!nullToAbsent || setWeights != null) { + map['set_weights'] = Variable(setWeights); + } + map['is_alternating'] = Variable(isAlternating); + if (!nullToAbsent || tempo != null) { + map['tempo'] = Variable(tempo); + } + map['status'] = Variable(status); + map['state'] = Variable(state); + map['set'] = Variable(set); + map['created_at'] = Variable(createdAt); + return map; + } + + ActionsCompanion toCompanion(bool nullToAbsent) { + return ActionsCompanion( + id: Value(id), + title: Value(title), + description: Value(description), + totalSets: Value(totalSets), + totalReps: Value(totalReps), + restBeforeSets: restBeforeSets == null && nullToAbsent + ? const Value.absent() + : Value(restBeforeSets), + restBetweenSets: restBetweenSets == null && nullToAbsent + ? const Value.absent() + : Value(restBetweenSets), + restBetweenReps: restBetweenReps == null && nullToAbsent + ? const Value.absent() + : Value(restBetweenReps), + restAfterSets: restAfterSets == null && nullToAbsent + ? const Value.absent() + : Value(restAfterSets), + repType: Value(repType), + repLength: repLength == null && nullToAbsent + ? const Value.absent() + : Value(repLength), + repWeights: repWeights == null && nullToAbsent + ? const Value.absent() + : Value(repWeights), + setWeights: setWeights == null && nullToAbsent + ? const Value.absent() + : Value(setWeights), + isAlternating: Value(isAlternating), + tempo: + tempo == null && nullToAbsent ? const Value.absent() : Value(tempo), + status: Value(status), + state: Value(state), + set: Value(set), + createdAt: Value(createdAt), + ); + } + + factory ActionsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ActionsData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + description: serializer.fromJson(json['description']), + totalSets: serializer.fromJson(json['totalSets']), + totalReps: serializer.fromJson(json['totalReps']), + restBeforeSets: serializer.fromJson(json['restBeforeSets']), + restBetweenSets: serializer.fromJson(json['restBetweenSets']), + restBetweenReps: serializer.fromJson(json['restBetweenReps']), + restAfterSets: serializer.fromJson(json['restAfterSets']), + repType: serializer.fromJson(json['repType']), + repLength: serializer.fromJson(json['repLength']), + repWeights: serializer.fromJson(json['repWeights']), + setWeights: serializer.fromJson(json['setWeights']), + isAlternating: serializer.fromJson(json['isAlternating']), + tempo: serializer.fromJson(json['tempo']), + status: serializer.fromJson(json['status']), + state: serializer.fromJson(json['state']), + set: serializer.fromJson(json['set']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'description': serializer.toJson(description), + 'totalSets': serializer.toJson(totalSets), + 'totalReps': serializer.toJson(totalReps), + 'restBeforeSets': serializer.toJson(restBeforeSets), + 'restBetweenSets': serializer.toJson(restBetweenSets), + 'restBetweenReps': serializer.toJson(restBetweenReps), + 'restAfterSets': serializer.toJson(restAfterSets), + 'repType': serializer.toJson(repType), + 'repLength': serializer.toJson(repLength), + 'repWeights': serializer.toJson(repWeights), + 'setWeights': serializer.toJson(setWeights), + 'isAlternating': serializer.toJson(isAlternating), + 'tempo': serializer.toJson(tempo), + 'status': serializer.toJson(status), + 'state': serializer.toJson(state), + 'set': serializer.toJson(set), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ActionsData copyWith( + {int? id, + String? title, + String? description, + int? totalSets, + String? totalReps, + Value restBeforeSets = const Value.absent(), + Value restBetweenSets = const Value.absent(), + Value restBetweenReps = const Value.absent(), + Value restAfterSets = const Value.absent(), + String? repType, + Value repLength = const Value.absent(), + Value repWeights = const Value.absent(), + Value setWeights = const Value.absent(), + bool? isAlternating, + Value tempo = const Value.absent(), + String? status, + String? state, + String? set, + DateTime? createdAt}) => + ActionsData( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + totalSets: totalSets ?? this.totalSets, + totalReps: totalReps ?? this.totalReps, + restBeforeSets: + restBeforeSets.present ? restBeforeSets.value : this.restBeforeSets, + restBetweenSets: restBetweenSets.present + ? restBetweenSets.value + : this.restBetweenSets, + restBetweenReps: restBetweenReps.present + ? restBetweenReps.value + : this.restBetweenReps, + restAfterSets: + restAfterSets.present ? restAfterSets.value : this.restAfterSets, + repType: repType ?? this.repType, + repLength: repLength.present ? repLength.value : this.repLength, + repWeights: repWeights.present ? repWeights.value : this.repWeights, + setWeights: setWeights.present ? setWeights.value : this.setWeights, + isAlternating: isAlternating ?? this.isAlternating, + tempo: tempo.present ? tempo.value : this.tempo, + status: status ?? this.status, + state: state ?? this.state, + set: set ?? this.set, + createdAt: createdAt ?? this.createdAt, + ); + ActionsData copyWithCompanion(ActionsCompanion data) { + return ActionsData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + description: + data.description.present ? data.description.value : this.description, + totalSets: data.totalSets.present ? data.totalSets.value : this.totalSets, + totalReps: data.totalReps.present ? data.totalReps.value : this.totalReps, + restBeforeSets: data.restBeforeSets.present + ? data.restBeforeSets.value + : this.restBeforeSets, + restBetweenSets: data.restBetweenSets.present + ? data.restBetweenSets.value + : this.restBetweenSets, + restBetweenReps: data.restBetweenReps.present + ? data.restBetweenReps.value + : this.restBetweenReps, + restAfterSets: data.restAfterSets.present + ? data.restAfterSets.value + : this.restAfterSets, + repType: data.repType.present ? data.repType.value : this.repType, + repLength: data.repLength.present ? data.repLength.value : this.repLength, + repWeights: + data.repWeights.present ? data.repWeights.value : this.repWeights, + setWeights: + data.setWeights.present ? data.setWeights.value : this.setWeights, + isAlternating: data.isAlternating.present + ? data.isAlternating.value + : this.isAlternating, + tempo: data.tempo.present ? data.tempo.value : this.tempo, + status: data.status.present ? data.status.value : this.status, + state: data.state.present ? data.state.value : this.state, + set: data.set.present ? data.set.value : this.set, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ActionsData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('totalSets: $totalSets, ') + ..write('totalReps: $totalReps, ') + ..write('restBeforeSets: $restBeforeSets, ') + ..write('restBetweenSets: $restBetweenSets, ') + ..write('restBetweenReps: $restBetweenReps, ') + ..write('restAfterSets: $restAfterSets, ') + ..write('repType: $repType, ') + ..write('repLength: $repLength, ') + ..write('repWeights: $repWeights, ') + ..write('setWeights: $setWeights, ') + ..write('isAlternating: $isAlternating, ') + ..write('tempo: $tempo, ') + ..write('status: $status, ') + ..write('state: $state, ') + ..write('set: $set, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash( + id, + title, + description, + totalSets, + totalReps, + restBeforeSets, + restBetweenSets, + restBetweenReps, + restAfterSets, + repType, + repLength, + repWeights, + setWeights, + isAlternating, + tempo, + status, + state, + set, + createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ActionsData && + other.id == this.id && + other.title == this.title && + other.description == this.description && + other.totalSets == this.totalSets && + other.totalReps == this.totalReps && + other.restBeforeSets == this.restBeforeSets && + other.restBetweenSets == this.restBetweenSets && + other.restBetweenReps == this.restBetweenReps && + other.restAfterSets == this.restAfterSets && + other.repType == this.repType && + other.repLength == this.repLength && + other.repWeights == this.repWeights && + other.setWeights == this.setWeights && + other.isAlternating == this.isAlternating && + other.tempo == this.tempo && + other.status == this.status && + other.state == this.state && + other.set == this.set && + other.createdAt == this.createdAt); +} + +class ActionsCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value description; + final Value totalSets; + final Value totalReps; + final Value restBeforeSets; + final Value restBetweenSets; + final Value restBetweenReps; + final Value restAfterSets; + final Value repType; + final Value repLength; + final Value repWeights; + final Value setWeights; + final Value isAlternating; + final Value tempo; + final Value status; + final Value state; + final Value set; + final Value createdAt; + const ActionsCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.description = const Value.absent(), + this.totalSets = const Value.absent(), + this.totalReps = const Value.absent(), + this.restBeforeSets = const Value.absent(), + this.restBetweenSets = const Value.absent(), + this.restBetweenReps = const Value.absent(), + this.restAfterSets = const Value.absent(), + this.repType = const Value.absent(), + this.repLength = const Value.absent(), + this.repWeights = const Value.absent(), + this.setWeights = const Value.absent(), + this.isAlternating = const Value.absent(), + this.tempo = const Value.absent(), + this.status = const Value.absent(), + this.state = const Value.absent(), + this.set = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ActionsCompanion.insert({ + this.id = const Value.absent(), + required String title, + required String description, + required int totalSets, + required String totalReps, + this.restBeforeSets = const Value.absent(), + this.restBetweenSets = const Value.absent(), + this.restBetweenReps = const Value.absent(), + this.restAfterSets = const Value.absent(), + required String repType, + this.repLength = const Value.absent(), + this.repWeights = const Value.absent(), + this.setWeights = const Value.absent(), + this.isAlternating = const Value.absent(), + this.tempo = const Value.absent(), + this.status = const Value.absent(), + this.state = const Value.absent(), + required String set, + this.createdAt = const Value.absent(), + }) : title = Value(title), + description = Value(description), + totalSets = Value(totalSets), + totalReps = Value(totalReps), + repType = Value(repType), + set = Value(set); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? description, + Expression? totalSets, + Expression? totalReps, + Expression? restBeforeSets, + Expression? restBetweenSets, + Expression? restBetweenReps, + Expression? restAfterSets, + Expression? repType, + Expression? repLength, + Expression? repWeights, + Expression? setWeights, + Expression? isAlternating, + Expression? tempo, + Expression? status, + Expression? state, + Expression? set, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (description != null) 'body': description, + if (totalSets != null) 'total_sets': totalSets, + if (totalReps != null) 'total_reps': totalReps, + if (restBeforeSets != null) 'rest_before_sets': restBeforeSets, + if (restBetweenSets != null) 'rest_between_sets': restBetweenSets, + if (restBetweenReps != null) 'rest_between_reps': restBetweenReps, + if (restAfterSets != null) 'rest_after_sets': restAfterSets, + if (repType != null) 'rep_type': repType, + if (repLength != null) 'rep_length': repLength, + if (repWeights != null) 'rep_weights': repWeights, + if (setWeights != null) 'set_weights': setWeights, + if (isAlternating != null) 'is_alternating': isAlternating, + if (tempo != null) 'tempo': tempo, + if (status != null) 'status': status, + if (state != null) 'state': state, + if (set != null) 'set': set, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ActionsCompanion copyWith( + {Value? id, + Value? title, + Value? description, + Value? totalSets, + Value? totalReps, + Value? restBeforeSets, + Value? restBetweenSets, + Value? restBetweenReps, + Value? restAfterSets, + Value? repType, + Value? repLength, + Value? repWeights, + Value? setWeights, + Value? isAlternating, + Value? tempo, + Value? status, + Value? state, + Value? set, + Value? createdAt}) { + return ActionsCompanion( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + totalSets: totalSets ?? this.totalSets, + totalReps: totalReps ?? this.totalReps, + restBeforeSets: restBeforeSets ?? this.restBeforeSets, + restBetweenSets: restBetweenSets ?? this.restBetweenSets, + restBetweenReps: restBetweenReps ?? this.restBetweenReps, + restAfterSets: restAfterSets ?? this.restAfterSets, + repType: repType ?? this.repType, + repLength: repLength ?? this.repLength, + repWeights: repWeights ?? this.repWeights, + setWeights: setWeights ?? this.setWeights, + isAlternating: isAlternating ?? this.isAlternating, + tempo: tempo ?? this.tempo, + status: status ?? this.status, + state: state ?? this.state, + set: set ?? this.set, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (description.present) { + map['body'] = Variable(description.value); + } + if (totalSets.present) { + map['total_sets'] = Variable(totalSets.value); + } + if (totalReps.present) { + map['total_reps'] = Variable(totalReps.value); + } + if (restBeforeSets.present) { + map['rest_before_sets'] = Variable(restBeforeSets.value); + } + if (restBetweenSets.present) { + map['rest_between_sets'] = Variable(restBetweenSets.value); + } + if (restBetweenReps.present) { + map['rest_between_reps'] = Variable(restBetweenReps.value); + } + if (restAfterSets.present) { + map['rest_after_sets'] = Variable(restAfterSets.value); + } + if (repType.present) { + map['rep_type'] = Variable(repType.value); + } + if (repLength.present) { + map['rep_length'] = Variable(repLength.value); + } + if (repWeights.present) { + map['rep_weights'] = Variable(repWeights.value); + } + if (setWeights.present) { + map['set_weights'] = Variable(setWeights.value); + } + if (isAlternating.present) { + map['is_alternating'] = Variable(isAlternating.value); + } + if (tempo.present) { + map['tempo'] = Variable(tempo.value); + } + if (status.present) { + map['status'] = Variable(status.value); + } + if (state.present) { + map['state'] = Variable(state.value); + } + if (set.present) { + map['set'] = Variable(set.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ActionsCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('totalSets: $totalSets, ') + ..write('totalReps: $totalReps, ') + ..write('restBeforeSets: $restBeforeSets, ') + ..write('restBetweenSets: $restBetweenSets, ') + ..write('restBetweenReps: $restBetweenReps, ') + ..write('restAfterSets: $restAfterSets, ') + ..write('repType: $repType, ') + ..write('repLength: $repLength, ') + ..write('repWeights: $repWeights, ') + ..write('setWeights: $setWeights, ') + ..write('isAlternating: $isAlternating, ') + ..write('tempo: $tempo, ') + ..write('status: $status, ') + ..write('state: $state, ') + ..write('set: $set, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class ActivityActions extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + ActivityActions(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn activityId = GeneratedColumn( + 'activity_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES activities (id) ON DELETE CASCADE')); + late final GeneratedColumn actionId = GeneratedColumn( + 'action_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES actions (id) ON DELETE CASCADE')); + late final GeneratedColumn position = GeneratedColumn( + 'position', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, activityId, actionId, position, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'activity_actions'; + @override + Set get $primaryKey => {id}; + @override + ActivityActionsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ActivityActionsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + activityId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}activity_id'])!, + actionId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}action_id'])!, + position: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}position'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + ActivityActions createAlias(String alias) { + return ActivityActions(attachedDatabase, alias); + } +} + +class ActivityActionsData extends DataClass + implements Insertable { + final int id; + final int activityId; + final int actionId; + final int position; + final DateTime createdAt; + const ActivityActionsData( + {required this.id, + required this.activityId, + required this.actionId, + required this.position, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['activity_id'] = Variable(activityId); + map['action_id'] = Variable(actionId); + map['position'] = Variable(position); + map['created_at'] = Variable(createdAt); + return map; + } + + ActivityActionsCompanion toCompanion(bool nullToAbsent) { + return ActivityActionsCompanion( + id: Value(id), + activityId: Value(activityId), + actionId: Value(actionId), + position: Value(position), + createdAt: Value(createdAt), + ); + } + + factory ActivityActionsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ActivityActionsData( + id: serializer.fromJson(json['id']), + activityId: serializer.fromJson(json['activityId']), + actionId: serializer.fromJson(json['actionId']), + position: serializer.fromJson(json['position']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'activityId': serializer.toJson(activityId), + 'actionId': serializer.toJson(actionId), + 'position': serializer.toJson(position), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ActivityActionsData copyWith( + {int? id, + int? activityId, + int? actionId, + int? position, + DateTime? createdAt}) => + ActivityActionsData( + id: id ?? this.id, + activityId: activityId ?? this.activityId, + actionId: actionId ?? this.actionId, + position: position ?? this.position, + createdAt: createdAt ?? this.createdAt, + ); + ActivityActionsData copyWithCompanion(ActivityActionsCompanion data) { + return ActivityActionsData( + id: data.id.present ? data.id.value : this.id, + activityId: + data.activityId.present ? data.activityId.value : this.activityId, + actionId: data.actionId.present ? data.actionId.value : this.actionId, + position: data.position.present ? data.position.value : this.position, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ActivityActionsData(') + ..write('id: $id, ') + ..write('activityId: $activityId, ') + ..write('actionId: $actionId, ') + ..write('position: $position, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(id, activityId, actionId, position, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ActivityActionsData && + other.id == this.id && + other.activityId == this.activityId && + other.actionId == this.actionId && + other.position == this.position && + other.createdAt == this.createdAt); +} + +class ActivityActionsCompanion extends UpdateCompanion { + final Value id; + final Value activityId; + final Value actionId; + final Value position; + final Value createdAt; + const ActivityActionsCompanion({ + this.id = const Value.absent(), + this.activityId = const Value.absent(), + this.actionId = const Value.absent(), + this.position = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ActivityActionsCompanion.insert({ + this.id = const Value.absent(), + required int activityId, + required int actionId, + required int position, + this.createdAt = const Value.absent(), + }) : activityId = Value(activityId), + actionId = Value(actionId), + position = Value(position); + static Insertable custom({ + Expression? id, + Expression? activityId, + Expression? actionId, + Expression? position, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (activityId != null) 'activity_id': activityId, + if (actionId != null) 'action_id': actionId, + if (position != null) 'position': position, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ActivityActionsCompanion copyWith( + {Value? id, + Value? activityId, + Value? actionId, + Value? position, + Value? createdAt}) { + return ActivityActionsCompanion( + id: id ?? this.id, + activityId: activityId ?? this.activityId, + actionId: actionId ?? this.actionId, + position: position ?? this.position, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (activityId.present) { + map['activity_id'] = Variable(activityId.value); + } + if (actionId.present) { + map['action_id'] = Variable(actionId.value); + } + if (position.present) { + map['position'] = Variable(position.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ActivityActionsCompanion(') + ..write('id: $id, ') + ..write('activityId: $activityId, ') + ..write('actionId: $actionId, ') + ..write('position: $position, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class MediaItems extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + MediaItems(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 64), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn description = GeneratedColumn( + 'body', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn reference = GeneratedColumn( + 'reference', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn type = GeneratedColumn( + 'type', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, title, description, reference, type, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'media_items'; + @override + Set get $primaryKey => {id}; + @override + MediaItemsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return MediaItemsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + description: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body'])!, + reference: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}reference'])!, + type: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}type'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + MediaItems createAlias(String alias) { + return MediaItems(attachedDatabase, alias); + } +} + +class MediaItemsData extends DataClass implements Insertable { + final int id; + final String title; + final String description; + final String reference; + final String type; + final DateTime createdAt; + const MediaItemsData( + {required this.id, + required this.title, + required this.description, + required this.reference, + required this.type, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + map['body'] = Variable(description); + map['reference'] = Variable(reference); + map['type'] = Variable(type); + map['created_at'] = Variable(createdAt); + return map; + } + + MediaItemsCompanion toCompanion(bool nullToAbsent) { + return MediaItemsCompanion( + id: Value(id), + title: Value(title), + description: Value(description), + reference: Value(reference), + type: Value(type), + createdAt: Value(createdAt), + ); + } + + factory MediaItemsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return MediaItemsData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + description: serializer.fromJson(json['description']), + reference: serializer.fromJson(json['reference']), + type: serializer.fromJson(json['type']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'description': serializer.toJson(description), + 'reference': serializer.toJson(reference), + 'type': serializer.toJson(type), + 'createdAt': serializer.toJson(createdAt), + }; + } + + MediaItemsData copyWith( + {int? id, + String? title, + String? description, + String? reference, + String? type, + DateTime? createdAt}) => + MediaItemsData( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + reference: reference ?? this.reference, + type: type ?? this.type, + createdAt: createdAt ?? this.createdAt, + ); + MediaItemsData copyWithCompanion(MediaItemsCompanion data) { + return MediaItemsData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + description: + data.description.present ? data.description.value : this.description, + reference: data.reference.present ? data.reference.value : this.reference, + type: data.type.present ? data.type.value : this.type, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('MediaItemsData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('reference: $reference, ') + ..write('type: $type, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(id, title, description, reference, type, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is MediaItemsData && + other.id == this.id && + other.title == this.title && + other.description == this.description && + other.reference == this.reference && + other.type == this.type && + other.createdAt == this.createdAt); +} + +class MediaItemsCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value description; + final Value reference; + final Value type; + final Value createdAt; + const MediaItemsCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.description = const Value.absent(), + this.reference = const Value.absent(), + this.type = const Value.absent(), + this.createdAt = const Value.absent(), + }); + MediaItemsCompanion.insert({ + this.id = const Value.absent(), + required String title, + required String description, + required String reference, + required String type, + this.createdAt = const Value.absent(), + }) : title = Value(title), + description = Value(description), + reference = Value(reference), + type = Value(type); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? description, + Expression? reference, + Expression? type, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (description != null) 'body': description, + if (reference != null) 'reference': reference, + if (type != null) 'type': type, + if (createdAt != null) 'created_at': createdAt, + }); + } + + MediaItemsCompanion copyWith( + {Value? id, + Value? title, + Value? description, + Value? reference, + Value? type, + Value? createdAt}) { + return MediaItemsCompanion( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + reference: reference ?? this.reference, + type: type ?? this.type, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (description.present) { + map['body'] = Variable(description.value); + } + if (reference.present) { + map['reference'] = Variable(reference.value); + } + if (type.present) { + map['type'] = Variable(type.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('MediaItemsCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('reference: $reference, ') + ..write('type: $type, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class ObjectMediaItems extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + ObjectMediaItems(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn objectId = GeneratedColumn( + 'object_id', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn objectType = GeneratedColumn( + 'object_type', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn mediaId = GeneratedColumn( + 'media_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES media_items (id) ON DELETE CASCADE')); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, objectId, objectType, mediaId, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'object_media_items'; + @override + Set get $primaryKey => {id}; + @override + ObjectMediaItemsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ObjectMediaItemsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + objectId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}object_id'])!, + objectType: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}object_type'])!, + mediaId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}media_id'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + ObjectMediaItems createAlias(String alias) { + return ObjectMediaItems(attachedDatabase, alias); + } +} + +class ObjectMediaItemsData extends DataClass + implements Insertable { + final int id; + final int objectId; + final String objectType; + final int mediaId; + final DateTime createdAt; + const ObjectMediaItemsData( + {required this.id, + required this.objectId, + required this.objectType, + required this.mediaId, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['object_id'] = Variable(objectId); + map['object_type'] = Variable(objectType); + map['media_id'] = Variable(mediaId); + map['created_at'] = Variable(createdAt); + return map; + } + + ObjectMediaItemsCompanion toCompanion(bool nullToAbsent) { + return ObjectMediaItemsCompanion( + id: Value(id), + objectId: Value(objectId), + objectType: Value(objectType), + mediaId: Value(mediaId), + createdAt: Value(createdAt), + ); + } + + factory ObjectMediaItemsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ObjectMediaItemsData( + id: serializer.fromJson(json['id']), + objectId: serializer.fromJson(json['objectId']), + objectType: serializer.fromJson(json['objectType']), + mediaId: serializer.fromJson(json['mediaId']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'objectId': serializer.toJson(objectId), + 'objectType': serializer.toJson(objectType), + 'mediaId': serializer.toJson(mediaId), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ObjectMediaItemsData copyWith( + {int? id, + int? objectId, + String? objectType, + int? mediaId, + DateTime? createdAt}) => + ObjectMediaItemsData( + id: id ?? this.id, + objectId: objectId ?? this.objectId, + objectType: objectType ?? this.objectType, + mediaId: mediaId ?? this.mediaId, + createdAt: createdAt ?? this.createdAt, + ); + ObjectMediaItemsData copyWithCompanion(ObjectMediaItemsCompanion data) { + return ObjectMediaItemsData( + id: data.id.present ? data.id.value : this.id, + objectId: data.objectId.present ? data.objectId.value : this.objectId, + objectType: + data.objectType.present ? data.objectType.value : this.objectType, + mediaId: data.mediaId.present ? data.mediaId.value : this.mediaId, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ObjectMediaItemsData(') + ..write('id: $id, ') + ..write('objectId: $objectId, ') + ..write('objectType: $objectType, ') + ..write('mediaId: $mediaId, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(id, objectId, objectType, mediaId, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ObjectMediaItemsData && + other.id == this.id && + other.objectId == this.objectId && + other.objectType == this.objectType && + other.mediaId == this.mediaId && + other.createdAt == this.createdAt); +} + +class ObjectMediaItemsCompanion extends UpdateCompanion { + final Value id; + final Value objectId; + final Value objectType; + final Value mediaId; + final Value createdAt; + const ObjectMediaItemsCompanion({ + this.id = const Value.absent(), + this.objectId = const Value.absent(), + this.objectType = const Value.absent(), + this.mediaId = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ObjectMediaItemsCompanion.insert({ + this.id = const Value.absent(), + required int objectId, + required String objectType, + required int mediaId, + this.createdAt = const Value.absent(), + }) : objectId = Value(objectId), + objectType = Value(objectType), + mediaId = Value(mediaId); + static Insertable custom({ + Expression? id, + Expression? objectId, + Expression? objectType, + Expression? mediaId, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (objectId != null) 'object_id': objectId, + if (objectType != null) 'object_type': objectType, + if (mediaId != null) 'media_id': mediaId, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ObjectMediaItemsCompanion copyWith( + {Value? id, + Value? objectId, + Value? objectType, + Value? mediaId, + Value? createdAt}) { + return ObjectMediaItemsCompanion( + id: id ?? this.id, + objectId: objectId ?? this.objectId, + objectType: objectType ?? this.objectType, + mediaId: mediaId ?? this.mediaId, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (objectId.present) { + map['object_id'] = Variable(objectId.value); + } + if (objectType.present) { + map['object_type'] = Variable(objectType.value); + } + if (mediaId.present) { + map['media_id'] = Variable(mediaId.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ObjectMediaItemsCompanion(') + ..write('id: $id, ') + ..write('objectId: $objectId, ') + ..write('objectType: $objectType, ') + ..write('mediaId: $mediaId, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class DatabaseAtV31 extends GeneratedDatabase { + DatabaseAtV31(QueryExecutor e) : super(e); + late final Sessions sessions = Sessions(this); + late final Activities activities = Activities(this); + late final SessionActivities sessionActivities = SessionActivities(this); + late final Actions actions = Actions(this); + late final ActivityActions activityActions = ActivityActions(this); + late final MediaItems mediaItems = MediaItems(this); + late final ObjectMediaItems objectMediaItems = ObjectMediaItems(this); + @override + Iterable> get allTables => + allSchemaEntities.whereType>(); + @override + List get allSchemaEntities => [ + sessions, + activities, + sessionActivities, + actions, + activityActions, + mediaItems, + objectMediaItems + ]; + @override + int get schemaVersion => 31; +} diff --git a/test/drift/sendtrain/generated/schema_v32.dart b/test/drift/sendtrain/generated/schema_v32.dart new file mode 100644 index 0000000..ca1ff2d --- /dev/null +++ b/test/drift/sendtrain/generated/schema_v32.dart @@ -0,0 +1,2702 @@ +// dart format width=80 +// GENERATED CODE, DO NOT EDIT BY HAND. +// ignore_for_file: type=lint +import 'package:drift/drift.dart'; + +class Sessions extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + Sessions(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 32), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn content = GeneratedColumn( + 'body', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn status = GeneratedColumn( + 'status', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn achievements = GeneratedColumn( + 'achievements', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn address = GeneratedColumn( + 'address', aliasedName, true, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 256), + type: DriftSqlType.string, + requiredDuringInsert: false); + late final GeneratedColumn date = GeneratedColumn( + 'date', aliasedName, true, + type: DriftSqlType.dateTime, requiredDuringInsert: false); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, title, content, status, achievements, address, date, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'sessions'; + @override + Set get $primaryKey => {id}; + @override + SessionsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return SessionsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + content: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body'])!, + status: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}status'])!, + achievements: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}achievements']), + address: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}address']), + date: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}date']), + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + Sessions createAlias(String alias) { + return Sessions(attachedDatabase, alias); + } +} + +class SessionsData extends DataClass implements Insertable { + final int id; + final String title; + final String content; + final String status; + final String? achievements; + final String? address; + final DateTime? date; + final DateTime createdAt; + const SessionsData( + {required this.id, + required this.title, + required this.content, + required this.status, + this.achievements, + this.address, + this.date, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + map['body'] = Variable(content); + map['status'] = Variable(status); + if (!nullToAbsent || achievements != null) { + map['achievements'] = Variable(achievements); + } + if (!nullToAbsent || address != null) { + map['address'] = Variable(address); + } + if (!nullToAbsent || date != null) { + map['date'] = Variable(date); + } + map['created_at'] = Variable(createdAt); + return map; + } + + SessionsCompanion toCompanion(bool nullToAbsent) { + return SessionsCompanion( + id: Value(id), + title: Value(title), + content: Value(content), + status: Value(status), + achievements: achievements == null && nullToAbsent + ? const Value.absent() + : Value(achievements), + address: address == null && nullToAbsent + ? const Value.absent() + : Value(address), + date: date == null && nullToAbsent ? const Value.absent() : Value(date), + createdAt: Value(createdAt), + ); + } + + factory SessionsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return SessionsData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + content: serializer.fromJson(json['content']), + status: serializer.fromJson(json['status']), + achievements: serializer.fromJson(json['achievements']), + address: serializer.fromJson(json['address']), + date: serializer.fromJson(json['date']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'content': serializer.toJson(content), + 'status': serializer.toJson(status), + 'achievements': serializer.toJson(achievements), + 'address': serializer.toJson(address), + 'date': serializer.toJson(date), + 'createdAt': serializer.toJson(createdAt), + }; + } + + SessionsData copyWith( + {int? id, + String? title, + String? content, + String? status, + Value achievements = const Value.absent(), + Value address = const Value.absent(), + Value date = const Value.absent(), + DateTime? createdAt}) => + SessionsData( + id: id ?? this.id, + title: title ?? this.title, + content: content ?? this.content, + status: status ?? this.status, + achievements: + achievements.present ? achievements.value : this.achievements, + address: address.present ? address.value : this.address, + date: date.present ? date.value : this.date, + createdAt: createdAt ?? this.createdAt, + ); + SessionsData copyWithCompanion(SessionsCompanion data) { + return SessionsData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + content: data.content.present ? data.content.value : this.content, + status: data.status.present ? data.status.value : this.status, + achievements: data.achievements.present + ? data.achievements.value + : this.achievements, + address: data.address.present ? data.address.value : this.address, + date: data.date.present ? data.date.value : this.date, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('SessionsData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('content: $content, ') + ..write('status: $status, ') + ..write('achievements: $achievements, ') + ..write('address: $address, ') + ..write('date: $date, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash( + id, title, content, status, achievements, address, date, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is SessionsData && + other.id == this.id && + other.title == this.title && + other.content == this.content && + other.status == this.status && + other.achievements == this.achievements && + other.address == this.address && + other.date == this.date && + other.createdAt == this.createdAt); +} + +class SessionsCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value content; + final Value status; + final Value achievements; + final Value address; + final Value date; + final Value createdAt; + const SessionsCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.content = const Value.absent(), + this.status = const Value.absent(), + this.achievements = const Value.absent(), + this.address = const Value.absent(), + this.date = const Value.absent(), + this.createdAt = const Value.absent(), + }); + SessionsCompanion.insert({ + this.id = const Value.absent(), + required String title, + required String content, + required String status, + this.achievements = const Value.absent(), + this.address = const Value.absent(), + this.date = const Value.absent(), + this.createdAt = const Value.absent(), + }) : title = Value(title), + content = Value(content), + status = Value(status); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? content, + Expression? status, + Expression? achievements, + Expression? address, + Expression? date, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (content != null) 'body': content, + if (status != null) 'status': status, + if (achievements != null) 'achievements': achievements, + if (address != null) 'address': address, + if (date != null) 'date': date, + if (createdAt != null) 'created_at': createdAt, + }); + } + + SessionsCompanion copyWith( + {Value? id, + Value? title, + Value? content, + Value? status, + Value? achievements, + Value? address, + Value? date, + Value? createdAt}) { + return SessionsCompanion( + id: id ?? this.id, + title: title ?? this.title, + content: content ?? this.content, + status: status ?? this.status, + achievements: achievements ?? this.achievements, + address: address ?? this.address, + date: date ?? this.date, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (content.present) { + map['body'] = Variable(content.value); + } + if (status.present) { + map['status'] = Variable(status.value); + } + if (achievements.present) { + map['achievements'] = Variable(achievements.value); + } + if (address.present) { + map['address'] = Variable(address.value); + } + if (date.present) { + map['date'] = Variable(date.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('SessionsCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('content: $content, ') + ..write('status: $status, ') + ..write('achievements: $achievements, ') + ..write('address: $address, ') + ..write('date: $date, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class Activities extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + Activities(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 100), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn type = GeneratedColumn( + 'type', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn description = GeneratedColumn( + 'body', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn category = GeneratedColumn( + 'category', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn force = GeneratedColumn( + 'force', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn level = GeneratedColumn( + 'level', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn mechanic = GeneratedColumn( + 'mechanic', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn equipment = GeneratedColumn( + 'equipment', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn primaryMuscles = GeneratedColumn( + 'primary_muscles', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn secondaryMuscles = GeneratedColumn( + 'secondary_muscles', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => [ + id, + title, + type, + description, + category, + force, + level, + mechanic, + equipment, + primaryMuscles, + secondaryMuscles, + createdAt + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'activities'; + @override + Set get $primaryKey => {id}; + @override + ActivitiesData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ActivitiesData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + type: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}type']), + description: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body']), + category: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}category']), + force: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}force']), + level: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}level']), + mechanic: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}mechanic']), + equipment: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}equipment']), + primaryMuscles: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}primary_muscles']), + secondaryMuscles: attachedDatabase.typeMapping.read( + DriftSqlType.string, data['${effectivePrefix}secondary_muscles']), + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + Activities createAlias(String alias) { + return Activities(attachedDatabase, alias); + } +} + +class ActivitiesData extends DataClass implements Insertable { + final int id; + final String title; + final String? type; + final String? description; + final String? category; + final String? force; + final String? level; + final String? mechanic; + final String? equipment; + final String? primaryMuscles; + final String? secondaryMuscles; + final DateTime createdAt; + const ActivitiesData( + {required this.id, + required this.title, + this.type, + this.description, + this.category, + this.force, + this.level, + this.mechanic, + this.equipment, + this.primaryMuscles, + this.secondaryMuscles, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + if (!nullToAbsent || type != null) { + map['type'] = Variable(type); + } + if (!nullToAbsent || description != null) { + map['body'] = Variable(description); + } + if (!nullToAbsent || category != null) { + map['category'] = Variable(category); + } + if (!nullToAbsent || force != null) { + map['force'] = Variable(force); + } + if (!nullToAbsent || level != null) { + map['level'] = Variable(level); + } + if (!nullToAbsent || mechanic != null) { + map['mechanic'] = Variable(mechanic); + } + if (!nullToAbsent || equipment != null) { + map['equipment'] = Variable(equipment); + } + if (!nullToAbsent || primaryMuscles != null) { + map['primary_muscles'] = Variable(primaryMuscles); + } + if (!nullToAbsent || secondaryMuscles != null) { + map['secondary_muscles'] = Variable(secondaryMuscles); + } + map['created_at'] = Variable(createdAt); + return map; + } + + ActivitiesCompanion toCompanion(bool nullToAbsent) { + return ActivitiesCompanion( + id: Value(id), + title: Value(title), + type: type == null && nullToAbsent ? const Value.absent() : Value(type), + description: description == null && nullToAbsent + ? const Value.absent() + : Value(description), + category: category == null && nullToAbsent + ? const Value.absent() + : Value(category), + force: + force == null && nullToAbsent ? const Value.absent() : Value(force), + level: + level == null && nullToAbsent ? const Value.absent() : Value(level), + mechanic: mechanic == null && nullToAbsent + ? const Value.absent() + : Value(mechanic), + equipment: equipment == null && nullToAbsent + ? const Value.absent() + : Value(equipment), + primaryMuscles: primaryMuscles == null && nullToAbsent + ? const Value.absent() + : Value(primaryMuscles), + secondaryMuscles: secondaryMuscles == null && nullToAbsent + ? const Value.absent() + : Value(secondaryMuscles), + createdAt: Value(createdAt), + ); + } + + factory ActivitiesData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ActivitiesData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + type: serializer.fromJson(json['type']), + description: serializer.fromJson(json['description']), + category: serializer.fromJson(json['category']), + force: serializer.fromJson(json['force']), + level: serializer.fromJson(json['level']), + mechanic: serializer.fromJson(json['mechanic']), + equipment: serializer.fromJson(json['equipment']), + primaryMuscles: serializer.fromJson(json['primaryMuscles']), + secondaryMuscles: serializer.fromJson(json['secondaryMuscles']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'type': serializer.toJson(type), + 'description': serializer.toJson(description), + 'category': serializer.toJson(category), + 'force': serializer.toJson(force), + 'level': serializer.toJson(level), + 'mechanic': serializer.toJson(mechanic), + 'equipment': serializer.toJson(equipment), + 'primaryMuscles': serializer.toJson(primaryMuscles), + 'secondaryMuscles': serializer.toJson(secondaryMuscles), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ActivitiesData copyWith( + {int? id, + String? title, + Value type = const Value.absent(), + Value description = const Value.absent(), + Value category = const Value.absent(), + Value force = const Value.absent(), + Value level = const Value.absent(), + Value mechanic = const Value.absent(), + Value equipment = const Value.absent(), + Value primaryMuscles = const Value.absent(), + Value secondaryMuscles = const Value.absent(), + DateTime? createdAt}) => + ActivitiesData( + id: id ?? this.id, + title: title ?? this.title, + type: type.present ? type.value : this.type, + description: description.present ? description.value : this.description, + category: category.present ? category.value : this.category, + force: force.present ? force.value : this.force, + level: level.present ? level.value : this.level, + mechanic: mechanic.present ? mechanic.value : this.mechanic, + equipment: equipment.present ? equipment.value : this.equipment, + primaryMuscles: + primaryMuscles.present ? primaryMuscles.value : this.primaryMuscles, + secondaryMuscles: secondaryMuscles.present + ? secondaryMuscles.value + : this.secondaryMuscles, + createdAt: createdAt ?? this.createdAt, + ); + ActivitiesData copyWithCompanion(ActivitiesCompanion data) { + return ActivitiesData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + type: data.type.present ? data.type.value : this.type, + description: + data.description.present ? data.description.value : this.description, + category: data.category.present ? data.category.value : this.category, + force: data.force.present ? data.force.value : this.force, + level: data.level.present ? data.level.value : this.level, + mechanic: data.mechanic.present ? data.mechanic.value : this.mechanic, + equipment: data.equipment.present ? data.equipment.value : this.equipment, + primaryMuscles: data.primaryMuscles.present + ? data.primaryMuscles.value + : this.primaryMuscles, + secondaryMuscles: data.secondaryMuscles.present + ? data.secondaryMuscles.value + : this.secondaryMuscles, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ActivitiesData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('type: $type, ') + ..write('description: $description, ') + ..write('category: $category, ') + ..write('force: $force, ') + ..write('level: $level, ') + ..write('mechanic: $mechanic, ') + ..write('equipment: $equipment, ') + ..write('primaryMuscles: $primaryMuscles, ') + ..write('secondaryMuscles: $secondaryMuscles, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(id, title, type, description, category, force, + level, mechanic, equipment, primaryMuscles, secondaryMuscles, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ActivitiesData && + other.id == this.id && + other.title == this.title && + other.type == this.type && + other.description == this.description && + other.category == this.category && + other.force == this.force && + other.level == this.level && + other.mechanic == this.mechanic && + other.equipment == this.equipment && + other.primaryMuscles == this.primaryMuscles && + other.secondaryMuscles == this.secondaryMuscles && + other.createdAt == this.createdAt); +} + +class ActivitiesCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value type; + final Value description; + final Value category; + final Value force; + final Value level; + final Value mechanic; + final Value equipment; + final Value primaryMuscles; + final Value secondaryMuscles; + final Value createdAt; + const ActivitiesCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.type = const Value.absent(), + this.description = const Value.absent(), + this.category = const Value.absent(), + this.force = const Value.absent(), + this.level = const Value.absent(), + this.mechanic = const Value.absent(), + this.equipment = const Value.absent(), + this.primaryMuscles = const Value.absent(), + this.secondaryMuscles = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ActivitiesCompanion.insert({ + this.id = const Value.absent(), + required String title, + this.type = const Value.absent(), + this.description = const Value.absent(), + this.category = const Value.absent(), + this.force = const Value.absent(), + this.level = const Value.absent(), + this.mechanic = const Value.absent(), + this.equipment = const Value.absent(), + this.primaryMuscles = const Value.absent(), + this.secondaryMuscles = const Value.absent(), + this.createdAt = const Value.absent(), + }) : title = Value(title); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? type, + Expression? description, + Expression? category, + Expression? force, + Expression? level, + Expression? mechanic, + Expression? equipment, + Expression? primaryMuscles, + Expression? secondaryMuscles, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (type != null) 'type': type, + if (description != null) 'body': description, + if (category != null) 'category': category, + if (force != null) 'force': force, + if (level != null) 'level': level, + if (mechanic != null) 'mechanic': mechanic, + if (equipment != null) 'equipment': equipment, + if (primaryMuscles != null) 'primary_muscles': primaryMuscles, + if (secondaryMuscles != null) 'secondary_muscles': secondaryMuscles, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ActivitiesCompanion copyWith( + {Value? id, + Value? title, + Value? type, + Value? description, + Value? category, + Value? force, + Value? level, + Value? mechanic, + Value? equipment, + Value? primaryMuscles, + Value? secondaryMuscles, + Value? createdAt}) { + return ActivitiesCompanion( + id: id ?? this.id, + title: title ?? this.title, + type: type ?? this.type, + description: description ?? this.description, + category: category ?? this.category, + force: force ?? this.force, + level: level ?? this.level, + mechanic: mechanic ?? this.mechanic, + equipment: equipment ?? this.equipment, + primaryMuscles: primaryMuscles ?? this.primaryMuscles, + secondaryMuscles: secondaryMuscles ?? this.secondaryMuscles, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (type.present) { + map['type'] = Variable(type.value); + } + if (description.present) { + map['body'] = Variable(description.value); + } + if (category.present) { + map['category'] = Variable(category.value); + } + if (force.present) { + map['force'] = Variable(force.value); + } + if (level.present) { + map['level'] = Variable(level.value); + } + if (mechanic.present) { + map['mechanic'] = Variable(mechanic.value); + } + if (equipment.present) { + map['equipment'] = Variable(equipment.value); + } + if (primaryMuscles.present) { + map['primary_muscles'] = Variable(primaryMuscles.value); + } + if (secondaryMuscles.present) { + map['secondary_muscles'] = Variable(secondaryMuscles.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ActivitiesCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('type: $type, ') + ..write('description: $description, ') + ..write('category: $category, ') + ..write('force: $force, ') + ..write('level: $level, ') + ..write('mechanic: $mechanic, ') + ..write('equipment: $equipment, ') + ..write('primaryMuscles: $primaryMuscles, ') + ..write('secondaryMuscles: $secondaryMuscles, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class SessionActivities extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + SessionActivities(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn sessionId = GeneratedColumn( + 'session_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES sessions (id) ON DELETE CASCADE')); + late final GeneratedColumn activityId = GeneratedColumn( + 'activity_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES activities (id) ON DELETE CASCADE')); + late final GeneratedColumn position = GeneratedColumn( + 'position', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn results = GeneratedColumn( + 'results', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, sessionId, activityId, position, results, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'session_activities'; + @override + Set get $primaryKey => {id}; + @override + SessionActivitiesData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return SessionActivitiesData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + sessionId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}session_id'])!, + activityId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}activity_id'])!, + position: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}position'])!, + results: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}results']), + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + SessionActivities createAlias(String alias) { + return SessionActivities(attachedDatabase, alias); + } +} + +class SessionActivitiesData extends DataClass + implements Insertable { + final int id; + final int sessionId; + final int activityId; + final int position; + final String? results; + final DateTime createdAt; + const SessionActivitiesData( + {required this.id, + required this.sessionId, + required this.activityId, + required this.position, + this.results, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['session_id'] = Variable(sessionId); + map['activity_id'] = Variable(activityId); + map['position'] = Variable(position); + if (!nullToAbsent || results != null) { + map['results'] = Variable(results); + } + map['created_at'] = Variable(createdAt); + return map; + } + + SessionActivitiesCompanion toCompanion(bool nullToAbsent) { + return SessionActivitiesCompanion( + id: Value(id), + sessionId: Value(sessionId), + activityId: Value(activityId), + position: Value(position), + results: results == null && nullToAbsent + ? const Value.absent() + : Value(results), + createdAt: Value(createdAt), + ); + } + + factory SessionActivitiesData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return SessionActivitiesData( + id: serializer.fromJson(json['id']), + sessionId: serializer.fromJson(json['sessionId']), + activityId: serializer.fromJson(json['activityId']), + position: serializer.fromJson(json['position']), + results: serializer.fromJson(json['results']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'sessionId': serializer.toJson(sessionId), + 'activityId': serializer.toJson(activityId), + 'position': serializer.toJson(position), + 'results': serializer.toJson(results), + 'createdAt': serializer.toJson(createdAt), + }; + } + + SessionActivitiesData copyWith( + {int? id, + int? sessionId, + int? activityId, + int? position, + Value results = const Value.absent(), + DateTime? createdAt}) => + SessionActivitiesData( + id: id ?? this.id, + sessionId: sessionId ?? this.sessionId, + activityId: activityId ?? this.activityId, + position: position ?? this.position, + results: results.present ? results.value : this.results, + createdAt: createdAt ?? this.createdAt, + ); + SessionActivitiesData copyWithCompanion(SessionActivitiesCompanion data) { + return SessionActivitiesData( + id: data.id.present ? data.id.value : this.id, + sessionId: data.sessionId.present ? data.sessionId.value : this.sessionId, + activityId: + data.activityId.present ? data.activityId.value : this.activityId, + position: data.position.present ? data.position.value : this.position, + results: data.results.present ? data.results.value : this.results, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('SessionActivitiesData(') + ..write('id: $id, ') + ..write('sessionId: $sessionId, ') + ..write('activityId: $activityId, ') + ..write('position: $position, ') + ..write('results: $results, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(id, sessionId, activityId, position, results, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is SessionActivitiesData && + other.id == this.id && + other.sessionId == this.sessionId && + other.activityId == this.activityId && + other.position == this.position && + other.results == this.results && + other.createdAt == this.createdAt); +} + +class SessionActivitiesCompanion + extends UpdateCompanion { + final Value id; + final Value sessionId; + final Value activityId; + final Value position; + final Value results; + final Value createdAt; + const SessionActivitiesCompanion({ + this.id = const Value.absent(), + this.sessionId = const Value.absent(), + this.activityId = const Value.absent(), + this.position = const Value.absent(), + this.results = const Value.absent(), + this.createdAt = const Value.absent(), + }); + SessionActivitiesCompanion.insert({ + this.id = const Value.absent(), + required int sessionId, + required int activityId, + required int position, + this.results = const Value.absent(), + this.createdAt = const Value.absent(), + }) : sessionId = Value(sessionId), + activityId = Value(activityId), + position = Value(position); + static Insertable custom({ + Expression? id, + Expression? sessionId, + Expression? activityId, + Expression? position, + Expression? results, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (sessionId != null) 'session_id': sessionId, + if (activityId != null) 'activity_id': activityId, + if (position != null) 'position': position, + if (results != null) 'results': results, + if (createdAt != null) 'created_at': createdAt, + }); + } + + SessionActivitiesCompanion copyWith( + {Value? id, + Value? sessionId, + Value? activityId, + Value? position, + Value? results, + Value? createdAt}) { + return SessionActivitiesCompanion( + id: id ?? this.id, + sessionId: sessionId ?? this.sessionId, + activityId: activityId ?? this.activityId, + position: position ?? this.position, + results: results ?? this.results, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (sessionId.present) { + map['session_id'] = Variable(sessionId.value); + } + if (activityId.present) { + map['activity_id'] = Variable(activityId.value); + } + if (position.present) { + map['position'] = Variable(position.value); + } + if (results.present) { + map['results'] = Variable(results.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('SessionActivitiesCompanion(') + ..write('id: $id, ') + ..write('sessionId: $sessionId, ') + ..write('activityId: $activityId, ') + ..write('position: $position, ') + ..write('results: $results, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class Actions extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + Actions(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 64), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn description = GeneratedColumn( + 'body', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn totalSets = GeneratedColumn( + 'total_sets', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn totalReps = GeneratedColumn( + 'total_reps', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 1, maxTextLength: 32), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn restBeforeSets = GeneratedColumn( + 'rest_before_sets', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn restBetweenSets = GeneratedColumn( + 'rest_between_sets', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn restBetweenReps = GeneratedColumn( + 'rest_between_reps', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn restAfterSets = GeneratedColumn( + 'rest_after_sets', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn repType = GeneratedColumn( + 'rep_type', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn repLength = GeneratedColumn( + 'rep_length', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn repWeights = GeneratedColumn( + 'rep_weights', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn setWeights = GeneratedColumn( + 'set_weights', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn isAlternating = GeneratedColumn( + 'is_alternating', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("is_alternating" IN (0, 1))'), + defaultValue: Variable(false)); + late final GeneratedColumn tempo = GeneratedColumn( + 'tempo', aliasedName, true, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 6, maxTextLength: 36), + type: DriftSqlType.string, + requiredDuringInsert: false); + late final GeneratedColumn status = GeneratedColumn( + 'status', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: Variable('pending')); + late final GeneratedColumn state = GeneratedColumn( + 'state', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: Variable( + "{\"currentSet\": 1, \"currentRep\": 1, \"currentTime\": 0, \"currentAction\": 0}")); + late final GeneratedColumn set = GeneratedColumn( + 'set', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => [ + id, + title, + description, + totalSets, + totalReps, + restBeforeSets, + restBetweenSets, + restBetweenReps, + restAfterSets, + repType, + repLength, + repWeights, + setWeights, + isAlternating, + tempo, + status, + state, + set, + createdAt + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'actions'; + @override + Set get $primaryKey => {id}; + @override + ActionsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ActionsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + description: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body'])!, + totalSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}total_sets'])!, + totalReps: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}total_reps'])!, + restBeforeSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_before_sets']), + restBetweenSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_between_sets']), + restBetweenReps: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_between_reps']), + restAfterSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_after_sets']), + repType: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}rep_type'])!, + repLength: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rep_length']), + repWeights: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}rep_weights']), + setWeights: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}set_weights']), + isAlternating: attachedDatabase.typeMapping + .read(DriftSqlType.bool, data['${effectivePrefix}is_alternating'])!, + tempo: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}tempo']), + status: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}status'])!, + state: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}state'])!, + set: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}set'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + Actions createAlias(String alias) { + return Actions(attachedDatabase, alias); + } +} + +class ActionsData extends DataClass implements Insertable { + final int id; + final String title; + final String description; + final int totalSets; + final String totalReps; + final int? restBeforeSets; + final int? restBetweenSets; + final int? restBetweenReps; + final int? restAfterSets; + final String repType; + final int? repLength; + final String? repWeights; + final String? setWeights; + final bool isAlternating; + final String? tempo; + final String status; + final String state; + final String set; + final DateTime createdAt; + const ActionsData( + {required this.id, + required this.title, + required this.description, + required this.totalSets, + required this.totalReps, + this.restBeforeSets, + this.restBetweenSets, + this.restBetweenReps, + this.restAfterSets, + required this.repType, + this.repLength, + this.repWeights, + this.setWeights, + required this.isAlternating, + this.tempo, + required this.status, + required this.state, + required this.set, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + map['body'] = Variable(description); + map['total_sets'] = Variable(totalSets); + map['total_reps'] = Variable(totalReps); + if (!nullToAbsent || restBeforeSets != null) { + map['rest_before_sets'] = Variable(restBeforeSets); + } + if (!nullToAbsent || restBetweenSets != null) { + map['rest_between_sets'] = Variable(restBetweenSets); + } + if (!nullToAbsent || restBetweenReps != null) { + map['rest_between_reps'] = Variable(restBetweenReps); + } + if (!nullToAbsent || restAfterSets != null) { + map['rest_after_sets'] = Variable(restAfterSets); + } + map['rep_type'] = Variable(repType); + if (!nullToAbsent || repLength != null) { + map['rep_length'] = Variable(repLength); + } + if (!nullToAbsent || repWeights != null) { + map['rep_weights'] = Variable(repWeights); + } + if (!nullToAbsent || setWeights != null) { + map['set_weights'] = Variable(setWeights); + } + map['is_alternating'] = Variable(isAlternating); + if (!nullToAbsent || tempo != null) { + map['tempo'] = Variable(tempo); + } + map['status'] = Variable(status); + map['state'] = Variable(state); + map['set'] = Variable(set); + map['created_at'] = Variable(createdAt); + return map; + } + + ActionsCompanion toCompanion(bool nullToAbsent) { + return ActionsCompanion( + id: Value(id), + title: Value(title), + description: Value(description), + totalSets: Value(totalSets), + totalReps: Value(totalReps), + restBeforeSets: restBeforeSets == null && nullToAbsent + ? const Value.absent() + : Value(restBeforeSets), + restBetweenSets: restBetweenSets == null && nullToAbsent + ? const Value.absent() + : Value(restBetweenSets), + restBetweenReps: restBetweenReps == null && nullToAbsent + ? const Value.absent() + : Value(restBetweenReps), + restAfterSets: restAfterSets == null && nullToAbsent + ? const Value.absent() + : Value(restAfterSets), + repType: Value(repType), + repLength: repLength == null && nullToAbsent + ? const Value.absent() + : Value(repLength), + repWeights: repWeights == null && nullToAbsent + ? const Value.absent() + : Value(repWeights), + setWeights: setWeights == null && nullToAbsent + ? const Value.absent() + : Value(setWeights), + isAlternating: Value(isAlternating), + tempo: + tempo == null && nullToAbsent ? const Value.absent() : Value(tempo), + status: Value(status), + state: Value(state), + set: Value(set), + createdAt: Value(createdAt), + ); + } + + factory ActionsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ActionsData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + description: serializer.fromJson(json['description']), + totalSets: serializer.fromJson(json['totalSets']), + totalReps: serializer.fromJson(json['totalReps']), + restBeforeSets: serializer.fromJson(json['restBeforeSets']), + restBetweenSets: serializer.fromJson(json['restBetweenSets']), + restBetweenReps: serializer.fromJson(json['restBetweenReps']), + restAfterSets: serializer.fromJson(json['restAfterSets']), + repType: serializer.fromJson(json['repType']), + repLength: serializer.fromJson(json['repLength']), + repWeights: serializer.fromJson(json['repWeights']), + setWeights: serializer.fromJson(json['setWeights']), + isAlternating: serializer.fromJson(json['isAlternating']), + tempo: serializer.fromJson(json['tempo']), + status: serializer.fromJson(json['status']), + state: serializer.fromJson(json['state']), + set: serializer.fromJson(json['set']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'description': serializer.toJson(description), + 'totalSets': serializer.toJson(totalSets), + 'totalReps': serializer.toJson(totalReps), + 'restBeforeSets': serializer.toJson(restBeforeSets), + 'restBetweenSets': serializer.toJson(restBetweenSets), + 'restBetweenReps': serializer.toJson(restBetweenReps), + 'restAfterSets': serializer.toJson(restAfterSets), + 'repType': serializer.toJson(repType), + 'repLength': serializer.toJson(repLength), + 'repWeights': serializer.toJson(repWeights), + 'setWeights': serializer.toJson(setWeights), + 'isAlternating': serializer.toJson(isAlternating), + 'tempo': serializer.toJson(tempo), + 'status': serializer.toJson(status), + 'state': serializer.toJson(state), + 'set': serializer.toJson(set), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ActionsData copyWith( + {int? id, + String? title, + String? description, + int? totalSets, + String? totalReps, + Value restBeforeSets = const Value.absent(), + Value restBetweenSets = const Value.absent(), + Value restBetweenReps = const Value.absent(), + Value restAfterSets = const Value.absent(), + String? repType, + Value repLength = const Value.absent(), + Value repWeights = const Value.absent(), + Value setWeights = const Value.absent(), + bool? isAlternating, + Value tempo = const Value.absent(), + String? status, + String? state, + String? set, + DateTime? createdAt}) => + ActionsData( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + totalSets: totalSets ?? this.totalSets, + totalReps: totalReps ?? this.totalReps, + restBeforeSets: + restBeforeSets.present ? restBeforeSets.value : this.restBeforeSets, + restBetweenSets: restBetweenSets.present + ? restBetweenSets.value + : this.restBetweenSets, + restBetweenReps: restBetweenReps.present + ? restBetweenReps.value + : this.restBetweenReps, + restAfterSets: + restAfterSets.present ? restAfterSets.value : this.restAfterSets, + repType: repType ?? this.repType, + repLength: repLength.present ? repLength.value : this.repLength, + repWeights: repWeights.present ? repWeights.value : this.repWeights, + setWeights: setWeights.present ? setWeights.value : this.setWeights, + isAlternating: isAlternating ?? this.isAlternating, + tempo: tempo.present ? tempo.value : this.tempo, + status: status ?? this.status, + state: state ?? this.state, + set: set ?? this.set, + createdAt: createdAt ?? this.createdAt, + ); + ActionsData copyWithCompanion(ActionsCompanion data) { + return ActionsData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + description: + data.description.present ? data.description.value : this.description, + totalSets: data.totalSets.present ? data.totalSets.value : this.totalSets, + totalReps: data.totalReps.present ? data.totalReps.value : this.totalReps, + restBeforeSets: data.restBeforeSets.present + ? data.restBeforeSets.value + : this.restBeforeSets, + restBetweenSets: data.restBetweenSets.present + ? data.restBetweenSets.value + : this.restBetweenSets, + restBetweenReps: data.restBetweenReps.present + ? data.restBetweenReps.value + : this.restBetweenReps, + restAfterSets: data.restAfterSets.present + ? data.restAfterSets.value + : this.restAfterSets, + repType: data.repType.present ? data.repType.value : this.repType, + repLength: data.repLength.present ? data.repLength.value : this.repLength, + repWeights: + data.repWeights.present ? data.repWeights.value : this.repWeights, + setWeights: + data.setWeights.present ? data.setWeights.value : this.setWeights, + isAlternating: data.isAlternating.present + ? data.isAlternating.value + : this.isAlternating, + tempo: data.tempo.present ? data.tempo.value : this.tempo, + status: data.status.present ? data.status.value : this.status, + state: data.state.present ? data.state.value : this.state, + set: data.set.present ? data.set.value : this.set, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ActionsData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('totalSets: $totalSets, ') + ..write('totalReps: $totalReps, ') + ..write('restBeforeSets: $restBeforeSets, ') + ..write('restBetweenSets: $restBetweenSets, ') + ..write('restBetweenReps: $restBetweenReps, ') + ..write('restAfterSets: $restAfterSets, ') + ..write('repType: $repType, ') + ..write('repLength: $repLength, ') + ..write('repWeights: $repWeights, ') + ..write('setWeights: $setWeights, ') + ..write('isAlternating: $isAlternating, ') + ..write('tempo: $tempo, ') + ..write('status: $status, ') + ..write('state: $state, ') + ..write('set: $set, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash( + id, + title, + description, + totalSets, + totalReps, + restBeforeSets, + restBetweenSets, + restBetweenReps, + restAfterSets, + repType, + repLength, + repWeights, + setWeights, + isAlternating, + tempo, + status, + state, + set, + createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ActionsData && + other.id == this.id && + other.title == this.title && + other.description == this.description && + other.totalSets == this.totalSets && + other.totalReps == this.totalReps && + other.restBeforeSets == this.restBeforeSets && + other.restBetweenSets == this.restBetweenSets && + other.restBetweenReps == this.restBetweenReps && + other.restAfterSets == this.restAfterSets && + other.repType == this.repType && + other.repLength == this.repLength && + other.repWeights == this.repWeights && + other.setWeights == this.setWeights && + other.isAlternating == this.isAlternating && + other.tempo == this.tempo && + other.status == this.status && + other.state == this.state && + other.set == this.set && + other.createdAt == this.createdAt); +} + +class ActionsCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value description; + final Value totalSets; + final Value totalReps; + final Value restBeforeSets; + final Value restBetweenSets; + final Value restBetweenReps; + final Value restAfterSets; + final Value repType; + final Value repLength; + final Value repWeights; + final Value setWeights; + final Value isAlternating; + final Value tempo; + final Value status; + final Value state; + final Value set; + final Value createdAt; + const ActionsCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.description = const Value.absent(), + this.totalSets = const Value.absent(), + this.totalReps = const Value.absent(), + this.restBeforeSets = const Value.absent(), + this.restBetweenSets = const Value.absent(), + this.restBetweenReps = const Value.absent(), + this.restAfterSets = const Value.absent(), + this.repType = const Value.absent(), + this.repLength = const Value.absent(), + this.repWeights = const Value.absent(), + this.setWeights = const Value.absent(), + this.isAlternating = const Value.absent(), + this.tempo = const Value.absent(), + this.status = const Value.absent(), + this.state = const Value.absent(), + this.set = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ActionsCompanion.insert({ + this.id = const Value.absent(), + required String title, + required String description, + required int totalSets, + required String totalReps, + this.restBeforeSets = const Value.absent(), + this.restBetweenSets = const Value.absent(), + this.restBetweenReps = const Value.absent(), + this.restAfterSets = const Value.absent(), + required String repType, + this.repLength = const Value.absent(), + this.repWeights = const Value.absent(), + this.setWeights = const Value.absent(), + this.isAlternating = const Value.absent(), + this.tempo = const Value.absent(), + this.status = const Value.absent(), + this.state = const Value.absent(), + required String set, + this.createdAt = const Value.absent(), + }) : title = Value(title), + description = Value(description), + totalSets = Value(totalSets), + totalReps = Value(totalReps), + repType = Value(repType), + set = Value(set); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? description, + Expression? totalSets, + Expression? totalReps, + Expression? restBeforeSets, + Expression? restBetweenSets, + Expression? restBetweenReps, + Expression? restAfterSets, + Expression? repType, + Expression? repLength, + Expression? repWeights, + Expression? setWeights, + Expression? isAlternating, + Expression? tempo, + Expression? status, + Expression? state, + Expression? set, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (description != null) 'body': description, + if (totalSets != null) 'total_sets': totalSets, + if (totalReps != null) 'total_reps': totalReps, + if (restBeforeSets != null) 'rest_before_sets': restBeforeSets, + if (restBetweenSets != null) 'rest_between_sets': restBetweenSets, + if (restBetweenReps != null) 'rest_between_reps': restBetweenReps, + if (restAfterSets != null) 'rest_after_sets': restAfterSets, + if (repType != null) 'rep_type': repType, + if (repLength != null) 'rep_length': repLength, + if (repWeights != null) 'rep_weights': repWeights, + if (setWeights != null) 'set_weights': setWeights, + if (isAlternating != null) 'is_alternating': isAlternating, + if (tempo != null) 'tempo': tempo, + if (status != null) 'status': status, + if (state != null) 'state': state, + if (set != null) 'set': set, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ActionsCompanion copyWith( + {Value? id, + Value? title, + Value? description, + Value? totalSets, + Value? totalReps, + Value? restBeforeSets, + Value? restBetweenSets, + Value? restBetweenReps, + Value? restAfterSets, + Value? repType, + Value? repLength, + Value? repWeights, + Value? setWeights, + Value? isAlternating, + Value? tempo, + Value? status, + Value? state, + Value? set, + Value? createdAt}) { + return ActionsCompanion( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + totalSets: totalSets ?? this.totalSets, + totalReps: totalReps ?? this.totalReps, + restBeforeSets: restBeforeSets ?? this.restBeforeSets, + restBetweenSets: restBetweenSets ?? this.restBetweenSets, + restBetweenReps: restBetweenReps ?? this.restBetweenReps, + restAfterSets: restAfterSets ?? this.restAfterSets, + repType: repType ?? this.repType, + repLength: repLength ?? this.repLength, + repWeights: repWeights ?? this.repWeights, + setWeights: setWeights ?? this.setWeights, + isAlternating: isAlternating ?? this.isAlternating, + tempo: tempo ?? this.tempo, + status: status ?? this.status, + state: state ?? this.state, + set: set ?? this.set, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (description.present) { + map['body'] = Variable(description.value); + } + if (totalSets.present) { + map['total_sets'] = Variable(totalSets.value); + } + if (totalReps.present) { + map['total_reps'] = Variable(totalReps.value); + } + if (restBeforeSets.present) { + map['rest_before_sets'] = Variable(restBeforeSets.value); + } + if (restBetweenSets.present) { + map['rest_between_sets'] = Variable(restBetweenSets.value); + } + if (restBetweenReps.present) { + map['rest_between_reps'] = Variable(restBetweenReps.value); + } + if (restAfterSets.present) { + map['rest_after_sets'] = Variable(restAfterSets.value); + } + if (repType.present) { + map['rep_type'] = Variable(repType.value); + } + if (repLength.present) { + map['rep_length'] = Variable(repLength.value); + } + if (repWeights.present) { + map['rep_weights'] = Variable(repWeights.value); + } + if (setWeights.present) { + map['set_weights'] = Variable(setWeights.value); + } + if (isAlternating.present) { + map['is_alternating'] = Variable(isAlternating.value); + } + if (tempo.present) { + map['tempo'] = Variable(tempo.value); + } + if (status.present) { + map['status'] = Variable(status.value); + } + if (state.present) { + map['state'] = Variable(state.value); + } + if (set.present) { + map['set'] = Variable(set.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ActionsCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('totalSets: $totalSets, ') + ..write('totalReps: $totalReps, ') + ..write('restBeforeSets: $restBeforeSets, ') + ..write('restBetweenSets: $restBetweenSets, ') + ..write('restBetweenReps: $restBetweenReps, ') + ..write('restAfterSets: $restAfterSets, ') + ..write('repType: $repType, ') + ..write('repLength: $repLength, ') + ..write('repWeights: $repWeights, ') + ..write('setWeights: $setWeights, ') + ..write('isAlternating: $isAlternating, ') + ..write('tempo: $tempo, ') + ..write('status: $status, ') + ..write('state: $state, ') + ..write('set: $set, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class ActivityActions extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + ActivityActions(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn activityId = GeneratedColumn( + 'activity_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES activities (id) ON DELETE CASCADE')); + late final GeneratedColumn actionId = GeneratedColumn( + 'action_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES actions (id) ON DELETE CASCADE')); + late final GeneratedColumn position = GeneratedColumn( + 'position', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, activityId, actionId, position, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'activity_actions'; + @override + Set get $primaryKey => {id}; + @override + ActivityActionsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ActivityActionsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + activityId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}activity_id'])!, + actionId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}action_id'])!, + position: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}position'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + ActivityActions createAlias(String alias) { + return ActivityActions(attachedDatabase, alias); + } +} + +class ActivityActionsData extends DataClass + implements Insertable { + final int id; + final int activityId; + final int actionId; + final int position; + final DateTime createdAt; + const ActivityActionsData( + {required this.id, + required this.activityId, + required this.actionId, + required this.position, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['activity_id'] = Variable(activityId); + map['action_id'] = Variable(actionId); + map['position'] = Variable(position); + map['created_at'] = Variable(createdAt); + return map; + } + + ActivityActionsCompanion toCompanion(bool nullToAbsent) { + return ActivityActionsCompanion( + id: Value(id), + activityId: Value(activityId), + actionId: Value(actionId), + position: Value(position), + createdAt: Value(createdAt), + ); + } + + factory ActivityActionsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ActivityActionsData( + id: serializer.fromJson(json['id']), + activityId: serializer.fromJson(json['activityId']), + actionId: serializer.fromJson(json['actionId']), + position: serializer.fromJson(json['position']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'activityId': serializer.toJson(activityId), + 'actionId': serializer.toJson(actionId), + 'position': serializer.toJson(position), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ActivityActionsData copyWith( + {int? id, + int? activityId, + int? actionId, + int? position, + DateTime? createdAt}) => + ActivityActionsData( + id: id ?? this.id, + activityId: activityId ?? this.activityId, + actionId: actionId ?? this.actionId, + position: position ?? this.position, + createdAt: createdAt ?? this.createdAt, + ); + ActivityActionsData copyWithCompanion(ActivityActionsCompanion data) { + return ActivityActionsData( + id: data.id.present ? data.id.value : this.id, + activityId: + data.activityId.present ? data.activityId.value : this.activityId, + actionId: data.actionId.present ? data.actionId.value : this.actionId, + position: data.position.present ? data.position.value : this.position, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ActivityActionsData(') + ..write('id: $id, ') + ..write('activityId: $activityId, ') + ..write('actionId: $actionId, ') + ..write('position: $position, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(id, activityId, actionId, position, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ActivityActionsData && + other.id == this.id && + other.activityId == this.activityId && + other.actionId == this.actionId && + other.position == this.position && + other.createdAt == this.createdAt); +} + +class ActivityActionsCompanion extends UpdateCompanion { + final Value id; + final Value activityId; + final Value actionId; + final Value position; + final Value createdAt; + const ActivityActionsCompanion({ + this.id = const Value.absent(), + this.activityId = const Value.absent(), + this.actionId = const Value.absent(), + this.position = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ActivityActionsCompanion.insert({ + this.id = const Value.absent(), + required int activityId, + required int actionId, + required int position, + this.createdAt = const Value.absent(), + }) : activityId = Value(activityId), + actionId = Value(actionId), + position = Value(position); + static Insertable custom({ + Expression? id, + Expression? activityId, + Expression? actionId, + Expression? position, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (activityId != null) 'activity_id': activityId, + if (actionId != null) 'action_id': actionId, + if (position != null) 'position': position, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ActivityActionsCompanion copyWith( + {Value? id, + Value? activityId, + Value? actionId, + Value? position, + Value? createdAt}) { + return ActivityActionsCompanion( + id: id ?? this.id, + activityId: activityId ?? this.activityId, + actionId: actionId ?? this.actionId, + position: position ?? this.position, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (activityId.present) { + map['activity_id'] = Variable(activityId.value); + } + if (actionId.present) { + map['action_id'] = Variable(actionId.value); + } + if (position.present) { + map['position'] = Variable(position.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ActivityActionsCompanion(') + ..write('id: $id, ') + ..write('activityId: $activityId, ') + ..write('actionId: $actionId, ') + ..write('position: $position, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class MediaItems extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + MediaItems(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 64), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn description = GeneratedColumn( + 'body', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn reference = GeneratedColumn( + 'reference', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn type = GeneratedColumn( + 'type', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, title, description, reference, type, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'media_items'; + @override + Set get $primaryKey => {id}; + @override + MediaItemsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return MediaItemsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + description: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body'])!, + reference: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}reference'])!, + type: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}type'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + MediaItems createAlias(String alias) { + return MediaItems(attachedDatabase, alias); + } +} + +class MediaItemsData extends DataClass implements Insertable { + final int id; + final String title; + final String description; + final String reference; + final String type; + final DateTime createdAt; + const MediaItemsData( + {required this.id, + required this.title, + required this.description, + required this.reference, + required this.type, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + map['body'] = Variable(description); + map['reference'] = Variable(reference); + map['type'] = Variable(type); + map['created_at'] = Variable(createdAt); + return map; + } + + MediaItemsCompanion toCompanion(bool nullToAbsent) { + return MediaItemsCompanion( + id: Value(id), + title: Value(title), + description: Value(description), + reference: Value(reference), + type: Value(type), + createdAt: Value(createdAt), + ); + } + + factory MediaItemsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return MediaItemsData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + description: serializer.fromJson(json['description']), + reference: serializer.fromJson(json['reference']), + type: serializer.fromJson(json['type']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'description': serializer.toJson(description), + 'reference': serializer.toJson(reference), + 'type': serializer.toJson(type), + 'createdAt': serializer.toJson(createdAt), + }; + } + + MediaItemsData copyWith( + {int? id, + String? title, + String? description, + String? reference, + String? type, + DateTime? createdAt}) => + MediaItemsData( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + reference: reference ?? this.reference, + type: type ?? this.type, + createdAt: createdAt ?? this.createdAt, + ); + MediaItemsData copyWithCompanion(MediaItemsCompanion data) { + return MediaItemsData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + description: + data.description.present ? data.description.value : this.description, + reference: data.reference.present ? data.reference.value : this.reference, + type: data.type.present ? data.type.value : this.type, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('MediaItemsData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('reference: $reference, ') + ..write('type: $type, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(id, title, description, reference, type, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is MediaItemsData && + other.id == this.id && + other.title == this.title && + other.description == this.description && + other.reference == this.reference && + other.type == this.type && + other.createdAt == this.createdAt); +} + +class MediaItemsCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value description; + final Value reference; + final Value type; + final Value createdAt; + const MediaItemsCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.description = const Value.absent(), + this.reference = const Value.absent(), + this.type = const Value.absent(), + this.createdAt = const Value.absent(), + }); + MediaItemsCompanion.insert({ + this.id = const Value.absent(), + required String title, + required String description, + required String reference, + required String type, + this.createdAt = const Value.absent(), + }) : title = Value(title), + description = Value(description), + reference = Value(reference), + type = Value(type); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? description, + Expression? reference, + Expression? type, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (description != null) 'body': description, + if (reference != null) 'reference': reference, + if (type != null) 'type': type, + if (createdAt != null) 'created_at': createdAt, + }); + } + + MediaItemsCompanion copyWith( + {Value? id, + Value? title, + Value? description, + Value? reference, + Value? type, + Value? createdAt}) { + return MediaItemsCompanion( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + reference: reference ?? this.reference, + type: type ?? this.type, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (description.present) { + map['body'] = Variable(description.value); + } + if (reference.present) { + map['reference'] = Variable(reference.value); + } + if (type.present) { + map['type'] = Variable(type.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('MediaItemsCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('reference: $reference, ') + ..write('type: $type, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class ObjectMediaItems extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + ObjectMediaItems(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn objectId = GeneratedColumn( + 'object_id', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn objectType = GeneratedColumn( + 'object_type', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn mediaId = GeneratedColumn( + 'media_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES media_items (id) ON DELETE CASCADE')); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, objectId, objectType, mediaId, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'object_media_items'; + @override + Set get $primaryKey => {id}; + @override + ObjectMediaItemsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ObjectMediaItemsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + objectId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}object_id'])!, + objectType: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}object_type'])!, + mediaId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}media_id'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + ObjectMediaItems createAlias(String alias) { + return ObjectMediaItems(attachedDatabase, alias); + } +} + +class ObjectMediaItemsData extends DataClass + implements Insertable { + final int id; + final int objectId; + final String objectType; + final int mediaId; + final DateTime createdAt; + const ObjectMediaItemsData( + {required this.id, + required this.objectId, + required this.objectType, + required this.mediaId, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['object_id'] = Variable(objectId); + map['object_type'] = Variable(objectType); + map['media_id'] = Variable(mediaId); + map['created_at'] = Variable(createdAt); + return map; + } + + ObjectMediaItemsCompanion toCompanion(bool nullToAbsent) { + return ObjectMediaItemsCompanion( + id: Value(id), + objectId: Value(objectId), + objectType: Value(objectType), + mediaId: Value(mediaId), + createdAt: Value(createdAt), + ); + } + + factory ObjectMediaItemsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ObjectMediaItemsData( + id: serializer.fromJson(json['id']), + objectId: serializer.fromJson(json['objectId']), + objectType: serializer.fromJson(json['objectType']), + mediaId: serializer.fromJson(json['mediaId']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'objectId': serializer.toJson(objectId), + 'objectType': serializer.toJson(objectType), + 'mediaId': serializer.toJson(mediaId), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ObjectMediaItemsData copyWith( + {int? id, + int? objectId, + String? objectType, + int? mediaId, + DateTime? createdAt}) => + ObjectMediaItemsData( + id: id ?? this.id, + objectId: objectId ?? this.objectId, + objectType: objectType ?? this.objectType, + mediaId: mediaId ?? this.mediaId, + createdAt: createdAt ?? this.createdAt, + ); + ObjectMediaItemsData copyWithCompanion(ObjectMediaItemsCompanion data) { + return ObjectMediaItemsData( + id: data.id.present ? data.id.value : this.id, + objectId: data.objectId.present ? data.objectId.value : this.objectId, + objectType: + data.objectType.present ? data.objectType.value : this.objectType, + mediaId: data.mediaId.present ? data.mediaId.value : this.mediaId, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ObjectMediaItemsData(') + ..write('id: $id, ') + ..write('objectId: $objectId, ') + ..write('objectType: $objectType, ') + ..write('mediaId: $mediaId, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(id, objectId, objectType, mediaId, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ObjectMediaItemsData && + other.id == this.id && + other.objectId == this.objectId && + other.objectType == this.objectType && + other.mediaId == this.mediaId && + other.createdAt == this.createdAt); +} + +class ObjectMediaItemsCompanion extends UpdateCompanion { + final Value id; + final Value objectId; + final Value objectType; + final Value mediaId; + final Value createdAt; + const ObjectMediaItemsCompanion({ + this.id = const Value.absent(), + this.objectId = const Value.absent(), + this.objectType = const Value.absent(), + this.mediaId = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ObjectMediaItemsCompanion.insert({ + this.id = const Value.absent(), + required int objectId, + required String objectType, + required int mediaId, + this.createdAt = const Value.absent(), + }) : objectId = Value(objectId), + objectType = Value(objectType), + mediaId = Value(mediaId); + static Insertable custom({ + Expression? id, + Expression? objectId, + Expression? objectType, + Expression? mediaId, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (objectId != null) 'object_id': objectId, + if (objectType != null) 'object_type': objectType, + if (mediaId != null) 'media_id': mediaId, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ObjectMediaItemsCompanion copyWith( + {Value? id, + Value? objectId, + Value? objectType, + Value? mediaId, + Value? createdAt}) { + return ObjectMediaItemsCompanion( + id: id ?? this.id, + objectId: objectId ?? this.objectId, + objectType: objectType ?? this.objectType, + mediaId: mediaId ?? this.mediaId, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (objectId.present) { + map['object_id'] = Variable(objectId.value); + } + if (objectType.present) { + map['object_type'] = Variable(objectType.value); + } + if (mediaId.present) { + map['media_id'] = Variable(mediaId.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ObjectMediaItemsCompanion(') + ..write('id: $id, ') + ..write('objectId: $objectId, ') + ..write('objectType: $objectType, ') + ..write('mediaId: $mediaId, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class DatabaseAtV32 extends GeneratedDatabase { + DatabaseAtV32(QueryExecutor e) : super(e); + late final Sessions sessions = Sessions(this); + late final Activities activities = Activities(this); + late final SessionActivities sessionActivities = SessionActivities(this); + late final Actions actions = Actions(this); + late final ActivityActions activityActions = ActivityActions(this); + late final MediaItems mediaItems = MediaItems(this); + late final ObjectMediaItems objectMediaItems = ObjectMediaItems(this); + @override + Iterable> get allTables => + allSchemaEntities.whereType>(); + @override + List get allSchemaEntities => [ + sessions, + activities, + sessionActivities, + actions, + activityActions, + mediaItems, + objectMediaItems + ]; + @override + int get schemaVersion => 32; +} diff --git a/test/drift/sendtrain/generated/schema_v33.dart b/test/drift/sendtrain/generated/schema_v33.dart new file mode 100644 index 0000000..288c4e6 --- /dev/null +++ b/test/drift/sendtrain/generated/schema_v33.dart @@ -0,0 +1,2702 @@ +// dart format width=80 +// GENERATED CODE, DO NOT EDIT BY HAND. +// ignore_for_file: type=lint +import 'package:drift/drift.dart'; + +class Sessions extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + Sessions(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 32), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn content = GeneratedColumn( + 'body', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn status = GeneratedColumn( + 'status', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn achievements = GeneratedColumn( + 'achievements', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn address = GeneratedColumn( + 'address', aliasedName, true, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 256), + type: DriftSqlType.string, + requiredDuringInsert: false); + late final GeneratedColumn date = GeneratedColumn( + 'date', aliasedName, true, + type: DriftSqlType.dateTime, requiredDuringInsert: false); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, title, content, status, achievements, address, date, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'sessions'; + @override + Set get $primaryKey => {id}; + @override + SessionsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return SessionsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + content: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body'])!, + status: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}status'])!, + achievements: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}achievements']), + address: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}address']), + date: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}date']), + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + Sessions createAlias(String alias) { + return Sessions(attachedDatabase, alias); + } +} + +class SessionsData extends DataClass implements Insertable { + final int id; + final String title; + final String content; + final String status; + final String? achievements; + final String? address; + final DateTime? date; + final DateTime createdAt; + const SessionsData( + {required this.id, + required this.title, + required this.content, + required this.status, + this.achievements, + this.address, + this.date, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + map['body'] = Variable(content); + map['status'] = Variable(status); + if (!nullToAbsent || achievements != null) { + map['achievements'] = Variable(achievements); + } + if (!nullToAbsent || address != null) { + map['address'] = Variable(address); + } + if (!nullToAbsent || date != null) { + map['date'] = Variable(date); + } + map['created_at'] = Variable(createdAt); + return map; + } + + SessionsCompanion toCompanion(bool nullToAbsent) { + return SessionsCompanion( + id: Value(id), + title: Value(title), + content: Value(content), + status: Value(status), + achievements: achievements == null && nullToAbsent + ? const Value.absent() + : Value(achievements), + address: address == null && nullToAbsent + ? const Value.absent() + : Value(address), + date: date == null && nullToAbsent ? const Value.absent() : Value(date), + createdAt: Value(createdAt), + ); + } + + factory SessionsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return SessionsData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + content: serializer.fromJson(json['content']), + status: serializer.fromJson(json['status']), + achievements: serializer.fromJson(json['achievements']), + address: serializer.fromJson(json['address']), + date: serializer.fromJson(json['date']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'content': serializer.toJson(content), + 'status': serializer.toJson(status), + 'achievements': serializer.toJson(achievements), + 'address': serializer.toJson(address), + 'date': serializer.toJson(date), + 'createdAt': serializer.toJson(createdAt), + }; + } + + SessionsData copyWith( + {int? id, + String? title, + String? content, + String? status, + Value achievements = const Value.absent(), + Value address = const Value.absent(), + Value date = const Value.absent(), + DateTime? createdAt}) => + SessionsData( + id: id ?? this.id, + title: title ?? this.title, + content: content ?? this.content, + status: status ?? this.status, + achievements: + achievements.present ? achievements.value : this.achievements, + address: address.present ? address.value : this.address, + date: date.present ? date.value : this.date, + createdAt: createdAt ?? this.createdAt, + ); + SessionsData copyWithCompanion(SessionsCompanion data) { + return SessionsData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + content: data.content.present ? data.content.value : this.content, + status: data.status.present ? data.status.value : this.status, + achievements: data.achievements.present + ? data.achievements.value + : this.achievements, + address: data.address.present ? data.address.value : this.address, + date: data.date.present ? data.date.value : this.date, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('SessionsData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('content: $content, ') + ..write('status: $status, ') + ..write('achievements: $achievements, ') + ..write('address: $address, ') + ..write('date: $date, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash( + id, title, content, status, achievements, address, date, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is SessionsData && + other.id == this.id && + other.title == this.title && + other.content == this.content && + other.status == this.status && + other.achievements == this.achievements && + other.address == this.address && + other.date == this.date && + other.createdAt == this.createdAt); +} + +class SessionsCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value content; + final Value status; + final Value achievements; + final Value address; + final Value date; + final Value createdAt; + const SessionsCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.content = const Value.absent(), + this.status = const Value.absent(), + this.achievements = const Value.absent(), + this.address = const Value.absent(), + this.date = const Value.absent(), + this.createdAt = const Value.absent(), + }); + SessionsCompanion.insert({ + this.id = const Value.absent(), + required String title, + required String content, + required String status, + this.achievements = const Value.absent(), + this.address = const Value.absent(), + this.date = const Value.absent(), + this.createdAt = const Value.absent(), + }) : title = Value(title), + content = Value(content), + status = Value(status); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? content, + Expression? status, + Expression? achievements, + Expression? address, + Expression? date, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (content != null) 'body': content, + if (status != null) 'status': status, + if (achievements != null) 'achievements': achievements, + if (address != null) 'address': address, + if (date != null) 'date': date, + if (createdAt != null) 'created_at': createdAt, + }); + } + + SessionsCompanion copyWith( + {Value? id, + Value? title, + Value? content, + Value? status, + Value? achievements, + Value? address, + Value? date, + Value? createdAt}) { + return SessionsCompanion( + id: id ?? this.id, + title: title ?? this.title, + content: content ?? this.content, + status: status ?? this.status, + achievements: achievements ?? this.achievements, + address: address ?? this.address, + date: date ?? this.date, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (content.present) { + map['body'] = Variable(content.value); + } + if (status.present) { + map['status'] = Variable(status.value); + } + if (achievements.present) { + map['achievements'] = Variable(achievements.value); + } + if (address.present) { + map['address'] = Variable(address.value); + } + if (date.present) { + map['date'] = Variable(date.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('SessionsCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('content: $content, ') + ..write('status: $status, ') + ..write('achievements: $achievements, ') + ..write('address: $address, ') + ..write('date: $date, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class Activities extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + Activities(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 100), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn type = GeneratedColumn( + 'type', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn description = GeneratedColumn( + 'body', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn category = GeneratedColumn( + 'category', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn force = GeneratedColumn( + 'force', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn level = GeneratedColumn( + 'level', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn mechanic = GeneratedColumn( + 'mechanic', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn equipment = GeneratedColumn( + 'equipment', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn primaryMuscles = GeneratedColumn( + 'primary_muscles', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn secondaryMuscles = GeneratedColumn( + 'secondary_muscles', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => [ + id, + title, + type, + description, + category, + force, + level, + mechanic, + equipment, + primaryMuscles, + secondaryMuscles, + createdAt + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'activities'; + @override + Set get $primaryKey => {id}; + @override + ActivitiesData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ActivitiesData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + type: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}type']), + description: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body']), + category: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}category']), + force: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}force']), + level: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}level']), + mechanic: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}mechanic']), + equipment: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}equipment']), + primaryMuscles: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}primary_muscles']), + secondaryMuscles: attachedDatabase.typeMapping.read( + DriftSqlType.string, data['${effectivePrefix}secondary_muscles']), + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + Activities createAlias(String alias) { + return Activities(attachedDatabase, alias); + } +} + +class ActivitiesData extends DataClass implements Insertable { + final int id; + final String title; + final String? type; + final String? description; + final String? category; + final String? force; + final String? level; + final String? mechanic; + final String? equipment; + final String? primaryMuscles; + final String? secondaryMuscles; + final DateTime createdAt; + const ActivitiesData( + {required this.id, + required this.title, + this.type, + this.description, + this.category, + this.force, + this.level, + this.mechanic, + this.equipment, + this.primaryMuscles, + this.secondaryMuscles, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + if (!nullToAbsent || type != null) { + map['type'] = Variable(type); + } + if (!nullToAbsent || description != null) { + map['body'] = Variable(description); + } + if (!nullToAbsent || category != null) { + map['category'] = Variable(category); + } + if (!nullToAbsent || force != null) { + map['force'] = Variable(force); + } + if (!nullToAbsent || level != null) { + map['level'] = Variable(level); + } + if (!nullToAbsent || mechanic != null) { + map['mechanic'] = Variable(mechanic); + } + if (!nullToAbsent || equipment != null) { + map['equipment'] = Variable(equipment); + } + if (!nullToAbsent || primaryMuscles != null) { + map['primary_muscles'] = Variable(primaryMuscles); + } + if (!nullToAbsent || secondaryMuscles != null) { + map['secondary_muscles'] = Variable(secondaryMuscles); + } + map['created_at'] = Variable(createdAt); + return map; + } + + ActivitiesCompanion toCompanion(bool nullToAbsent) { + return ActivitiesCompanion( + id: Value(id), + title: Value(title), + type: type == null && nullToAbsent ? const Value.absent() : Value(type), + description: description == null && nullToAbsent + ? const Value.absent() + : Value(description), + category: category == null && nullToAbsent + ? const Value.absent() + : Value(category), + force: + force == null && nullToAbsent ? const Value.absent() : Value(force), + level: + level == null && nullToAbsent ? const Value.absent() : Value(level), + mechanic: mechanic == null && nullToAbsent + ? const Value.absent() + : Value(mechanic), + equipment: equipment == null && nullToAbsent + ? const Value.absent() + : Value(equipment), + primaryMuscles: primaryMuscles == null && nullToAbsent + ? const Value.absent() + : Value(primaryMuscles), + secondaryMuscles: secondaryMuscles == null && nullToAbsent + ? const Value.absent() + : Value(secondaryMuscles), + createdAt: Value(createdAt), + ); + } + + factory ActivitiesData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ActivitiesData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + type: serializer.fromJson(json['type']), + description: serializer.fromJson(json['description']), + category: serializer.fromJson(json['category']), + force: serializer.fromJson(json['force']), + level: serializer.fromJson(json['level']), + mechanic: serializer.fromJson(json['mechanic']), + equipment: serializer.fromJson(json['equipment']), + primaryMuscles: serializer.fromJson(json['primaryMuscles']), + secondaryMuscles: serializer.fromJson(json['secondaryMuscles']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'type': serializer.toJson(type), + 'description': serializer.toJson(description), + 'category': serializer.toJson(category), + 'force': serializer.toJson(force), + 'level': serializer.toJson(level), + 'mechanic': serializer.toJson(mechanic), + 'equipment': serializer.toJson(equipment), + 'primaryMuscles': serializer.toJson(primaryMuscles), + 'secondaryMuscles': serializer.toJson(secondaryMuscles), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ActivitiesData copyWith( + {int? id, + String? title, + Value type = const Value.absent(), + Value description = const Value.absent(), + Value category = const Value.absent(), + Value force = const Value.absent(), + Value level = const Value.absent(), + Value mechanic = const Value.absent(), + Value equipment = const Value.absent(), + Value primaryMuscles = const Value.absent(), + Value secondaryMuscles = const Value.absent(), + DateTime? createdAt}) => + ActivitiesData( + id: id ?? this.id, + title: title ?? this.title, + type: type.present ? type.value : this.type, + description: description.present ? description.value : this.description, + category: category.present ? category.value : this.category, + force: force.present ? force.value : this.force, + level: level.present ? level.value : this.level, + mechanic: mechanic.present ? mechanic.value : this.mechanic, + equipment: equipment.present ? equipment.value : this.equipment, + primaryMuscles: + primaryMuscles.present ? primaryMuscles.value : this.primaryMuscles, + secondaryMuscles: secondaryMuscles.present + ? secondaryMuscles.value + : this.secondaryMuscles, + createdAt: createdAt ?? this.createdAt, + ); + ActivitiesData copyWithCompanion(ActivitiesCompanion data) { + return ActivitiesData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + type: data.type.present ? data.type.value : this.type, + description: + data.description.present ? data.description.value : this.description, + category: data.category.present ? data.category.value : this.category, + force: data.force.present ? data.force.value : this.force, + level: data.level.present ? data.level.value : this.level, + mechanic: data.mechanic.present ? data.mechanic.value : this.mechanic, + equipment: data.equipment.present ? data.equipment.value : this.equipment, + primaryMuscles: data.primaryMuscles.present + ? data.primaryMuscles.value + : this.primaryMuscles, + secondaryMuscles: data.secondaryMuscles.present + ? data.secondaryMuscles.value + : this.secondaryMuscles, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ActivitiesData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('type: $type, ') + ..write('description: $description, ') + ..write('category: $category, ') + ..write('force: $force, ') + ..write('level: $level, ') + ..write('mechanic: $mechanic, ') + ..write('equipment: $equipment, ') + ..write('primaryMuscles: $primaryMuscles, ') + ..write('secondaryMuscles: $secondaryMuscles, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(id, title, type, description, category, force, + level, mechanic, equipment, primaryMuscles, secondaryMuscles, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ActivitiesData && + other.id == this.id && + other.title == this.title && + other.type == this.type && + other.description == this.description && + other.category == this.category && + other.force == this.force && + other.level == this.level && + other.mechanic == this.mechanic && + other.equipment == this.equipment && + other.primaryMuscles == this.primaryMuscles && + other.secondaryMuscles == this.secondaryMuscles && + other.createdAt == this.createdAt); +} + +class ActivitiesCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value type; + final Value description; + final Value category; + final Value force; + final Value level; + final Value mechanic; + final Value equipment; + final Value primaryMuscles; + final Value secondaryMuscles; + final Value createdAt; + const ActivitiesCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.type = const Value.absent(), + this.description = const Value.absent(), + this.category = const Value.absent(), + this.force = const Value.absent(), + this.level = const Value.absent(), + this.mechanic = const Value.absent(), + this.equipment = const Value.absent(), + this.primaryMuscles = const Value.absent(), + this.secondaryMuscles = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ActivitiesCompanion.insert({ + this.id = const Value.absent(), + required String title, + this.type = const Value.absent(), + this.description = const Value.absent(), + this.category = const Value.absent(), + this.force = const Value.absent(), + this.level = const Value.absent(), + this.mechanic = const Value.absent(), + this.equipment = const Value.absent(), + this.primaryMuscles = const Value.absent(), + this.secondaryMuscles = const Value.absent(), + this.createdAt = const Value.absent(), + }) : title = Value(title); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? type, + Expression? description, + Expression? category, + Expression? force, + Expression? level, + Expression? mechanic, + Expression? equipment, + Expression? primaryMuscles, + Expression? secondaryMuscles, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (type != null) 'type': type, + if (description != null) 'body': description, + if (category != null) 'category': category, + if (force != null) 'force': force, + if (level != null) 'level': level, + if (mechanic != null) 'mechanic': mechanic, + if (equipment != null) 'equipment': equipment, + if (primaryMuscles != null) 'primary_muscles': primaryMuscles, + if (secondaryMuscles != null) 'secondary_muscles': secondaryMuscles, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ActivitiesCompanion copyWith( + {Value? id, + Value? title, + Value? type, + Value? description, + Value? category, + Value? force, + Value? level, + Value? mechanic, + Value? equipment, + Value? primaryMuscles, + Value? secondaryMuscles, + Value? createdAt}) { + return ActivitiesCompanion( + id: id ?? this.id, + title: title ?? this.title, + type: type ?? this.type, + description: description ?? this.description, + category: category ?? this.category, + force: force ?? this.force, + level: level ?? this.level, + mechanic: mechanic ?? this.mechanic, + equipment: equipment ?? this.equipment, + primaryMuscles: primaryMuscles ?? this.primaryMuscles, + secondaryMuscles: secondaryMuscles ?? this.secondaryMuscles, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (type.present) { + map['type'] = Variable(type.value); + } + if (description.present) { + map['body'] = Variable(description.value); + } + if (category.present) { + map['category'] = Variable(category.value); + } + if (force.present) { + map['force'] = Variable(force.value); + } + if (level.present) { + map['level'] = Variable(level.value); + } + if (mechanic.present) { + map['mechanic'] = Variable(mechanic.value); + } + if (equipment.present) { + map['equipment'] = Variable(equipment.value); + } + if (primaryMuscles.present) { + map['primary_muscles'] = Variable(primaryMuscles.value); + } + if (secondaryMuscles.present) { + map['secondary_muscles'] = Variable(secondaryMuscles.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ActivitiesCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('type: $type, ') + ..write('description: $description, ') + ..write('category: $category, ') + ..write('force: $force, ') + ..write('level: $level, ') + ..write('mechanic: $mechanic, ') + ..write('equipment: $equipment, ') + ..write('primaryMuscles: $primaryMuscles, ') + ..write('secondaryMuscles: $secondaryMuscles, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class SessionActivities extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + SessionActivities(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn sessionId = GeneratedColumn( + 'session_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES sessions (id) ON DELETE CASCADE')); + late final GeneratedColumn activityId = GeneratedColumn( + 'activity_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES activities (id) ON DELETE CASCADE')); + late final GeneratedColumn position = GeneratedColumn( + 'position', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn results = GeneratedColumn( + 'results', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, sessionId, activityId, position, results, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'session_activities'; + @override + Set get $primaryKey => {id}; + @override + SessionActivitiesData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return SessionActivitiesData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + sessionId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}session_id'])!, + activityId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}activity_id'])!, + position: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}position'])!, + results: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}results']), + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + SessionActivities createAlias(String alias) { + return SessionActivities(attachedDatabase, alias); + } +} + +class SessionActivitiesData extends DataClass + implements Insertable { + final int id; + final int sessionId; + final int activityId; + final int position; + final String? results; + final DateTime createdAt; + const SessionActivitiesData( + {required this.id, + required this.sessionId, + required this.activityId, + required this.position, + this.results, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['session_id'] = Variable(sessionId); + map['activity_id'] = Variable(activityId); + map['position'] = Variable(position); + if (!nullToAbsent || results != null) { + map['results'] = Variable(results); + } + map['created_at'] = Variable(createdAt); + return map; + } + + SessionActivitiesCompanion toCompanion(bool nullToAbsent) { + return SessionActivitiesCompanion( + id: Value(id), + sessionId: Value(sessionId), + activityId: Value(activityId), + position: Value(position), + results: results == null && nullToAbsent + ? const Value.absent() + : Value(results), + createdAt: Value(createdAt), + ); + } + + factory SessionActivitiesData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return SessionActivitiesData( + id: serializer.fromJson(json['id']), + sessionId: serializer.fromJson(json['sessionId']), + activityId: serializer.fromJson(json['activityId']), + position: serializer.fromJson(json['position']), + results: serializer.fromJson(json['results']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'sessionId': serializer.toJson(sessionId), + 'activityId': serializer.toJson(activityId), + 'position': serializer.toJson(position), + 'results': serializer.toJson(results), + 'createdAt': serializer.toJson(createdAt), + }; + } + + SessionActivitiesData copyWith( + {int? id, + int? sessionId, + int? activityId, + int? position, + Value results = const Value.absent(), + DateTime? createdAt}) => + SessionActivitiesData( + id: id ?? this.id, + sessionId: sessionId ?? this.sessionId, + activityId: activityId ?? this.activityId, + position: position ?? this.position, + results: results.present ? results.value : this.results, + createdAt: createdAt ?? this.createdAt, + ); + SessionActivitiesData copyWithCompanion(SessionActivitiesCompanion data) { + return SessionActivitiesData( + id: data.id.present ? data.id.value : this.id, + sessionId: data.sessionId.present ? data.sessionId.value : this.sessionId, + activityId: + data.activityId.present ? data.activityId.value : this.activityId, + position: data.position.present ? data.position.value : this.position, + results: data.results.present ? data.results.value : this.results, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('SessionActivitiesData(') + ..write('id: $id, ') + ..write('sessionId: $sessionId, ') + ..write('activityId: $activityId, ') + ..write('position: $position, ') + ..write('results: $results, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(id, sessionId, activityId, position, results, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is SessionActivitiesData && + other.id == this.id && + other.sessionId == this.sessionId && + other.activityId == this.activityId && + other.position == this.position && + other.results == this.results && + other.createdAt == this.createdAt); +} + +class SessionActivitiesCompanion + extends UpdateCompanion { + final Value id; + final Value sessionId; + final Value activityId; + final Value position; + final Value results; + final Value createdAt; + const SessionActivitiesCompanion({ + this.id = const Value.absent(), + this.sessionId = const Value.absent(), + this.activityId = const Value.absent(), + this.position = const Value.absent(), + this.results = const Value.absent(), + this.createdAt = const Value.absent(), + }); + SessionActivitiesCompanion.insert({ + this.id = const Value.absent(), + required int sessionId, + required int activityId, + required int position, + this.results = const Value.absent(), + this.createdAt = const Value.absent(), + }) : sessionId = Value(sessionId), + activityId = Value(activityId), + position = Value(position); + static Insertable custom({ + Expression? id, + Expression? sessionId, + Expression? activityId, + Expression? position, + Expression? results, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (sessionId != null) 'session_id': sessionId, + if (activityId != null) 'activity_id': activityId, + if (position != null) 'position': position, + if (results != null) 'results': results, + if (createdAt != null) 'created_at': createdAt, + }); + } + + SessionActivitiesCompanion copyWith( + {Value? id, + Value? sessionId, + Value? activityId, + Value? position, + Value? results, + Value? createdAt}) { + return SessionActivitiesCompanion( + id: id ?? this.id, + sessionId: sessionId ?? this.sessionId, + activityId: activityId ?? this.activityId, + position: position ?? this.position, + results: results ?? this.results, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (sessionId.present) { + map['session_id'] = Variable(sessionId.value); + } + if (activityId.present) { + map['activity_id'] = Variable(activityId.value); + } + if (position.present) { + map['position'] = Variable(position.value); + } + if (results.present) { + map['results'] = Variable(results.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('SessionActivitiesCompanion(') + ..write('id: $id, ') + ..write('sessionId: $sessionId, ') + ..write('activityId: $activityId, ') + ..write('position: $position, ') + ..write('results: $results, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class Actions extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + Actions(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 64), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn description = GeneratedColumn( + 'body', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn totalSets = GeneratedColumn( + 'total_sets', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn totalReps = GeneratedColumn( + 'total_reps', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 1, maxTextLength: 32), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn restBeforeSets = GeneratedColumn( + 'rest_before_sets', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn restBetweenSets = GeneratedColumn( + 'rest_between_sets', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn restBetweenReps = GeneratedColumn( + 'rest_between_reps', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn restAfterSets = GeneratedColumn( + 'rest_after_sets', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn repType = GeneratedColumn( + 'rep_type', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn repLength = GeneratedColumn( + 'rep_length', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + late final GeneratedColumn repWeights = GeneratedColumn( + 'rep_weights', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn setWeights = GeneratedColumn( + 'set_weights', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn isAlternating = GeneratedColumn( + 'is_alternating', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("is_alternating" IN (0, 1))'), + defaultValue: Variable(false)); + late final GeneratedColumn tempo = GeneratedColumn( + 'tempo', aliasedName, true, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 6, maxTextLength: 36), + type: DriftSqlType.string, + requiredDuringInsert: false); + late final GeneratedColumn status = GeneratedColumn( + 'status', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: Variable('pending')); + late final GeneratedColumn state = GeneratedColumn( + 'state', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: Variable( + "{\"currentSet\": 0, \"currentRep\": 0, \"currentActionType\": 0, \"currentTime\": 0, \"currentAction\": 0}")); + late final GeneratedColumn set = GeneratedColumn( + 'set', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => [ + id, + title, + description, + totalSets, + totalReps, + restBeforeSets, + restBetweenSets, + restBetweenReps, + restAfterSets, + repType, + repLength, + repWeights, + setWeights, + isAlternating, + tempo, + status, + state, + set, + createdAt + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'actions'; + @override + Set get $primaryKey => {id}; + @override + ActionsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ActionsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + description: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body'])!, + totalSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}total_sets'])!, + totalReps: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}total_reps'])!, + restBeforeSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_before_sets']), + restBetweenSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_between_sets']), + restBetweenReps: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_between_reps']), + restAfterSets: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rest_after_sets']), + repType: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}rep_type'])!, + repLength: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}rep_length']), + repWeights: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}rep_weights']), + setWeights: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}set_weights']), + isAlternating: attachedDatabase.typeMapping + .read(DriftSqlType.bool, data['${effectivePrefix}is_alternating'])!, + tempo: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}tempo']), + status: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}status'])!, + state: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}state'])!, + set: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}set'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + Actions createAlias(String alias) { + return Actions(attachedDatabase, alias); + } +} + +class ActionsData extends DataClass implements Insertable { + final int id; + final String title; + final String description; + final int totalSets; + final String totalReps; + final int? restBeforeSets; + final int? restBetweenSets; + final int? restBetweenReps; + final int? restAfterSets; + final String repType; + final int? repLength; + final String? repWeights; + final String? setWeights; + final bool isAlternating; + final String? tempo; + final String status; + final String state; + final String set; + final DateTime createdAt; + const ActionsData( + {required this.id, + required this.title, + required this.description, + required this.totalSets, + required this.totalReps, + this.restBeforeSets, + this.restBetweenSets, + this.restBetweenReps, + this.restAfterSets, + required this.repType, + this.repLength, + this.repWeights, + this.setWeights, + required this.isAlternating, + this.tempo, + required this.status, + required this.state, + required this.set, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + map['body'] = Variable(description); + map['total_sets'] = Variable(totalSets); + map['total_reps'] = Variable(totalReps); + if (!nullToAbsent || restBeforeSets != null) { + map['rest_before_sets'] = Variable(restBeforeSets); + } + if (!nullToAbsent || restBetweenSets != null) { + map['rest_between_sets'] = Variable(restBetweenSets); + } + if (!nullToAbsent || restBetweenReps != null) { + map['rest_between_reps'] = Variable(restBetweenReps); + } + if (!nullToAbsent || restAfterSets != null) { + map['rest_after_sets'] = Variable(restAfterSets); + } + map['rep_type'] = Variable(repType); + if (!nullToAbsent || repLength != null) { + map['rep_length'] = Variable(repLength); + } + if (!nullToAbsent || repWeights != null) { + map['rep_weights'] = Variable(repWeights); + } + if (!nullToAbsent || setWeights != null) { + map['set_weights'] = Variable(setWeights); + } + map['is_alternating'] = Variable(isAlternating); + if (!nullToAbsent || tempo != null) { + map['tempo'] = Variable(tempo); + } + map['status'] = Variable(status); + map['state'] = Variable(state); + map['set'] = Variable(set); + map['created_at'] = Variable(createdAt); + return map; + } + + ActionsCompanion toCompanion(bool nullToAbsent) { + return ActionsCompanion( + id: Value(id), + title: Value(title), + description: Value(description), + totalSets: Value(totalSets), + totalReps: Value(totalReps), + restBeforeSets: restBeforeSets == null && nullToAbsent + ? const Value.absent() + : Value(restBeforeSets), + restBetweenSets: restBetweenSets == null && nullToAbsent + ? const Value.absent() + : Value(restBetweenSets), + restBetweenReps: restBetweenReps == null && nullToAbsent + ? const Value.absent() + : Value(restBetweenReps), + restAfterSets: restAfterSets == null && nullToAbsent + ? const Value.absent() + : Value(restAfterSets), + repType: Value(repType), + repLength: repLength == null && nullToAbsent + ? const Value.absent() + : Value(repLength), + repWeights: repWeights == null && nullToAbsent + ? const Value.absent() + : Value(repWeights), + setWeights: setWeights == null && nullToAbsent + ? const Value.absent() + : Value(setWeights), + isAlternating: Value(isAlternating), + tempo: + tempo == null && nullToAbsent ? const Value.absent() : Value(tempo), + status: Value(status), + state: Value(state), + set: Value(set), + createdAt: Value(createdAt), + ); + } + + factory ActionsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ActionsData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + description: serializer.fromJson(json['description']), + totalSets: serializer.fromJson(json['totalSets']), + totalReps: serializer.fromJson(json['totalReps']), + restBeforeSets: serializer.fromJson(json['restBeforeSets']), + restBetweenSets: serializer.fromJson(json['restBetweenSets']), + restBetweenReps: serializer.fromJson(json['restBetweenReps']), + restAfterSets: serializer.fromJson(json['restAfterSets']), + repType: serializer.fromJson(json['repType']), + repLength: serializer.fromJson(json['repLength']), + repWeights: serializer.fromJson(json['repWeights']), + setWeights: serializer.fromJson(json['setWeights']), + isAlternating: serializer.fromJson(json['isAlternating']), + tempo: serializer.fromJson(json['tempo']), + status: serializer.fromJson(json['status']), + state: serializer.fromJson(json['state']), + set: serializer.fromJson(json['set']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'description': serializer.toJson(description), + 'totalSets': serializer.toJson(totalSets), + 'totalReps': serializer.toJson(totalReps), + 'restBeforeSets': serializer.toJson(restBeforeSets), + 'restBetweenSets': serializer.toJson(restBetweenSets), + 'restBetweenReps': serializer.toJson(restBetweenReps), + 'restAfterSets': serializer.toJson(restAfterSets), + 'repType': serializer.toJson(repType), + 'repLength': serializer.toJson(repLength), + 'repWeights': serializer.toJson(repWeights), + 'setWeights': serializer.toJson(setWeights), + 'isAlternating': serializer.toJson(isAlternating), + 'tempo': serializer.toJson(tempo), + 'status': serializer.toJson(status), + 'state': serializer.toJson(state), + 'set': serializer.toJson(set), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ActionsData copyWith( + {int? id, + String? title, + String? description, + int? totalSets, + String? totalReps, + Value restBeforeSets = const Value.absent(), + Value restBetweenSets = const Value.absent(), + Value restBetweenReps = const Value.absent(), + Value restAfterSets = const Value.absent(), + String? repType, + Value repLength = const Value.absent(), + Value repWeights = const Value.absent(), + Value setWeights = const Value.absent(), + bool? isAlternating, + Value tempo = const Value.absent(), + String? status, + String? state, + String? set, + DateTime? createdAt}) => + ActionsData( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + totalSets: totalSets ?? this.totalSets, + totalReps: totalReps ?? this.totalReps, + restBeforeSets: + restBeforeSets.present ? restBeforeSets.value : this.restBeforeSets, + restBetweenSets: restBetweenSets.present + ? restBetweenSets.value + : this.restBetweenSets, + restBetweenReps: restBetweenReps.present + ? restBetweenReps.value + : this.restBetweenReps, + restAfterSets: + restAfterSets.present ? restAfterSets.value : this.restAfterSets, + repType: repType ?? this.repType, + repLength: repLength.present ? repLength.value : this.repLength, + repWeights: repWeights.present ? repWeights.value : this.repWeights, + setWeights: setWeights.present ? setWeights.value : this.setWeights, + isAlternating: isAlternating ?? this.isAlternating, + tempo: tempo.present ? tempo.value : this.tempo, + status: status ?? this.status, + state: state ?? this.state, + set: set ?? this.set, + createdAt: createdAt ?? this.createdAt, + ); + ActionsData copyWithCompanion(ActionsCompanion data) { + return ActionsData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + description: + data.description.present ? data.description.value : this.description, + totalSets: data.totalSets.present ? data.totalSets.value : this.totalSets, + totalReps: data.totalReps.present ? data.totalReps.value : this.totalReps, + restBeforeSets: data.restBeforeSets.present + ? data.restBeforeSets.value + : this.restBeforeSets, + restBetweenSets: data.restBetweenSets.present + ? data.restBetweenSets.value + : this.restBetweenSets, + restBetweenReps: data.restBetweenReps.present + ? data.restBetweenReps.value + : this.restBetweenReps, + restAfterSets: data.restAfterSets.present + ? data.restAfterSets.value + : this.restAfterSets, + repType: data.repType.present ? data.repType.value : this.repType, + repLength: data.repLength.present ? data.repLength.value : this.repLength, + repWeights: + data.repWeights.present ? data.repWeights.value : this.repWeights, + setWeights: + data.setWeights.present ? data.setWeights.value : this.setWeights, + isAlternating: data.isAlternating.present + ? data.isAlternating.value + : this.isAlternating, + tempo: data.tempo.present ? data.tempo.value : this.tempo, + status: data.status.present ? data.status.value : this.status, + state: data.state.present ? data.state.value : this.state, + set: data.set.present ? data.set.value : this.set, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ActionsData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('totalSets: $totalSets, ') + ..write('totalReps: $totalReps, ') + ..write('restBeforeSets: $restBeforeSets, ') + ..write('restBetweenSets: $restBetweenSets, ') + ..write('restBetweenReps: $restBetweenReps, ') + ..write('restAfterSets: $restAfterSets, ') + ..write('repType: $repType, ') + ..write('repLength: $repLength, ') + ..write('repWeights: $repWeights, ') + ..write('setWeights: $setWeights, ') + ..write('isAlternating: $isAlternating, ') + ..write('tempo: $tempo, ') + ..write('status: $status, ') + ..write('state: $state, ') + ..write('set: $set, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash( + id, + title, + description, + totalSets, + totalReps, + restBeforeSets, + restBetweenSets, + restBetweenReps, + restAfterSets, + repType, + repLength, + repWeights, + setWeights, + isAlternating, + tempo, + status, + state, + set, + createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ActionsData && + other.id == this.id && + other.title == this.title && + other.description == this.description && + other.totalSets == this.totalSets && + other.totalReps == this.totalReps && + other.restBeforeSets == this.restBeforeSets && + other.restBetweenSets == this.restBetweenSets && + other.restBetweenReps == this.restBetweenReps && + other.restAfterSets == this.restAfterSets && + other.repType == this.repType && + other.repLength == this.repLength && + other.repWeights == this.repWeights && + other.setWeights == this.setWeights && + other.isAlternating == this.isAlternating && + other.tempo == this.tempo && + other.status == this.status && + other.state == this.state && + other.set == this.set && + other.createdAt == this.createdAt); +} + +class ActionsCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value description; + final Value totalSets; + final Value totalReps; + final Value restBeforeSets; + final Value restBetweenSets; + final Value restBetweenReps; + final Value restAfterSets; + final Value repType; + final Value repLength; + final Value repWeights; + final Value setWeights; + final Value isAlternating; + final Value tempo; + final Value status; + final Value state; + final Value set; + final Value createdAt; + const ActionsCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.description = const Value.absent(), + this.totalSets = const Value.absent(), + this.totalReps = const Value.absent(), + this.restBeforeSets = const Value.absent(), + this.restBetweenSets = const Value.absent(), + this.restBetweenReps = const Value.absent(), + this.restAfterSets = const Value.absent(), + this.repType = const Value.absent(), + this.repLength = const Value.absent(), + this.repWeights = const Value.absent(), + this.setWeights = const Value.absent(), + this.isAlternating = const Value.absent(), + this.tempo = const Value.absent(), + this.status = const Value.absent(), + this.state = const Value.absent(), + this.set = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ActionsCompanion.insert({ + this.id = const Value.absent(), + required String title, + required String description, + required int totalSets, + required String totalReps, + this.restBeforeSets = const Value.absent(), + this.restBetweenSets = const Value.absent(), + this.restBetweenReps = const Value.absent(), + this.restAfterSets = const Value.absent(), + required String repType, + this.repLength = const Value.absent(), + this.repWeights = const Value.absent(), + this.setWeights = const Value.absent(), + this.isAlternating = const Value.absent(), + this.tempo = const Value.absent(), + this.status = const Value.absent(), + this.state = const Value.absent(), + required String set, + this.createdAt = const Value.absent(), + }) : title = Value(title), + description = Value(description), + totalSets = Value(totalSets), + totalReps = Value(totalReps), + repType = Value(repType), + set = Value(set); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? description, + Expression? totalSets, + Expression? totalReps, + Expression? restBeforeSets, + Expression? restBetweenSets, + Expression? restBetweenReps, + Expression? restAfterSets, + Expression? repType, + Expression? repLength, + Expression? repWeights, + Expression? setWeights, + Expression? isAlternating, + Expression? tempo, + Expression? status, + Expression? state, + Expression? set, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (description != null) 'body': description, + if (totalSets != null) 'total_sets': totalSets, + if (totalReps != null) 'total_reps': totalReps, + if (restBeforeSets != null) 'rest_before_sets': restBeforeSets, + if (restBetweenSets != null) 'rest_between_sets': restBetweenSets, + if (restBetweenReps != null) 'rest_between_reps': restBetweenReps, + if (restAfterSets != null) 'rest_after_sets': restAfterSets, + if (repType != null) 'rep_type': repType, + if (repLength != null) 'rep_length': repLength, + if (repWeights != null) 'rep_weights': repWeights, + if (setWeights != null) 'set_weights': setWeights, + if (isAlternating != null) 'is_alternating': isAlternating, + if (tempo != null) 'tempo': tempo, + if (status != null) 'status': status, + if (state != null) 'state': state, + if (set != null) 'set': set, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ActionsCompanion copyWith( + {Value? id, + Value? title, + Value? description, + Value? totalSets, + Value? totalReps, + Value? restBeforeSets, + Value? restBetweenSets, + Value? restBetweenReps, + Value? restAfterSets, + Value? repType, + Value? repLength, + Value? repWeights, + Value? setWeights, + Value? isAlternating, + Value? tempo, + Value? status, + Value? state, + Value? set, + Value? createdAt}) { + return ActionsCompanion( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + totalSets: totalSets ?? this.totalSets, + totalReps: totalReps ?? this.totalReps, + restBeforeSets: restBeforeSets ?? this.restBeforeSets, + restBetweenSets: restBetweenSets ?? this.restBetweenSets, + restBetweenReps: restBetweenReps ?? this.restBetweenReps, + restAfterSets: restAfterSets ?? this.restAfterSets, + repType: repType ?? this.repType, + repLength: repLength ?? this.repLength, + repWeights: repWeights ?? this.repWeights, + setWeights: setWeights ?? this.setWeights, + isAlternating: isAlternating ?? this.isAlternating, + tempo: tempo ?? this.tempo, + status: status ?? this.status, + state: state ?? this.state, + set: set ?? this.set, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (description.present) { + map['body'] = Variable(description.value); + } + if (totalSets.present) { + map['total_sets'] = Variable(totalSets.value); + } + if (totalReps.present) { + map['total_reps'] = Variable(totalReps.value); + } + if (restBeforeSets.present) { + map['rest_before_sets'] = Variable(restBeforeSets.value); + } + if (restBetweenSets.present) { + map['rest_between_sets'] = Variable(restBetweenSets.value); + } + if (restBetweenReps.present) { + map['rest_between_reps'] = Variable(restBetweenReps.value); + } + if (restAfterSets.present) { + map['rest_after_sets'] = Variable(restAfterSets.value); + } + if (repType.present) { + map['rep_type'] = Variable(repType.value); + } + if (repLength.present) { + map['rep_length'] = Variable(repLength.value); + } + if (repWeights.present) { + map['rep_weights'] = Variable(repWeights.value); + } + if (setWeights.present) { + map['set_weights'] = Variable(setWeights.value); + } + if (isAlternating.present) { + map['is_alternating'] = Variable(isAlternating.value); + } + if (tempo.present) { + map['tempo'] = Variable(tempo.value); + } + if (status.present) { + map['status'] = Variable(status.value); + } + if (state.present) { + map['state'] = Variable(state.value); + } + if (set.present) { + map['set'] = Variable(set.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ActionsCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('totalSets: $totalSets, ') + ..write('totalReps: $totalReps, ') + ..write('restBeforeSets: $restBeforeSets, ') + ..write('restBetweenSets: $restBetweenSets, ') + ..write('restBetweenReps: $restBetweenReps, ') + ..write('restAfterSets: $restAfterSets, ') + ..write('repType: $repType, ') + ..write('repLength: $repLength, ') + ..write('repWeights: $repWeights, ') + ..write('setWeights: $setWeights, ') + ..write('isAlternating: $isAlternating, ') + ..write('tempo: $tempo, ') + ..write('status: $status, ') + ..write('state: $state, ') + ..write('set: $set, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class ActivityActions extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + ActivityActions(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn activityId = GeneratedColumn( + 'activity_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES activities (id) ON DELETE CASCADE')); + late final GeneratedColumn actionId = GeneratedColumn( + 'action_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES actions (id) ON DELETE CASCADE')); + late final GeneratedColumn position = GeneratedColumn( + 'position', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, activityId, actionId, position, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'activity_actions'; + @override + Set get $primaryKey => {id}; + @override + ActivityActionsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ActivityActionsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + activityId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}activity_id'])!, + actionId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}action_id'])!, + position: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}position'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + ActivityActions createAlias(String alias) { + return ActivityActions(attachedDatabase, alias); + } +} + +class ActivityActionsData extends DataClass + implements Insertable { + final int id; + final int activityId; + final int actionId; + final int position; + final DateTime createdAt; + const ActivityActionsData( + {required this.id, + required this.activityId, + required this.actionId, + required this.position, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['activity_id'] = Variable(activityId); + map['action_id'] = Variable(actionId); + map['position'] = Variable(position); + map['created_at'] = Variable(createdAt); + return map; + } + + ActivityActionsCompanion toCompanion(bool nullToAbsent) { + return ActivityActionsCompanion( + id: Value(id), + activityId: Value(activityId), + actionId: Value(actionId), + position: Value(position), + createdAt: Value(createdAt), + ); + } + + factory ActivityActionsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ActivityActionsData( + id: serializer.fromJson(json['id']), + activityId: serializer.fromJson(json['activityId']), + actionId: serializer.fromJson(json['actionId']), + position: serializer.fromJson(json['position']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'activityId': serializer.toJson(activityId), + 'actionId': serializer.toJson(actionId), + 'position': serializer.toJson(position), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ActivityActionsData copyWith( + {int? id, + int? activityId, + int? actionId, + int? position, + DateTime? createdAt}) => + ActivityActionsData( + id: id ?? this.id, + activityId: activityId ?? this.activityId, + actionId: actionId ?? this.actionId, + position: position ?? this.position, + createdAt: createdAt ?? this.createdAt, + ); + ActivityActionsData copyWithCompanion(ActivityActionsCompanion data) { + return ActivityActionsData( + id: data.id.present ? data.id.value : this.id, + activityId: + data.activityId.present ? data.activityId.value : this.activityId, + actionId: data.actionId.present ? data.actionId.value : this.actionId, + position: data.position.present ? data.position.value : this.position, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ActivityActionsData(') + ..write('id: $id, ') + ..write('activityId: $activityId, ') + ..write('actionId: $actionId, ') + ..write('position: $position, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(id, activityId, actionId, position, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ActivityActionsData && + other.id == this.id && + other.activityId == this.activityId && + other.actionId == this.actionId && + other.position == this.position && + other.createdAt == this.createdAt); +} + +class ActivityActionsCompanion extends UpdateCompanion { + final Value id; + final Value activityId; + final Value actionId; + final Value position; + final Value createdAt; + const ActivityActionsCompanion({ + this.id = const Value.absent(), + this.activityId = const Value.absent(), + this.actionId = const Value.absent(), + this.position = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ActivityActionsCompanion.insert({ + this.id = const Value.absent(), + required int activityId, + required int actionId, + required int position, + this.createdAt = const Value.absent(), + }) : activityId = Value(activityId), + actionId = Value(actionId), + position = Value(position); + static Insertable custom({ + Expression? id, + Expression? activityId, + Expression? actionId, + Expression? position, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (activityId != null) 'activity_id': activityId, + if (actionId != null) 'action_id': actionId, + if (position != null) 'position': position, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ActivityActionsCompanion copyWith( + {Value? id, + Value? activityId, + Value? actionId, + Value? position, + Value? createdAt}) { + return ActivityActionsCompanion( + id: id ?? this.id, + activityId: activityId ?? this.activityId, + actionId: actionId ?? this.actionId, + position: position ?? this.position, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (activityId.present) { + map['activity_id'] = Variable(activityId.value); + } + if (actionId.present) { + map['action_id'] = Variable(actionId.value); + } + if (position.present) { + map['position'] = Variable(position.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ActivityActionsCompanion(') + ..write('id: $id, ') + ..write('activityId: $activityId, ') + ..write('actionId: $actionId, ') + ..write('position: $position, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class MediaItems extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + MediaItems(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn title = GeneratedColumn( + 'title', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 64), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn description = GeneratedColumn( + 'body', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn reference = GeneratedColumn( + 'reference', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn type = GeneratedColumn( + 'type', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, title, description, reference, type, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'media_items'; + @override + Set get $primaryKey => {id}; + @override + MediaItemsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return MediaItemsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + title: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}title'])!, + description: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}body'])!, + reference: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}reference'])!, + type: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}type'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + MediaItems createAlias(String alias) { + return MediaItems(attachedDatabase, alias); + } +} + +class MediaItemsData extends DataClass implements Insertable { + final int id; + final String title; + final String description; + final String reference; + final String type; + final DateTime createdAt; + const MediaItemsData( + {required this.id, + required this.title, + required this.description, + required this.reference, + required this.type, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + map['body'] = Variable(description); + map['reference'] = Variable(reference); + map['type'] = Variable(type); + map['created_at'] = Variable(createdAt); + return map; + } + + MediaItemsCompanion toCompanion(bool nullToAbsent) { + return MediaItemsCompanion( + id: Value(id), + title: Value(title), + description: Value(description), + reference: Value(reference), + type: Value(type), + createdAt: Value(createdAt), + ); + } + + factory MediaItemsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return MediaItemsData( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + description: serializer.fromJson(json['description']), + reference: serializer.fromJson(json['reference']), + type: serializer.fromJson(json['type']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'description': serializer.toJson(description), + 'reference': serializer.toJson(reference), + 'type': serializer.toJson(type), + 'createdAt': serializer.toJson(createdAt), + }; + } + + MediaItemsData copyWith( + {int? id, + String? title, + String? description, + String? reference, + String? type, + DateTime? createdAt}) => + MediaItemsData( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + reference: reference ?? this.reference, + type: type ?? this.type, + createdAt: createdAt ?? this.createdAt, + ); + MediaItemsData copyWithCompanion(MediaItemsCompanion data) { + return MediaItemsData( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + description: + data.description.present ? data.description.value : this.description, + reference: data.reference.present ? data.reference.value : this.reference, + type: data.type.present ? data.type.value : this.type, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('MediaItemsData(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('reference: $reference, ') + ..write('type: $type, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(id, title, description, reference, type, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is MediaItemsData && + other.id == this.id && + other.title == this.title && + other.description == this.description && + other.reference == this.reference && + other.type == this.type && + other.createdAt == this.createdAt); +} + +class MediaItemsCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value description; + final Value reference; + final Value type; + final Value createdAt; + const MediaItemsCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.description = const Value.absent(), + this.reference = const Value.absent(), + this.type = const Value.absent(), + this.createdAt = const Value.absent(), + }); + MediaItemsCompanion.insert({ + this.id = const Value.absent(), + required String title, + required String description, + required String reference, + required String type, + this.createdAt = const Value.absent(), + }) : title = Value(title), + description = Value(description), + reference = Value(reference), + type = Value(type); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? description, + Expression? reference, + Expression? type, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (description != null) 'body': description, + if (reference != null) 'reference': reference, + if (type != null) 'type': type, + if (createdAt != null) 'created_at': createdAt, + }); + } + + MediaItemsCompanion copyWith( + {Value? id, + Value? title, + Value? description, + Value? reference, + Value? type, + Value? createdAt}) { + return MediaItemsCompanion( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + reference: reference ?? this.reference, + type: type ?? this.type, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (description.present) { + map['body'] = Variable(description.value); + } + if (reference.present) { + map['reference'] = Variable(reference.value); + } + if (type.present) { + map['type'] = Variable(type.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('MediaItemsCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('reference: $reference, ') + ..write('type: $type, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class ObjectMediaItems extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + ObjectMediaItems(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn objectId = GeneratedColumn( + 'object_id', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn objectType = GeneratedColumn( + 'object_type', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn mediaId = GeneratedColumn( + 'media_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES media_items (id) ON DELETE CASCADE')); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Variable(DateTime.now())); + @override + List get $columns => + [id, objectId, objectType, mediaId, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'object_media_items'; + @override + Set get $primaryKey => {id}; + @override + ObjectMediaItemsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ObjectMediaItemsData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + objectId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}object_id'])!, + objectType: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}object_type'])!, + mediaId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}media_id'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + ObjectMediaItems createAlias(String alias) { + return ObjectMediaItems(attachedDatabase, alias); + } +} + +class ObjectMediaItemsData extends DataClass + implements Insertable { + final int id; + final int objectId; + final String objectType; + final int mediaId; + final DateTime createdAt; + const ObjectMediaItemsData( + {required this.id, + required this.objectId, + required this.objectType, + required this.mediaId, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['object_id'] = Variable(objectId); + map['object_type'] = Variable(objectType); + map['media_id'] = Variable(mediaId); + map['created_at'] = Variable(createdAt); + return map; + } + + ObjectMediaItemsCompanion toCompanion(bool nullToAbsent) { + return ObjectMediaItemsCompanion( + id: Value(id), + objectId: Value(objectId), + objectType: Value(objectType), + mediaId: Value(mediaId), + createdAt: Value(createdAt), + ); + } + + factory ObjectMediaItemsData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ObjectMediaItemsData( + id: serializer.fromJson(json['id']), + objectId: serializer.fromJson(json['objectId']), + objectType: serializer.fromJson(json['objectType']), + mediaId: serializer.fromJson(json['mediaId']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'objectId': serializer.toJson(objectId), + 'objectType': serializer.toJson(objectType), + 'mediaId': serializer.toJson(mediaId), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ObjectMediaItemsData copyWith( + {int? id, + int? objectId, + String? objectType, + int? mediaId, + DateTime? createdAt}) => + ObjectMediaItemsData( + id: id ?? this.id, + objectId: objectId ?? this.objectId, + objectType: objectType ?? this.objectType, + mediaId: mediaId ?? this.mediaId, + createdAt: createdAt ?? this.createdAt, + ); + ObjectMediaItemsData copyWithCompanion(ObjectMediaItemsCompanion data) { + return ObjectMediaItemsData( + id: data.id.present ? data.id.value : this.id, + objectId: data.objectId.present ? data.objectId.value : this.objectId, + objectType: + data.objectType.present ? data.objectType.value : this.objectType, + mediaId: data.mediaId.present ? data.mediaId.value : this.mediaId, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ObjectMediaItemsData(') + ..write('id: $id, ') + ..write('objectId: $objectId, ') + ..write('objectType: $objectType, ') + ..write('mediaId: $mediaId, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(id, objectId, objectType, mediaId, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ObjectMediaItemsData && + other.id == this.id && + other.objectId == this.objectId && + other.objectType == this.objectType && + other.mediaId == this.mediaId && + other.createdAt == this.createdAt); +} + +class ObjectMediaItemsCompanion extends UpdateCompanion { + final Value id; + final Value objectId; + final Value objectType; + final Value mediaId; + final Value createdAt; + const ObjectMediaItemsCompanion({ + this.id = const Value.absent(), + this.objectId = const Value.absent(), + this.objectType = const Value.absent(), + this.mediaId = const Value.absent(), + this.createdAt = const Value.absent(), + }); + ObjectMediaItemsCompanion.insert({ + this.id = const Value.absent(), + required int objectId, + required String objectType, + required int mediaId, + this.createdAt = const Value.absent(), + }) : objectId = Value(objectId), + objectType = Value(objectType), + mediaId = Value(mediaId); + static Insertable custom({ + Expression? id, + Expression? objectId, + Expression? objectType, + Expression? mediaId, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (objectId != null) 'object_id': objectId, + if (objectType != null) 'object_type': objectType, + if (mediaId != null) 'media_id': mediaId, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ObjectMediaItemsCompanion copyWith( + {Value? id, + Value? objectId, + Value? objectType, + Value? mediaId, + Value? createdAt}) { + return ObjectMediaItemsCompanion( + id: id ?? this.id, + objectId: objectId ?? this.objectId, + objectType: objectType ?? this.objectType, + mediaId: mediaId ?? this.mediaId, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (objectId.present) { + map['object_id'] = Variable(objectId.value); + } + if (objectType.present) { + map['object_type'] = Variable(objectType.value); + } + if (mediaId.present) { + map['media_id'] = Variable(mediaId.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ObjectMediaItemsCompanion(') + ..write('id: $id, ') + ..write('objectId: $objectId, ') + ..write('objectType: $objectType, ') + ..write('mediaId: $mediaId, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class DatabaseAtV33 extends GeneratedDatabase { + DatabaseAtV33(QueryExecutor e) : super(e); + late final Sessions sessions = Sessions(this); + late final Activities activities = Activities(this); + late final SessionActivities sessionActivities = SessionActivities(this); + late final Actions actions = Actions(this); + late final ActivityActions activityActions = ActivityActions(this); + late final MediaItems mediaItems = MediaItems(this); + late final ObjectMediaItems objectMediaItems = ObjectMediaItems(this); + @override + Iterable> get allTables => + allSchemaEntities.whereType>(); + @override + List get allSchemaEntities => [ + sessions, + activities, + sessionActivities, + actions, + activityActions, + mediaItems, + objectMediaItems + ]; + @override + int get schemaVersion => 33; +}