diff --git a/assets/audio/count_finish.mp3 b/assets/audio/count_finish.mp3 new file mode 100644 index 0000000..c2c5b59 Binary files /dev/null and b/assets/audio/count_finish.mp3 differ diff --git a/assets/audio/count_tone.wav b/assets/audio/count_tone.wav new file mode 100644 index 0000000..69c8eae Binary files /dev/null and b/assets/audio/count_tone.wav differ diff --git a/lib/daos/actions_dao.dart b/lib/daos/actions_dao.dart index 0911766..f903778 100644 --- a/lib/daos/actions_dao.dart +++ b/lib/daos/actions_dao.dart @@ -15,7 +15,7 @@ class ActionsDao extends DatabaseAccessor with _$ActionsDaoMixin { return await (select(actions)..where((action) => action.id.equals(id) )).getSingle(); } - Future> fromActivity(Activity activity) async { + Future> fromActivity(Activity activity, Session session) async { final result = select(db.activityActions).join( [ innerJoin( @@ -24,7 +24,8 @@ class ActionsDao extends DatabaseAccessor with _$ActionsDaoMixin { ), ], ) - ..where(db.activityActions.activityId.equals(activity.id)); + ..where(db.activityActions.activityId.equals(activity.id)) + ..where(db.activityActions.sessionId.equals(session.id)); final actions = (await result.get()) .map((e) => e.readTable(db.actions)) @@ -32,4 +33,32 @@ class ActionsDao extends DatabaseAccessor with _$ActionsDaoMixin { return actions; } + + Stream> watchActivityActions(Activity activity, Session session) { + final result = select(db.activityActions).join( + [ + innerJoin( + db.actions, + db.actions.id.equalsExp(db.activityActions.actionId), + ), + ], + ) + ..where(db.activityActions.activityId.equals(activity.id)) + ..where(db.activityActions.sessionId.equals(session.id)); + + // final actions = result.watch().map((rows) { + // return rows.map((row) { + // row.readTable(db.actions); + // }).toList(); + // }); + + final actions = (result.watch()).map((rows) { + return rows.map((row) => row.readTable(db.actions)).toList(); + }); + + return actions; + } + + Future createOrUpdate(ActionsCompanion action) => into(actions).insertOnConflictUpdate(action); + Future replace(Action action) => update(actions).replace(action); } diff --git a/lib/daos/activity_actions_dao.dart b/lib/daos/activity_actions_dao.dart index 98788bc..2736136 100644 --- a/lib/daos/activity_actions_dao.dart +++ b/lib/daos/activity_actions_dao.dart @@ -12,6 +12,7 @@ class ActivityActionsDao extends DatabaseAccessor with _$ActivityAc Future insert(ActivityAction activityAction) => into(activityActions).insert(activityAction); Future replace(ActivityAction activityAction) => update(activityActions).replace(activityAction); Future remove(ActivityAction activityAction) => delete(activityActions).delete(activityAction); + Future createOrUpdate(ActivityActionsCompanion activityAction) => into(activityActions).insertOnConflictUpdate(activityAction); // Future> all() async { // return await select(activityActions).get(); diff --git a/lib/daos/activity_actions_dao.g.dart b/lib/daos/activity_actions_dao.g.dart index 2dba712..ee057f5 100644 --- a/lib/daos/activity_actions_dao.g.dart +++ b/lib/daos/activity_actions_dao.g.dart @@ -6,5 +6,6 @@ part of 'activity_actions_dao.dart'; mixin _$ActivityActionsDaoMixin on DatabaseAccessor { $ActivitiesTable get activities => attachedDatabase.activities; $ActionsTable get actions => attachedDatabase.actions; + $SessionsTable get sessions => attachedDatabase.sessions; $ActivityActionsTable get activityActions => attachedDatabase.activityActions; } diff --git a/lib/database/database.dart b/lib/database/database.dart index 5aee3f1..b280ade 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 => 20; + int get schemaVersion => 35; @override MigrationStrategy get migration { @@ -155,19 +155,39 @@ class Activities extends Table { class ActivityActions extends Table { IntColumn get id => integer().autoIncrement()(); - IntColumn get activityId => - integer().references(Activities, #id, onDelete: KeyAction.cascade)(); + IntColumn get activityId => integer().references(Activities, #id, onDelete: KeyAction.cascade)(); IntColumn get actionId => integer().references(Actions, #id, onDelete: KeyAction.cascade)(); + IntColumn get sessionId => integer().references(Sessions, #id, onDelete: KeyAction.cascade)(); IntColumn get position => integer()(); DateTimeColumn get createdAt => dateTime().withDefault(Variable(DateTime.now()))(); } +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: 32)(); + TextColumn get title => text().withLength(min: 3, max: 64)(); TextColumn get description => text().named('body')(); + IntColumn get totalSets => integer()(); + TextColumn get totalReps => text().withLength(min: 1, max: 32)(); + IntColumn get restBeforeSets => integer().nullable()(); + IntColumn get restBetweenSets => integer().nullable()(); + IntColumn get restBetweenReps => integer().nullable()(); + IntColumn get restAfterSets => integer().nullable()(); + TextColumn get repType => textEnum()(); + IntColumn get repLength => integer().nullable()(); + TextColumn get repWeights => text().nullable()(); + 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 c247680..85bf34f 100644 --- a/lib/database/database.g.dart +++ b/lib/database/database.g.dart @@ -1441,7 +1441,7 @@ class $ActionsTable extends Actions with TableInfo<$ActionsTable, Action> { late final GeneratedColumn title = GeneratedColumn( 'title', aliasedName, false, additionalChecks: - GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 32), + GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 64), type: DriftSqlType.string, requiredDuringInsert: true); static const VerificationMeta _descriptionMeta = @@ -1450,6 +1450,104 @@ class $ActionsTable extends Actions with TableInfo<$ActionsTable, Action> { late final GeneratedColumn description = GeneratedColumn( 'body', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); + static const VerificationMeta _totalSetsMeta = + const VerificationMeta('totalSets'); + @override + late final GeneratedColumn totalSets = GeneratedColumn( + 'total_sets', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + static const VerificationMeta _totalRepsMeta = + const VerificationMeta('totalReps'); + @override + late final GeneratedColumn totalReps = GeneratedColumn( + 'total_reps', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 1, maxTextLength: 32), + type: DriftSqlType.string, + requiredDuringInsert: true); + static const VerificationMeta _restBeforeSetsMeta = + const VerificationMeta('restBeforeSets'); + @override + late final GeneratedColumn restBeforeSets = GeneratedColumn( + 'rest_before_sets', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + static const VerificationMeta _restBetweenSetsMeta = + const VerificationMeta('restBetweenSets'); + @override + late final GeneratedColumn restBetweenSets = GeneratedColumn( + 'rest_between_sets', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + static const VerificationMeta _restBetweenRepsMeta = + const VerificationMeta('restBetweenReps'); + @override + late final GeneratedColumn restBetweenReps = GeneratedColumn( + 'rest_between_reps', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + static const VerificationMeta _restAfterSetsMeta = + const VerificationMeta('restAfterSets'); + @override + late final GeneratedColumn restAfterSets = GeneratedColumn( + 'rest_after_sets', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + static const VerificationMeta _repTypeMeta = + const VerificationMeta('repType'); + @override + late final GeneratedColumnWithTypeConverter repType = + GeneratedColumn('rep_type', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true) + .withConverter($ActionsTable.$converterrepType); + static const VerificationMeta _repLengthMeta = + const VerificationMeta('repLength'); + @override + late final GeneratedColumn repLength = GeneratedColumn( + 'rep_length', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + static const VerificationMeta _repWeightsMeta = + const VerificationMeta('repWeights'); + @override + late final GeneratedColumn repWeights = GeneratedColumn( + 'rep_weights', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + static const VerificationMeta _setWeightsMeta = + const VerificationMeta('setWeights'); + @override + late final GeneratedColumn setWeights = GeneratedColumn( + 'set_weights', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + static const VerificationMeta _isAlternatingMeta = + const VerificationMeta('isAlternating'); + @override + 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)); + static const VerificationMeta _tempoMeta = const VerificationMeta('tempo'); + @override + late final GeneratedColumn tempo = GeneratedColumn( + 'tempo', aliasedName, true, + additionalChecks: + 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( @@ -1464,8 +1562,27 @@ class $ActionsTable extends Actions with TableInfo<$ActionsTable, Action> { requiredDuringInsert: false, defaultValue: Variable(DateTime.now())); @override - List get $columns => - [id, title, description, set, createdAt]; + 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 @@ -1491,6 +1608,74 @@ class $ActionsTable extends Actions with TableInfo<$ActionsTable, Action> { } else if (isInserting) { context.missing(_descriptionMeta); } + if (data.containsKey('total_sets')) { + context.handle(_totalSetsMeta, + totalSets.isAcceptableOrUnknown(data['total_sets']!, _totalSetsMeta)); + } else if (isInserting) { + context.missing(_totalSetsMeta); + } + if (data.containsKey('total_reps')) { + context.handle(_totalRepsMeta, + totalReps.isAcceptableOrUnknown(data['total_reps']!, _totalRepsMeta)); + } else if (isInserting) { + context.missing(_totalRepsMeta); + } + if (data.containsKey('rest_before_sets')) { + context.handle( + _restBeforeSetsMeta, + restBeforeSets.isAcceptableOrUnknown( + data['rest_before_sets']!, _restBeforeSetsMeta)); + } + if (data.containsKey('rest_between_sets')) { + context.handle( + _restBetweenSetsMeta, + restBetweenSets.isAcceptableOrUnknown( + data['rest_between_sets']!, _restBetweenSetsMeta)); + } + if (data.containsKey('rest_between_reps')) { + context.handle( + _restBetweenRepsMeta, + restBetweenReps.isAcceptableOrUnknown( + data['rest_between_reps']!, _restBetweenRepsMeta)); + } + if (data.containsKey('rest_after_sets')) { + context.handle( + _restAfterSetsMeta, + restAfterSets.isAcceptableOrUnknown( + data['rest_after_sets']!, _restAfterSetsMeta)); + } + context.handle(_repTypeMeta, const VerificationResult.success()); + if (data.containsKey('rep_length')) { + context.handle(_repLengthMeta, + repLength.isAcceptableOrUnknown(data['rep_length']!, _repLengthMeta)); + } + if (data.containsKey('rep_weights')) { + context.handle( + _repWeightsMeta, + repWeights.isAcceptableOrUnknown( + data['rep_weights']!, _repWeightsMeta)); + } + if (data.containsKey('set_weights')) { + context.handle( + _setWeightsMeta, + setWeights.isAcceptableOrUnknown( + data['set_weights']!, _setWeightsMeta)); + } + if (data.containsKey('is_alternating')) { + context.handle( + _isAlternatingMeta, + isAlternating.isAcceptableOrUnknown( + data['is_alternating']!, _isAlternatingMeta)); + } + if (data.containsKey('tempo')) { + 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)); @@ -1516,6 +1701,36 @@ class $ActionsTable extends Actions with TableInfo<$ActionsTable, Action> { .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: $ActionsTable.$converterrepType.fromSql(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: $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 @@ -1527,18 +1742,51 @@ class $ActionsTable extends Actions with TableInfo<$ActionsTable, Action> { $ActionsTable createAlias(String alias) { return $ActionsTable(attachedDatabase, alias); } + + static JsonTypeConverter2 $converterrepType = + const EnumNameConverter(RepType.values); + static JsonTypeConverter2 $converterstatus = + const EnumNameConverter(ActionStatus.values); } class Action 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 RepType repType; + final int? repLength; + final String? repWeights; + final String? setWeights; + final bool isAlternating; + final String? tempo; + final ActionStatus status; + final String state; final String set; final DateTime createdAt; const Action( {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 @@ -1547,6 +1795,42 @@ class Action extends DataClass implements Insertable { 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($ActionsTable.$converterrepType.toSql(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($ActionsTable.$converterstatus.toSql(status)); + } + map['state'] = Variable(state); map['set'] = Variable(set); map['created_at'] = Variable(createdAt); return map; @@ -1557,6 +1841,35 @@ class Action extends DataClass implements Insertable { 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), ); @@ -1569,6 +1882,22 @@ class Action extends DataClass implements Insertable { 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: $ActionsTable.$converterrepType + .fromJson(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: $ActionsTable.$converterstatus + .fromJson(serializer.fromJson(json['status'])), + state: serializer.fromJson(json['state']), set: serializer.fromJson(json['set']), createdAt: serializer.fromJson(json['createdAt']), ); @@ -1580,6 +1909,22 @@ class Action extends DataClass implements Insertable { '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($ActionsTable.$converterrepType.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($ActionsTable.$converterstatus.toJson(status)), + 'state': serializer.toJson(state), 'set': serializer.toJson(set), 'createdAt': serializer.toJson(createdAt), }; @@ -1589,12 +1934,46 @@ class Action extends DataClass implements Insertable { {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(), + RepType? repType, + Value repLength = const Value.absent(), + Value repWeights = const Value.absent(), + Value setWeights = const Value.absent(), + bool? isAlternating, + Value tempo = const Value.absent(), + ActionStatus? status, + String? state, String? set, DateTime? createdAt}) => Action( 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, ); @@ -1604,6 +1983,32 @@ class Action extends DataClass implements Insertable { 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, ); @@ -1615,6 +2020,20 @@ class Action extends DataClass implements Insertable { ..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(')')) @@ -1622,7 +2041,26 @@ class Action extends DataClass implements Insertable { } @override - int get hashCode => Object.hash(id, title, description, set, createdAt); + 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) || @@ -1630,6 +2068,20 @@ class Action extends DataClass implements Insertable { 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); } @@ -1638,12 +2090,40 @@ 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(), }); @@ -1651,15 +2131,46 @@ class ActionsCompanion extends UpdateCompanion { 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 RepType 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, }) { @@ -1667,6 +2178,20 @@ class ActionsCompanion extends UpdateCompanion { 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, }); @@ -1676,12 +2201,40 @@ class ActionsCompanion extends UpdateCompanion { {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, ); @@ -1699,6 +2252,50 @@ class ActionsCompanion extends UpdateCompanion { 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( + $ActionsTable.$converterrepType.toSql(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($ActionsTable.$converterstatus.toSql(status.value)); + } + if (state.present) { + map['state'] = Variable(state.value); + } if (set.present) { map['set'] = Variable(set.value); } @@ -1714,6 +2311,20 @@ class ActionsCompanion extends UpdateCompanion { ..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(')')) @@ -1754,6 +2365,15 @@ class $ActivityActionsTable extends ActivityActions requiredDuringInsert: true, defaultConstraints: GeneratedColumn.constraintIsAlways( 'REFERENCES actions (id) ON DELETE CASCADE')); + static const VerificationMeta _sessionIdMeta = + const VerificationMeta('sessionId'); + @override + late final GeneratedColumn sessionId = GeneratedColumn( + 'session_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES sessions (id) ON DELETE CASCADE')); static const VerificationMeta _positionMeta = const VerificationMeta('position'); @override @@ -1770,7 +2390,7 @@ class $ActivityActionsTable extends ActivityActions defaultValue: Variable(DateTime.now())); @override List get $columns => - [id, activityId, actionId, position, createdAt]; + [id, activityId, actionId, sessionId, position, createdAt]; @override String get aliasedName => _alias ?? actualTableName; @override @@ -1798,6 +2418,12 @@ class $ActivityActionsTable extends ActivityActions } else if (isInserting) { context.missing(_actionIdMeta); } + if (data.containsKey('session_id')) { + context.handle(_sessionIdMeta, + sessionId.isAcceptableOrUnknown(data['session_id']!, _sessionIdMeta)); + } else if (isInserting) { + context.missing(_sessionIdMeta); + } if (data.containsKey('position')) { context.handle(_positionMeta, position.isAcceptableOrUnknown(data['position']!, _positionMeta)); @@ -1823,6 +2449,8 @@ class $ActivityActionsTable extends ActivityActions .read(DriftSqlType.int, data['${effectivePrefix}activity_id'])!, actionId: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}action_id'])!, + sessionId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}session_id'])!, position: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}position'])!, createdAt: attachedDatabase.typeMapping @@ -1840,12 +2468,14 @@ class ActivityAction extends DataClass implements Insertable { final int id; final int activityId; final int actionId; + final int sessionId; final int position; final DateTime createdAt; const ActivityAction( {required this.id, required this.activityId, required this.actionId, + required this.sessionId, required this.position, required this.createdAt}); @override @@ -1854,6 +2484,7 @@ class ActivityAction extends DataClass implements Insertable { map['id'] = Variable(id); map['activity_id'] = Variable(activityId); map['action_id'] = Variable(actionId); + map['session_id'] = Variable(sessionId); map['position'] = Variable(position); map['created_at'] = Variable(createdAt); return map; @@ -1864,6 +2495,7 @@ class ActivityAction extends DataClass implements Insertable { id: Value(id), activityId: Value(activityId), actionId: Value(actionId), + sessionId: Value(sessionId), position: Value(position), createdAt: Value(createdAt), ); @@ -1876,6 +2508,7 @@ class ActivityAction extends DataClass implements Insertable { id: serializer.fromJson(json['id']), activityId: serializer.fromJson(json['activityId']), actionId: serializer.fromJson(json['actionId']), + sessionId: serializer.fromJson(json['sessionId']), position: serializer.fromJson(json['position']), createdAt: serializer.fromJson(json['createdAt']), ); @@ -1887,6 +2520,7 @@ class ActivityAction extends DataClass implements Insertable { 'id': serializer.toJson(id), 'activityId': serializer.toJson(activityId), 'actionId': serializer.toJson(actionId), + 'sessionId': serializer.toJson(sessionId), 'position': serializer.toJson(position), 'createdAt': serializer.toJson(createdAt), }; @@ -1896,12 +2530,14 @@ class ActivityAction extends DataClass implements Insertable { {int? id, int? activityId, int? actionId, + int? sessionId, int? position, DateTime? createdAt}) => ActivityAction( id: id ?? this.id, activityId: activityId ?? this.activityId, actionId: actionId ?? this.actionId, + sessionId: sessionId ?? this.sessionId, position: position ?? this.position, createdAt: createdAt ?? this.createdAt, ); @@ -1911,6 +2547,7 @@ class ActivityAction extends DataClass implements Insertable { activityId: data.activityId.present ? data.activityId.value : this.activityId, actionId: data.actionId.present ? data.actionId.value : this.actionId, + sessionId: data.sessionId.present ? data.sessionId.value : this.sessionId, position: data.position.present ? data.position.value : this.position, createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, ); @@ -1922,6 +2559,7 @@ class ActivityAction extends DataClass implements Insertable { ..write('id: $id, ') ..write('activityId: $activityId, ') ..write('actionId: $actionId, ') + ..write('sessionId: $sessionId, ') ..write('position: $position, ') ..write('createdAt: $createdAt') ..write(')')) @@ -1930,7 +2568,7 @@ class ActivityAction extends DataClass implements Insertable { @override int get hashCode => - Object.hash(id, activityId, actionId, position, createdAt); + Object.hash(id, activityId, actionId, sessionId, position, createdAt); @override bool operator ==(Object other) => identical(this, other) || @@ -1938,6 +2576,7 @@ class ActivityAction extends DataClass implements Insertable { other.id == this.id && other.activityId == this.activityId && other.actionId == this.actionId && + other.sessionId == this.sessionId && other.position == this.position && other.createdAt == this.createdAt); } @@ -1946,12 +2585,14 @@ class ActivityActionsCompanion extends UpdateCompanion { final Value id; final Value activityId; final Value actionId; + final Value sessionId; final Value position; final Value createdAt; const ActivityActionsCompanion({ this.id = const Value.absent(), this.activityId = const Value.absent(), this.actionId = const Value.absent(), + this.sessionId = const Value.absent(), this.position = const Value.absent(), this.createdAt = const Value.absent(), }); @@ -1959,15 +2600,18 @@ class ActivityActionsCompanion extends UpdateCompanion { this.id = const Value.absent(), required int activityId, required int actionId, + required int sessionId, required int position, this.createdAt = const Value.absent(), }) : activityId = Value(activityId), actionId = Value(actionId), + sessionId = Value(sessionId), position = Value(position); static Insertable custom({ Expression? id, Expression? activityId, Expression? actionId, + Expression? sessionId, Expression? position, Expression? createdAt, }) { @@ -1975,6 +2619,7 @@ class ActivityActionsCompanion extends UpdateCompanion { if (id != null) 'id': id, if (activityId != null) 'activity_id': activityId, if (actionId != null) 'action_id': actionId, + if (sessionId != null) 'session_id': sessionId, if (position != null) 'position': position, if (createdAt != null) 'created_at': createdAt, }); @@ -1984,12 +2629,14 @@ class ActivityActionsCompanion extends UpdateCompanion { {Value? id, Value? activityId, Value? actionId, + Value? sessionId, Value? position, Value? createdAt}) { return ActivityActionsCompanion( id: id ?? this.id, activityId: activityId ?? this.activityId, actionId: actionId ?? this.actionId, + sessionId: sessionId ?? this.sessionId, position: position ?? this.position, createdAt: createdAt ?? this.createdAt, ); @@ -2007,6 +2654,9 @@ class ActivityActionsCompanion extends UpdateCompanion { if (actionId.present) { map['action_id'] = Variable(actionId.value); } + if (sessionId.present) { + map['session_id'] = Variable(sessionId.value); + } if (position.present) { map['position'] = Variable(position.value); } @@ -2022,6 +2672,7 @@ class ActivityActionsCompanion extends UpdateCompanion { ..write('id: $id, ') ..write('activityId: $activityId, ') ..write('actionId: $actionId, ') + ..write('sessionId: $sessionId, ') ..write('position: $position, ') ..write('createdAt: $createdAt') ..write(')')) @@ -2748,6 +3399,13 @@ abstract class _$AppDatabase extends GeneratedDatabase { TableUpdate('activity_actions', kind: UpdateKind.delete), ], ), + WritePropagation( + on: TableUpdateQuery.onTableName('sessions', + limitUpdateKind: UpdateKind.delete), + result: [ + TableUpdate('activity_actions', kind: UpdateKind.delete), + ], + ), WritePropagation( on: TableUpdateQuery.onTableName('media_items', limitUpdateKind: UpdateKind.delete), @@ -2800,6 +3458,23 @@ final class $$SessionsTableReferences return ProcessedTableManager( manager.$state.copyWith(prefetchedData: cache)); } + + static MultiTypedResultKey<$ActivityActionsTable, List> + _activityActionsRefsTable(_$AppDatabase db) => + MultiTypedResultKey.fromTable(db.activityActions, + aliasName: $_aliasNameGenerator( + db.sessions.id, db.activityActions.sessionId)); + + $$ActivityActionsTableProcessedTableManager get activityActionsRefs { + final manager = + $$ActivityActionsTableTableManager($_db, $_db.activityActions) + .filter((f) => f.sessionId.id($_item.id)); + + final cache = + $_typedResult.readTableOrNull(_activityActionsRefsTable($_db)); + return ProcessedTableManager( + manager.$state.copyWith(prefetchedData: cache)); + } } class $$SessionsTableFilterComposer @@ -2857,6 +3532,27 @@ class $$SessionsTableFilterComposer )); return f(composer); } + + Expression activityActionsRefs( + Expression Function($$ActivityActionsTableFilterComposer f) f) { + final $$ActivityActionsTableFilterComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.id, + referencedTable: $db.activityActions, + getReferencedColumn: (t) => t.sessionId, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$ActivityActionsTableFilterComposer( + $db: $db, + $table: $db.activityActions, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return f(composer); + } } class $$SessionsTableOrderingComposer @@ -2948,6 +3644,27 @@ class $$SessionsTableAnnotationComposer )); return f(composer); } + + Expression activityActionsRefs( + Expression Function($$ActivityActionsTableAnnotationComposer a) f) { + final $$ActivityActionsTableAnnotationComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.id, + referencedTable: $db.activityActions, + getReferencedColumn: (t) => t.sessionId, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$ActivityActionsTableAnnotationComposer( + $db: $db, + $table: $db.activityActions, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return f(composer); + } } class $$SessionsTableTableManager extends RootTableManager< @@ -2961,7 +3678,8 @@ class $$SessionsTableTableManager extends RootTableManager< $$SessionsTableUpdateCompanionBuilder, (Session, $$SessionsTableReferences), Session, - PrefetchHooks Function({bool sessionActivitiesRefs})> { + PrefetchHooks Function( + {bool sessionActivitiesRefs, bool activityActionsRefs})> { $$SessionsTableTableManager(_$AppDatabase db, $SessionsTable table) : super(TableManagerState( db: db, @@ -3016,11 +3734,13 @@ class $$SessionsTableTableManager extends RootTableManager< .map((e) => (e.readTable(table), $$SessionsTableReferences(db, table, e))) .toList(), - prefetchHooksCallback: ({sessionActivitiesRefs = false}) { + prefetchHooksCallback: ( + {sessionActivitiesRefs = false, activityActionsRefs = false}) { return PrefetchHooks( db: db, explicitlyWatchedTables: [ - if (sessionActivitiesRefs) db.sessionActivities + if (sessionActivitiesRefs) db.sessionActivities, + if (activityActionsRefs) db.activityActions ], addJoins: null, getPrefetchedDataCallback: (items) async { @@ -3036,6 +3756,18 @@ class $$SessionsTableTableManager extends RootTableManager< referencedItemsForCurrentItem: (item, referencedItems) => referencedItems .where((e) => e.sessionId == item.id), + typedResults: items), + if (activityActionsRefs) + await $_getPrefetchedData( + currentTable: table, + referencedTable: $$SessionsTableReferences + ._activityActionsRefsTable(db), + managerFromTypedResult: (p0) => + $$SessionsTableReferences(db, table, p0) + .activityActionsRefs, + referencedItemsForCurrentItem: + (item, referencedItems) => referencedItems + .where((e) => e.sessionId == item.id), typedResults: items) ]; }, @@ -3055,7 +3787,8 @@ typedef $$SessionsTableProcessedTableManager = ProcessedTableManager< $$SessionsTableUpdateCompanionBuilder, (Session, $$SessionsTableReferences), Session, - PrefetchHooks Function({bool sessionActivitiesRefs})>; + PrefetchHooks Function( + {bool sessionActivitiesRefs, bool activityActionsRefs})>; typedef $$ActivitiesTableCreateCompanionBuilder = ActivitiesCompanion Function({ Value id, required String title, @@ -3871,6 +4604,20 @@ typedef $$ActionsTableCreateCompanionBuilder = ActionsCompanion Function({ Value id, required String title, required String description, + required int totalSets, + required String totalReps, + Value restBeforeSets, + Value restBetweenSets, + Value restBetweenReps, + Value restAfterSets, + required RepType repType, + Value repLength, + Value repWeights, + Value setWeights, + Value isAlternating, + Value tempo, + Value status, + Value state, required String set, Value createdAt, }); @@ -3878,6 +4625,20 @@ typedef $$ActionsTableUpdateCompanionBuilder = ActionsCompanion Function({ 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, }); @@ -3922,6 +4683,55 @@ class $$ActionsTableFilterComposer ColumnFilters get description => $composableBuilder( column: $table.description, builder: (column) => ColumnFilters(column)); + ColumnFilters get totalSets => $composableBuilder( + column: $table.totalSets, builder: (column) => ColumnFilters(column)); + + ColumnFilters get totalReps => $composableBuilder( + column: $table.totalReps, builder: (column) => ColumnFilters(column)); + + ColumnFilters get restBeforeSets => $composableBuilder( + column: $table.restBeforeSets, + builder: (column) => ColumnFilters(column)); + + ColumnFilters get restBetweenSets => $composableBuilder( + column: $table.restBetweenSets, + builder: (column) => ColumnFilters(column)); + + ColumnFilters get restBetweenReps => $composableBuilder( + column: $table.restBetweenReps, + builder: (column) => ColumnFilters(column)); + + ColumnFilters get restAfterSets => $composableBuilder( + column: $table.restAfterSets, builder: (column) => ColumnFilters(column)); + + ColumnWithTypeConverterFilters get repType => + $composableBuilder( + column: $table.repType, + builder: (column) => ColumnWithTypeConverterFilters(column)); + + ColumnFilters get repLength => $composableBuilder( + column: $table.repLength, builder: (column) => ColumnFilters(column)); + + ColumnFilters get repWeights => $composableBuilder( + column: $table.repWeights, builder: (column) => ColumnFilters(column)); + + ColumnFilters get setWeights => $composableBuilder( + column: $table.setWeights, builder: (column) => ColumnFilters(column)); + + ColumnFilters get isAlternating => $composableBuilder( + column: $table.isAlternating, builder: (column) => ColumnFilters(column)); + + 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)); @@ -3968,6 +4778,53 @@ class $$ActionsTableOrderingComposer ColumnOrderings get description => $composableBuilder( column: $table.description, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get totalSets => $composableBuilder( + column: $table.totalSets, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get totalReps => $composableBuilder( + column: $table.totalReps, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get restBeforeSets => $composableBuilder( + column: $table.restBeforeSets, + builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get restBetweenSets => $composableBuilder( + column: $table.restBetweenSets, + builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get restBetweenReps => $composableBuilder( + column: $table.restBetweenReps, + builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get restAfterSets => $composableBuilder( + column: $table.restAfterSets, + builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get repType => $composableBuilder( + column: $table.repType, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get repLength => $composableBuilder( + column: $table.repLength, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get repWeights => $composableBuilder( + column: $table.repWeights, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get setWeights => $composableBuilder( + column: $table.setWeights, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get isAlternating => $composableBuilder( + column: $table.isAlternating, + builder: (column) => ColumnOrderings(column)); + + 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)); @@ -3993,6 +4850,48 @@ class $$ActionsTableAnnotationComposer GeneratedColumn get description => $composableBuilder( column: $table.description, builder: (column) => column); + GeneratedColumn get totalSets => + $composableBuilder(column: $table.totalSets, builder: (column) => column); + + GeneratedColumn get totalReps => + $composableBuilder(column: $table.totalReps, builder: (column) => column); + + GeneratedColumn get restBeforeSets => $composableBuilder( + column: $table.restBeforeSets, builder: (column) => column); + + GeneratedColumn get restBetweenSets => $composableBuilder( + column: $table.restBetweenSets, builder: (column) => column); + + GeneratedColumn get restBetweenReps => $composableBuilder( + column: $table.restBetweenReps, builder: (column) => column); + + GeneratedColumn get restAfterSets => $composableBuilder( + column: $table.restAfterSets, builder: (column) => column); + + GeneratedColumnWithTypeConverter get repType => + $composableBuilder(column: $table.repType, builder: (column) => column); + + GeneratedColumn get repLength => + $composableBuilder(column: $table.repLength, builder: (column) => column); + + GeneratedColumn get repWeights => $composableBuilder( + column: $table.repWeights, builder: (column) => column); + + GeneratedColumn get setWeights => $composableBuilder( + column: $table.setWeights, builder: (column) => column); + + GeneratedColumn get isAlternating => $composableBuilder( + column: $table.isAlternating, builder: (column) => column); + + 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); @@ -4047,6 +4946,20 @@ class $$ActionsTableTableManager extends RootTableManager< Value id = const Value.absent(), Value title = const Value.absent(), Value description = const Value.absent(), + Value totalSets = const Value.absent(), + Value totalReps = const Value.absent(), + Value restBeforeSets = const Value.absent(), + Value restBetweenSets = const Value.absent(), + Value restBetweenReps = const Value.absent(), + Value restAfterSets = const Value.absent(), + Value repType = const Value.absent(), + Value repLength = const Value.absent(), + Value repWeights = const Value.absent(), + 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(), }) => @@ -4054,6 +4967,20 @@ class $$ActionsTableTableManager extends RootTableManager< id: id, title: title, description: description, + totalSets: totalSets, + totalReps: totalReps, + restBeforeSets: restBeforeSets, + restBetweenSets: restBetweenSets, + restBetweenReps: restBetweenReps, + restAfterSets: restAfterSets, + repType: repType, + repLength: repLength, + repWeights: repWeights, + setWeights: setWeights, + isAlternating: isAlternating, + tempo: tempo, + status: status, + state: state, set: set, createdAt: createdAt, ), @@ -4061,6 +4988,20 @@ class $$ActionsTableTableManager extends RootTableManager< Value id = const Value.absent(), required String title, required String description, + required int totalSets, + required String totalReps, + Value restBeforeSets = const Value.absent(), + Value restBetweenSets = const Value.absent(), + Value restBetweenReps = const Value.absent(), + Value restAfterSets = const Value.absent(), + required RepType repType, + Value repLength = const Value.absent(), + Value repWeights = const Value.absent(), + 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(), }) => @@ -4068,6 +5009,20 @@ class $$ActionsTableTableManager extends RootTableManager< id: id, title: title, description: description, + totalSets: totalSets, + totalReps: totalReps, + restBeforeSets: restBeforeSets, + restBetweenSets: restBetweenSets, + restBetweenReps: restBetweenReps, + restAfterSets: restAfterSets, + repType: repType, + repLength: repLength, + repWeights: repWeights, + setWeights: setWeights, + isAlternating: isAlternating, + tempo: tempo, + status: status, + state: state, set: set, createdAt: createdAt, ), @@ -4120,6 +5075,7 @@ typedef $$ActivityActionsTableCreateCompanionBuilder = ActivityActionsCompanion Value id, required int activityId, required int actionId, + required int sessionId, required int position, Value createdAt, }); @@ -4128,6 +5084,7 @@ typedef $$ActivityActionsTableUpdateCompanionBuilder = ActivityActionsCompanion Value id, Value activityId, Value actionId, + Value sessionId, Value position, Value createdAt, }); @@ -4162,6 +5119,19 @@ final class $$ActivityActionsTableReferences extends BaseReferences< return ProcessedTableManager( manager.$state.copyWith(prefetchedData: [item])); } + + static $SessionsTable _sessionIdTable(_$AppDatabase db) => + db.sessions.createAlias( + $_aliasNameGenerator(db.activityActions.sessionId, db.sessions.id)); + + $$SessionsTableProcessedTableManager get sessionId { + final manager = $$SessionsTableTableManager($_db, $_db.sessions) + .filter((f) => f.id($_item.sessionId!)); + final item = $_typedResult.readTableOrNull(_sessionIdTable($_db)); + if (item == null) return manager; + return ProcessedTableManager( + manager.$state.copyWith(prefetchedData: [item])); + } } class $$ActivityActionsTableFilterComposer @@ -4221,6 +5191,26 @@ class $$ActivityActionsTableFilterComposer )); return composer; } + + $$SessionsTableFilterComposer get sessionId { + final $$SessionsTableFilterComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.sessionId, + referencedTable: $db.sessions, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$SessionsTableFilterComposer( + $db: $db, + $table: $db.sessions, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return composer; + } } class $$ActivityActionsTableOrderingComposer @@ -4280,6 +5270,26 @@ class $$ActivityActionsTableOrderingComposer )); return composer; } + + $$SessionsTableOrderingComposer get sessionId { + final $$SessionsTableOrderingComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.sessionId, + referencedTable: $db.sessions, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$SessionsTableOrderingComposer( + $db: $db, + $table: $db.sessions, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return composer; + } } class $$ActivityActionsTableAnnotationComposer @@ -4339,6 +5349,26 @@ class $$ActivityActionsTableAnnotationComposer )); return composer; } + + $$SessionsTableAnnotationComposer get sessionId { + final $$SessionsTableAnnotationComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.sessionId, + referencedTable: $db.sessions, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$SessionsTableAnnotationComposer( + $db: $db, + $table: $db.sessions, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return composer; + } } class $$ActivityActionsTableTableManager extends RootTableManager< @@ -4352,7 +5382,7 @@ class $$ActivityActionsTableTableManager extends RootTableManager< $$ActivityActionsTableUpdateCompanionBuilder, (ActivityAction, $$ActivityActionsTableReferences), ActivityAction, - PrefetchHooks Function({bool activityId, bool actionId})> { + PrefetchHooks Function({bool activityId, bool actionId, bool sessionId})> { $$ActivityActionsTableTableManager( _$AppDatabase db, $ActivityActionsTable table) : super(TableManagerState( @@ -4368,6 +5398,7 @@ class $$ActivityActionsTableTableManager extends RootTableManager< Value id = const Value.absent(), Value activityId = const Value.absent(), Value actionId = const Value.absent(), + Value sessionId = const Value.absent(), Value position = const Value.absent(), Value createdAt = const Value.absent(), }) => @@ -4375,6 +5406,7 @@ class $$ActivityActionsTableTableManager extends RootTableManager< id: id, activityId: activityId, actionId: actionId, + sessionId: sessionId, position: position, createdAt: createdAt, ), @@ -4382,6 +5414,7 @@ class $$ActivityActionsTableTableManager extends RootTableManager< Value id = const Value.absent(), required int activityId, required int actionId, + required int sessionId, required int position, Value createdAt = const Value.absent(), }) => @@ -4389,6 +5422,7 @@ class $$ActivityActionsTableTableManager extends RootTableManager< id: id, activityId: activityId, actionId: actionId, + sessionId: sessionId, position: position, createdAt: createdAt, ), @@ -4398,7 +5432,8 @@ class $$ActivityActionsTableTableManager extends RootTableManager< $$ActivityActionsTableReferences(db, table, e) )) .toList(), - prefetchHooksCallback: ({activityId = false, actionId = false}) { + prefetchHooksCallback: ( + {activityId = false, actionId = false, sessionId = false}) { return PrefetchHooks( db: db, explicitlyWatchedTables: [], @@ -4436,6 +5471,16 @@ class $$ActivityActionsTableTableManager extends RootTableManager< $$ActivityActionsTableReferences._actionIdTable(db).id, ) as T; } + if (sessionId) { + state = state.withJoin( + currentTable: table, + currentColumn: table.sessionId, + referencedTable: + $$ActivityActionsTableReferences._sessionIdTable(db), + referencedColumn: + $$ActivityActionsTableReferences._sessionIdTable(db).id, + ) as T; + } return state; }, @@ -4458,7 +5503,7 @@ typedef $$ActivityActionsTableProcessedTableManager = ProcessedTableManager< $$ActivityActionsTableUpdateCompanionBuilder, (ActivityAction, $$ActivityActionsTableReferences), ActivityAction, - PrefetchHooks Function({bool activityId, bool actionId})>; + PrefetchHooks Function({bool activityId, bool actionId, bool sessionId})>; typedef $$MediaItemsTableCreateCompanionBuilder = MediaItemsCompanion Function({ Value id, required String title, diff --git a/lib/database/database.steps.dart b/lib/database/database.steps.dart index 86b18c6..d545f68 100644 --- a/lib/database/database.steps.dart +++ b/lib/database/database.steps.dart @@ -3073,6 +3073,2543 @@ i1.GeneratedColumn _column_41(String aliasedName) => additionalChecks: i1.GeneratedColumn.checkTextLength( minTextLength: 3, maxTextLength: 64), type: i1.DriftSqlType.string); + +final class Schema21 extends i0.VersionedSchema { + Schema21({required super.database}) : super(version: 21); + @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 Shape18 actions = Shape18( + 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_50, + _column_51, + _column_52, + _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 Shape18 extends i0.VersionedTable { + Shape18({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 repWeight => + columnsByName['rep_weight']! 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 set => + columnsByName['set']! as i1.GeneratedColumn; + i1.GeneratedColumn get createdAt => + columnsByName['created_at']! as i1.GeneratedColumn; +} + +i1.GeneratedColumn _column_42(String aliasedName) => + i1.GeneratedColumn('total_sets', aliasedName, false, + type: i1.DriftSqlType.int); +i1.GeneratedColumn _column_43(String aliasedName) => + i1.GeneratedColumn('total_reps', aliasedName, false, + additionalChecks: i1.GeneratedColumn.checkTextLength( + minTextLength: 1, maxTextLength: 32), + type: i1.DriftSqlType.string); +i1.GeneratedColumn _column_44(String aliasedName) => + i1.GeneratedColumn('rest_before_sets', aliasedName, true, + type: i1.DriftSqlType.int); +i1.GeneratedColumn _column_45(String aliasedName) => + i1.GeneratedColumn('rest_between_sets', aliasedName, true, + type: i1.DriftSqlType.int); +i1.GeneratedColumn _column_46(String aliasedName) => + i1.GeneratedColumn('rest_between_reps', aliasedName, true, + type: i1.DriftSqlType.int); +i1.GeneratedColumn _column_47(String aliasedName) => + i1.GeneratedColumn('rest_after_sets', aliasedName, true, + type: i1.DriftSqlType.int); +i1.GeneratedColumn _column_48(String aliasedName) => + i1.GeneratedColumn('rep_type', aliasedName, false, + type: i1.DriftSqlType.string); +i1.GeneratedColumn _column_49(String aliasedName) => + i1.GeneratedColumn('rep_length', aliasedName, true, + type: i1.DriftSqlType.int); +i1.GeneratedColumn _column_50(String aliasedName) => + i1.GeneratedColumn('rep_weight', aliasedName, true, + type: i1.DriftSqlType.string); +i1.GeneratedColumn _column_51(String aliasedName) => + i1.GeneratedColumn('is_alternating', aliasedName, false, + type: i1.DriftSqlType.bool, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'CHECK ("is_alternating" IN (0, 1))'), + defaultValue: Variable(false)); +i1.GeneratedColumn _column_52(String aliasedName) => + i1.GeneratedColumn('tempo', aliasedName, true, + additionalChecks: i1.GeneratedColumn.checkTextLength( + minTextLength: 6, maxTextLength: 36), + type: i1.DriftSqlType.string); + +final class Schema22 extends i0.VersionedSchema { + Schema22({required super.database}) : super(version: 22); + @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 Shape19 actions = Shape19( + 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_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 Shape19 extends i0.VersionedTable { + Shape19({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 set => + columnsByName['set']! as i1.GeneratedColumn; + i1.GeneratedColumn get createdAt => + columnsByName['created_at']! as i1.GeneratedColumn; +} + +i1.GeneratedColumn _column_53(String aliasedName) => + i1.GeneratedColumn('rep_weights', aliasedName, true, + type: i1.DriftSqlType.string); +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}")); + +final class Schema34 extends i0.VersionedSchema { + Schema34({required super.database}) : super(version: 34); + @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 Shape22 activityActions = Shape22( + source: i0.VersionedTable( + entityName: 'activity_actions', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_9, + _column_23, + _column_8, + _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 Shape22 extends i0.VersionedTable { + Shape22({required super.source, required super.alias}) : super.aliased(); + i1.GeneratedColumn get id => + columnsByName['id']! as i1.GeneratedColumn; + i1.GeneratedColumn get activityId => + columnsByName['activity_id']! as i1.GeneratedColumn; + i1.GeneratedColumn get actionId => + columnsByName['action_id']! as i1.GeneratedColumn; + i1.GeneratedColumn get sessionId => + columnsByName['session_id']! as i1.GeneratedColumn; + i1.GeneratedColumn get position => + columnsByName['position']! as i1.GeneratedColumn; + i1.GeneratedColumn get createdAt => + columnsByName['created_at']! as i1.GeneratedColumn; +} + +final class Schema35 extends i0.VersionedSchema { + Schema35({required super.database}) : super(version: 35); + @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 Shape22 activityActions = Shape22( + source: i0.VersionedTable( + entityName: 'activity_actions', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_22, + _column_23, + _column_21, + _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); +} + i0.MigrationStepWithVersion migrationSteps({ required Future Function(i1.Migrator m, Schema2 schema) from1To2, required Future Function(i1.Migrator m, Schema3 schema) from2To3, @@ -3093,6 +5630,21 @@ i0.MigrationStepWithVersion migrationSteps({ required Future Function(i1.Migrator m, Schema18 schema) from17To18, required Future Function(i1.Migrator m, Schema19 schema) from18To19, 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, + required Future Function(i1.Migrator m, Schema34 schema) from33To34, + required Future Function(i1.Migrator m, Schema35 schema) from34To35, }) { return (currentVersion, database) async { switch (currentVersion) { @@ -3191,6 +5743,81 @@ i0.MigrationStepWithVersion migrationSteps({ final migrator = i1.Migrator(database, schema); await from19To20(migrator, schema); return 20; + case 20: + final schema = Schema21(database: database); + final migrator = i1.Migrator(database, schema); + await from20To21(migrator, schema); + return 21; + case 21: + final schema = Schema22(database: database); + 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; + case 33: + final schema = Schema34(database: database); + final migrator = i1.Migrator(database, schema); + await from33To34(migrator, schema); + return 34; + case 34: + final schema = Schema35(database: database); + final migrator = i1.Migrator(database, schema); + await from34To35(migrator, schema); + return 35; default: throw ArgumentError.value('Unknown migration from $currentVersion'); } @@ -3217,6 +5844,21 @@ i1.OnUpgrade stepByStep({ required Future Function(i1.Migrator m, Schema18 schema) from17To18, required Future Function(i1.Migrator m, Schema19 schema) from18To19, 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, + required Future Function(i1.Migrator m, Schema34 schema) from33To34, + required Future Function(i1.Migrator m, Schema35 schema) from34To35, }) => i0.VersionedSchema.stepByStepHelper( step: migrationSteps( @@ -3239,4 +5881,19 @@ i1.OnUpgrade stepByStep({ from17To18: from17To18, from18To19: from18To19, 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, + from33To34: from33To34, + from34To35: from34To35, )); diff --git a/lib/database/drift_schemas/sendtrain/drift_schema_v21.json b/lib/database/drift_schemas/sendtrain/drift_schema_v21.json new file mode 100644 index 0000000..6d507ea --- /dev/null +++ b/lib/database/drift_schemas/sendtrain/drift_schema_v21.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_weight","getter_name":"repWeight","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":"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_v22.json b/lib/database/drift_schemas/sendtrain/drift_schema_v22.json new file mode 100644 index 0000000..57d2014 --- /dev/null +++ b/lib/database/drift_schemas/sendtrain/drift_schema_v22.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":"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_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/drift_schemas/sendtrain/drift_schema_v34.json b/lib/database/drift_schemas/sendtrain/drift_schema_v34.json new file mode 100644 index 0000000..df274c9 --- /dev/null +++ b/lib/database/drift_schemas/sendtrain/drift_schema_v34.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,0],"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)","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES activities (id)"},"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":"session_id","getter_name":"sessionId","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES sessions (id)","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES sessions (id)"},"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_v35.json b/lib/database/drift_schemas/sendtrain/drift_schema_v35.json new file mode 100644 index 0000000..e1a46a2 --- /dev/null +++ b/lib/database/drift_schemas/sendtrain/drift_schema_v35.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,0],"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":"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":"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 26318f4..1fb3f83 100644 --- a/lib/database/seed.dart +++ b/lib/database/seed.dart @@ -43,14 +43,14 @@ Future seedDb(AppDatabase database) async { ['BgheYcxhrsw', MediaType.youtube] ]; - final List actionTypes = [ - "[[{\"actionID\": 0, \"name\": \"1, 3, 5\", \"type\": \"repititions\", \"amount\": 1, \"weight\": 0}, {\"actionID\": 1, \"name\": \"Rest\", \"type\": \"seconds\", \"amount\": 300}], [{\"actionID\": 2, \"name\": \"1, 3, 5\", \"type\": \"repititions\", \"amount\": 1, \"weight\": 0}, {\"actionID\": 3, \"name\": \"Rest\", \"type\": \"seconds\", \"amount\": 300}], [{\"actionID\": 4, \"name\": \"1, 3, 5\", \"type\": \"repititions\", \"amount\": 1, \"weight\": 0}, {\"actionID\": 5, \"name\": \"Rest\", \"type\": \"seconds\", \"amount\": 300}]]", - "[[{\"actionID\": 0, \"name\": \"Long Pulls\", \"type\": \"seconds\", \"amount\": 5, \"weight\": 80}, {\"actionID\": 1, \"name\": \"Rest\", \"type\": \"seconds\", \"amount\": 5}, {\"actionID\": 2, \"name\": \"Long Pulls\", \"type\": \"seconds\", \"amount\": 5, \"weights\": 80}, {\"actionID\": 3, \"name\": \"Rest\", \"type\": \"seconds\", \"amount\": 300}], [{\"actionID\": 4, \"name\": \"Long Pulls\", \"type\": \"seconds\", \"amount\": 5, \"weight\": 80}, {\"actionID\": 5, \"name\": \"Rest\", \"type\": \"seconds\", \"amount\": 5}, {\"actionID\": 6, \"name\": \"Long Pulls\", \"type\": \"seconds\", \"amount\": 5, \"weights\": 80}, {\"actionID\": 7, \"name\": \"Rest\", \"type\": \"seconds\", \"amount\": 300}], [{\"actionID\": 8, \"name\": \"Long Pulls\", \"type\": \"seconds\", \"amount\": 5, \"weight\": 80}, {\"actionID\": 9, \"name\": \"Rest\", \"type\": \"seconds\", \"amount\": 5}, {\"actionID\": 10, \"name\": \"Long Pulls\", \"type\": \"seconds\", \"amount\": 5, \"weights\": 80}, {\"actionID\": 11, \"name\": \"Rest\", \"type\": \"seconds\", \"amount\": 300}], [{\"actionID\": 12, \"name\": \"Long Pulls\", \"type\": \"seconds\", \"amount\": 5, \"weight\": 80}, {\"actionID\": 13, \"name\": \"Rest\", \"type\": \"seconds\", \"amount\": 5}, {\"actionID\": 14, \"name\": \"Long Pulls\", \"type\": \"seconds\", \"amount\": 5, \"weights\": 80}, {\"actionID\": 15, \"name\": \"Rest\", \"type\": \"seconds\", \"amount\": 300}], [{\"actionID\": 16, \"name\": \"Long Pulls\", \"type\": \"seconds\", \"amount\": 5, \"weight\": 80}, {\"actionID\": 17, \"name\": \"Rest\", \"type\": \"seconds\", \"amount\": 5}, {\"actionID\": 18, \"name\": \"Long Pulls\", \"type\": \"seconds\", \"amount\": 5, \"weights\": 80}, {\"actionID\": 19, \"name\": \"Rest\", \"type\": \"seconds\", \"amount\": 300}]]" - ]; + // final List actionTypes = [ + // "[[{\"actionID\": 0, \"name\": \"1, 3, 5\", \"type\": \"repititions\", \"amount\": 1, \"weight\": 0}, {\"actionID\": 1, \"name\": \"Rest\", \"type\": \"seconds\", \"amount\": 300}], [{\"actionID\": 2, \"name\": \"1, 3, 5\", \"type\": \"repititions\", \"amount\": 1, \"weight\": 0}, {\"actionID\": 3, \"name\": \"Rest\", \"type\": \"seconds\", \"amount\": 300}], [{\"actionID\": 4, \"name\": \"1, 3, 5\", \"type\": \"repititions\", \"amount\": 1, \"weight\": 0}, {\"actionID\": 5, \"name\": \"Rest\", \"type\": \"seconds\", \"amount\": 300}]]", + // "[[{\"actionID\": 0, \"name\": \"Long Pulls\", \"type\": \"seconds\", \"amount\": 5, \"weight\": 80}, {\"actionID\": 1, \"name\": \"Rest\", \"type\": \"seconds\", \"amount\": 5}, {\"actionID\": 2, \"name\": \"Long Pulls\", \"type\": \"seconds\", \"amount\": 5, \"weights\": 80}, {\"actionID\": 3, \"name\": \"Rest\", \"type\": \"seconds\", \"amount\": 300}], [{\"actionID\": 4, \"name\": \"Long Pulls\", \"type\": \"seconds\", \"amount\": 5, \"weight\": 80}, {\"actionID\": 5, \"name\": \"Rest\", \"type\": \"seconds\", \"amount\": 5}, {\"actionID\": 6, \"name\": \"Long Pulls\", \"type\": \"seconds\", \"amount\": 5, \"weights\": 80}, {\"actionID\": 7, \"name\": \"Rest\", \"type\": \"seconds\", \"amount\": 300}], [{\"actionID\": 8, \"name\": \"Long Pulls\", \"type\": \"seconds\", \"amount\": 5, \"weight\": 80}, {\"actionID\": 9, \"name\": \"Rest\", \"type\": \"seconds\", \"amount\": 5}, {\"actionID\": 10, \"name\": \"Long Pulls\", \"type\": \"seconds\", \"amount\": 5, \"weights\": 80}, {\"actionID\": 11, \"name\": \"Rest\", \"type\": \"seconds\", \"amount\": 300}], [{\"actionID\": 12, \"name\": \"Long Pulls\", \"type\": \"seconds\", \"amount\": 5, \"weight\": 80}, {\"actionID\": 13, \"name\": \"Rest\", \"type\": \"seconds\", \"amount\": 5}, {\"actionID\": 14, \"name\": \"Long Pulls\", \"type\": \"seconds\", \"amount\": 5, \"weights\": 80}, {\"actionID\": 15, \"name\": \"Rest\", \"type\": \"seconds\", \"amount\": 300}], [{\"actionID\": 16, \"name\": \"Long Pulls\", \"type\": \"seconds\", \"amount\": 5, \"weight\": 80}, {\"actionID\": 17, \"name\": \"Rest\", \"type\": \"seconds\", \"amount\": 5}, {\"actionID\": 18, \"name\": \"Long Pulls\", \"type\": \"seconds\", \"amount\": 5, \"weights\": 80}, {\"actionID\": 19, \"name\": \"Rest\", \"type\": \"seconds\", \"amount\": 300}]]" + // ]; final int totalSessions = 15; final int totalActivities = 6; - final int totalActions = 5; + // final int totalActions = 5; final int totalMedia = 5; final random = Random(); @@ -73,7 +73,8 @@ Future seedDb(AppDatabase database) async { Map payload = { Symbol('title'): Value(exercise['name']), - Symbol('description'): Value(json.encode(exercise['instructions'])), + Symbol('description'): + Value(json.encode(exercise['instructions'])), Symbol('force'): Value(exercise['force'] ?? "") }; @@ -125,8 +126,7 @@ Future seedDb(AppDatabase database) async { .into(database.mediaItems) .insert(MediaItemsCompanion.insert( title: exercise['name'], - description: - exercise['name'], + description: exercise['name'], reference: mediaItem, type: MediaType.image)) .then((mediaId) async { @@ -175,21 +175,56 @@ Future seedDb(AppDatabase database) async { )); // actions - for (int k = 0; k <= random.nextInt(totalActions); k++) { - await database - .into(database.actions) - .insert(ActionsCompanion.insert( - title: 'Test action $k', - 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.', - set: actionTypes[random.nextInt(actionTypes.length)])) - .then((actionId) async { - // add activity action association - await database.into(database.activityActions).insert( - ActivityActionsCompanion.insert( - activityId: activityId, actionId: actionId, position: k)); - }); - } + // await database + // .into(database.actions) + // .insert(ActionsCompanion.insert( + // title: 'Test action', + // description: + // '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: "[1]", + // restBeforeSets: Value(30000), + // restBetweenSets: Value(300000), + // restBetweenReps: Value(15000), + // restAfterSets: Value(300000), + // repType: RepType.time, + // repLength: Value(10000), + // repWeights: Value("[110]"), + // setWeights: Value("[1]"), + // isAlternating: Value(true), + // set: actionTypes[random.nextInt(actionTypes.length)])) + // .then((actionId) async { + // // add activity action association + // await database.into(database.activityActions).insert( + // ActivityActionsCompanion.insert( + // activityId: activityId, actionId: actionId, sessionId: sessionId, position: 0)); + // }); + // for (int k = 0; k <= random.nextInt(totalActions); k++) { + // await database + // .into(database.actions) + // .insert(ActionsCompanion.insert( + // title: 'Test action $k', + // 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: "[1]", + // restBeforeSets: Value(30000), + // restBetweenSets: Value(300000), + // restBetweenReps: Value(15000), + // restAfterSets: Value(300000), + // repType: RepType.time, + // repLength: Value(10000), + // repWeights: Value("[110]"), + // setWeights: Value("[1]"), + // isAlternating: Value(true), + // set: actionTypes[random.nextInt(actionTypes.length)])) + // .then((actionId) async { + // // add activity action association + // await database.into(database.activityActions).insert( + // ActivityActionsCompanion.insert( + // activityId: activityId, actionId: actionId, position: k)); + // }); + // } } for (int n = 0; n <= random.nextInt(totalMedia); n++) { 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..e86bbd0 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,33 @@ 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; +} + +Widget formItemWrapper(Widget content, + [EdgeInsets padding = const EdgeInsets.fromLTRB(0, 0, 0, 0)]) { + return Expanded(child: Padding(padding: padding, child: content)); +} + +List numericDropDownItems(String type, int itemLimit) { + final List items = []; + + // String entryName = type; + + for (int i = 0; i < itemLimit; i++) { + // if (i != 0) entryName = "${type}s"; + items.add(DropdownMenuEntry(value: i + 1, label: "${i + 1}")); + } + + return items; +} diff --git a/lib/main.dart b/lib/main.dart index f354271..0965839 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 @@ -78,6 +79,10 @@ class _AppState extends State { alignment: Alignment.center, child: const Text('In Progress...'), ), + Container( + alignment: Alignment.center, + child: const Text('Profile in Progress...'), + ), ][currentPageIndex]), bottomNavigationBar: NavigationBar( onDestinationSelected: (int index) { @@ -97,7 +102,9 @@ class _AppState extends State { NavigationDestination( icon: Icon(Icons.group), label: "Team Send"), NavigationDestination( - icon: Icon(Icons.analytics), label: "Progress") + icon: Icon(Icons.analytics), label: "Progress"), + NavigationDestination( + icon: Icon(Icons.account_circle_rounded), label: "Profile"), ]), floatingActionButton: FloatingActionButton.extended( onPressed: () { @@ -111,12 +118,13 @@ class _AppState extends State { } void main() { + var db = AppDatabase(); runApp(MultiProvider( providers: [ - ChangeNotifierProvider(create: (context) => ActivityTimerModel()), Provider( - create: (context) => AppDatabase(), - dispose: (context, db) => db.close()), + 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..ca97eb3 --- /dev/null +++ b/lib/models/action_model.dart @@ -0,0 +1,260 @@ +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: 'cooldown')); + } + + 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; + + // don't show a rest before first rep + if (i > 0) { + items.add(Rest( + id: position, + position: position, + parentId: id, + action: action, + time: action.restBetweenReps, + name: 'rest')); + } + + 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)); + } + } + } 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..81d3b67 --- /dev/null +++ b/lib/providers/action_timer.dart @@ -0,0 +1,211 @@ +import 'dart:async'; +import 'dart:convert'; + +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_sound/public/flutter_sound_player.dart'; +import 'package:flutter_sound/flutter_sound.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 = []; + final FlutterSoundPlayer _mPlayer = FlutterSoundPlayer(); + + 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]) async { + _scrollControllers.add(scrollController); + + if (resetOnLoad) { + if (this.actionModel == actionModel) { + reset(); + _scrollControllers.add(scrollController); + } + + this.actionModel = actionModel; + setAction(currentAction.id); + } + } + + Future pause() async => + await actionModel?.updateStatus(ActionStatus.paused).whenComplete(() { + _periodicTimer?.cancel(); + notifyListeners(); + + // _mPlayer.stopPlayer(); + // Be careful : you must `close` the audio session when you have finished with it. + }); + + Future start() async { + await actionModel!.updateStatus(ActionStatus.started); + await _mPlayer.openPlayer(); + + Uint8List? countTone; + Uint8List? finishTone; + await rootBundle + .load('assets/audio/count_tone.wav') + .then((data) => countTone = data.buffer.asUint8List()); + await rootBundle + .load('assets/audio/count_finish.mp3') + .then((data) => finishTone = data.buffer.asUint8List()); + + // 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 <= 3 && _currentTime != 0) { + await _mPlayer.startPlayer( + fromDataBuffer: countTone, codec: Codec.pcm16WAV); + } + + if (_currentTime == 0) { + // move to next action + await _mPlayer.startPlayer( + fromDataBuffer: finishTone, codec: Codec.mp3); + await setAction(state['currentAction'] + 1); + } + + await updateProgress(); + notifyListeners(); + } + }); + } + + notifyListeners(); + } + + Future close() async => await actionModel! + .updateStatus(ActionStatus.complete) + .whenComplete(() async { + _periodicTimer!.cancel(); + _mPlayer.closePlayer(); + notifyListeners(); + }); + + Future reset() async { + await actionModel?.updateStatus(ActionStatus.pending); + await actionModel?.updateState(json.encode(_stateConstructor())); + _periodicTimer?.cancel(); + _progress = 0; + _scrollControllers.clear(); + _mPlayer.closePlayer(); + 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 { + if (actionNum < allActions.length) { + 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 manual select, pause next action + if (isManual) { + await pause(); + await updateProgress(); + } + + int index = currentAction.parentId != null + ? currentAction.parentId! + : currentAction.id; + + if (_scrollControllers.isNotEmpty) { + 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); + }); + } else { + await actionModel?.updateStatus(ActionStatus.complete).whenComplete(() { + _periodicTimer?.cancel(); + notifyListeners(); + }); + } + + 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..61954ae --- /dev/null +++ b/lib/widgets/activities/activity_action_editor.dart @@ -0,0 +1,305 @@ +import 'dart:convert'; + +import 'package:drift/drift.dart' hide Column; +import 'package:flutter/material.dart' hide Action; +import 'package:provider/provider.dart'; +import 'package:sendtrain/daos/actions_dao.dart'; +import 'package:sendtrain/daos/activity_actions_dao.dart'; +import 'package:sendtrain/database/database.dart'; +import 'package:sendtrain/helpers/widget_helpers.dart'; +import 'package:sendtrain/widgets/generic/elements/form_drop_down.dart'; +import 'package:sendtrain/widgets/generic/elements/form_text_input.dart'; + +class ActivityActionEditor extends StatefulWidget { + const ActivityActionEditor( + {super.key, + required this.session, + required this.activity, + this.action, + this.callback}); + + final Session session; + final Activity activity; + final Action? action; + final Function? callback; + + @override + State createState() => _ActivityActionEditorState(); +} + +class _ActivityActionEditorState extends State { + final GlobalKey _formKey = GlobalKey(); + + final Map actionEditController = { + 'sets': TextEditingController(), + 'reps': TextEditingController(), + 'weight': TextEditingController(), + 'repLength': TextEditingController(), + 'preparation': TextEditingController(), + 'setRest': TextEditingController(), + 'repRest': TextEditingController(), + 'cooldown': TextEditingController(), + 'type': TextEditingController(), + 'alternating': TextEditingController(), + }; + + late final AppDatabase db; + + bool isAlternating = false; + bool isTimed = false; + String editorType = 'Create'; + + @override + void initState() { + super.initState(); + db = Provider.of(context, listen: false); + + // if we're editing a session, we'll want to populate it with the appropriate values + if (widget.action != null) { + final Action action = widget.action!; + editorType = 'Edit'; + isAlternating = action.isAlternating; + isTimed = action.repType == RepType.time ? true : false; + + actionEditController['sets']?.text = action.totalSets.toString(); + actionEditController['reps']?.text = + json.decode(action.totalReps)[0].toString(); + actionEditController['weight']?.text = + json.decode(action.repWeights ?? "")[0].toString(); + actionEditController['repLength']?.text = + ((action.repLength ?? 0) ~/ 1000).toString(); + actionEditController['preparation']?.text = + ((action.restBeforeSets ?? 0) ~/ 1000).toString(); + actionEditController['setRest']?.text = + ((action.restBetweenSets ?? 0) ~/ 1000).toString(); + actionEditController['repRest']?.text = + ((action.restBetweenReps ?? 0) ~/ 1000).toString(); + actionEditController['cooldown']?.text = + ((action.restAfterSets ?? 0) ~/ 1000).toString(); + actionEditController['isTimed']?.text = isTimed.toString(); + actionEditController['alternating']?.text = isAlternating.toString(); + } + } + + @override + Widget build(BuildContext context) { + if (widget.action != null) { + editorType = 'Edit'; + } + + 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)), + Row(children: [ + formItemWrapper( + CheckboxListTile( + title: Text("Reps alternate? (eg. Left/Right Hand)"), + value: isAlternating, + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.all(Radius.circular(10.0)), + ), + onChanged: (bool? value) { + setState(() { + isAlternating = value!; + }); + }, + ), + EdgeInsets.fromLTRB(10, 10, 10, 10)), + ]), + Row(children: [ + formItemWrapper( + CheckboxListTile( + title: Text("Are reps timed?"), + value: isTimed, + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.all(Radius.circular(10.0)), + ), + onChanged: (bool? value) { + setState(() { + isTimed = value!; + }); + }, + ), + EdgeInsets.fromLTRB(10, 10, 10, 15)) + ]), + Row(children: [ + FormDropDown( + title: 'Sets', + entries: numericDropDownItems('Set', 50), + controller: actionEditController['sets']!), + FormDropDown( + title: 'Reps', + entries: numericDropDownItems('Rep', 100), + controller: actionEditController['reps']!, + ) + ]), + Row(children: [ + formItemWrapper( + FormTextInput( + type: InputTypes.number, + controller: actionEditController['preparation']!, + title: 'Preparation (sec)', + hint: 'time before start', + requiresValidation: false), + EdgeInsets.fromLTRB(10, 5, 10, 0)), + formItemWrapper( + FormTextInput( + type: InputTypes.number, + controller: actionEditController['cooldown']!, + title: 'Cooldown (sec)', + hint: 'rest after completion', + requiresValidation: false), + EdgeInsets.fromLTRB(10, 5, 10, 0)), + ]), + Row(children: [ + formItemWrapper( + FormTextInput( + type: InputTypes.number, + controller: actionEditController['setRest']!, + title: 'Set Rest (sec)', + hint: 'Rest between sets', + requiresValidation: false), + EdgeInsets.only(left: 10, right: 10)), + formItemWrapper( + FormTextInput( + type: InputTypes.number, + controller: actionEditController['repRest']!, + title: 'Rep Rest (sec)', + hint: 'Rest between reps', + requiresValidation: false), + EdgeInsets.only(left: 10, right: 10)), + ]), + Row(children: [ + formItemWrapper( + FormTextInput( + type: InputTypes.number, + controller: actionEditController['repLength']!, + title: 'Rep Length (sec)', + hint: 'Total rep time (not required)', + requiresValidation: false), + EdgeInsets.only(left: 10, right: 10)), + formItemWrapper( + FormTextInput( + type: InputTypes.number, + controller: actionEditController['weight']!, + title: 'Weight', + hint: 'Weight for reps', + requiresValidation: false), + EdgeInsets.only(left: 10, right: 10)), + ]), + Row(mainAxisAlignment: MainAxisAlignment.end, children: [ + Padding( + padding: EdgeInsets.only(top: 10, right: 10), + child: FilledButton( + onPressed: () async { + if (_formKey.currentState!.validate()) { + if (widget.action != null) { + Action newAction = widget.action!.copyWith( + totalSets: int.parse( + actionEditController['sets']!.text), + totalReps: json.encode([ + int.parse( + actionEditController['reps']!.text) + ]), + repLength: Value(int.parse( + actionEditController['repLength']! + .text) * + 1000), + restBeforeSets: Value(int.parse( + actionEditController['preparation']! + .text) * + 1000), + restBetweenSets: Value(int.parse( + actionEditController['setRest']! + .text) * + 1000), + restBetweenReps: Value(int.parse( + actionEditController['repRest']! + .text) * + 1000), + restAfterSets: Value(int.parse( + actionEditController['cooldown']! + .text) * + 1000), + repType: int.parse(actionEditController[ + 'repLength']! + .text) > + 0 + ? RepType.time + : RepType.count, + repWeights: Value(json.encode([ + int.parse( + actionEditController['weight']!.text) + ])), + // setWeights: Value(json.encode([actionEditController['setWeights']!.text])), + isAlternating: isAlternating, + ); + + // var result = await ActionsDao(db).createOrUpdate( + // newAction.toCompanion(true)); + await ActionsDao(db).replace(newAction); + } else { + // create action + await ActionsDao(db) + .createOrUpdate(ActionsCompanion( + title: Value('title'), + description: Value('description'), + totalSets: Value(int.parse( + actionEditController['sets']! + .text)), + totalReps: Value(json.encode( + [int.parse(actionEditController['reps']!.text)])), + repLength: Value( + int.parse(actionEditController['repLength']!.text) * + 1000), + restBeforeSets: Value( + int.parse(actionEditController['preparation']!.text) * + 1000), + restBetweenSets: Value( + int.parse(actionEditController['setRest']!.text) * + 1000), + restBetweenReps: + Value(int.parse(actionEditController['repRest']!.text) * 1000), + restAfterSets: Value(int.parse(actionEditController['cooldown']!.text) * 1000), + repType: Value(int.parse(actionEditController['repLength']!.text) > 0 ? RepType.time : RepType.count), + repWeights: Value(json.encode([int.parse(actionEditController['weight']!.text)])), + // setWeights: Value(json.encode([actionEditController['setWeights']!.text])), + isAlternating: Value(isAlternating), + // repType: RepType.values.firstWhere((e) => e.toString() == "RepType.${actionEditController['repType']!.text}"), + set: Value(""))) + .then((actionId) { + ActivityActionsDao(db).createOrUpdate( + ActivityActionsCompanion( + activityId: + Value(widget.activity.id), + sessionId: Value(widget.session.id), + actionId: Value(actionId), + position: Value(0))); + }); + } + + Navigator.pop( + _formKey.currentContext!, 'Submit'); + + if (widget.callback != null) { + await widget.callback!(); + } + } + }, + child: Text('Submit'))) + ]) + ]))); + } +} diff --git a/lib/widgets/activities/activity_action_view.dart b/lib/widgets/activities/activity_action_view.dart index 73d965d..a44c33c 100644 --- a/lib/widgets/activities/activity_action_view.dart +++ b/lib/widgets/activities/activity_action_view.dart @@ -1,20 +1,38 @@ -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/helpers/widget_helpers.dart'; +import 'package:sendtrain/models/action_model.dart'; +import 'package:sendtrain/providers/action_timer.dart'; +import 'package:sendtrain/widgets/activities/activity_action_editor.dart'; +import 'package:sendtrain/widgets/generic/elements/add_card_generic.dart'; -class ActivityActionView extends StatefulWidget { - const ActivityActionView({super.key, required this.actions}); +// class ActivityActionView extends StatefulWidget { +class ActivityActionView extends StatelessWidget { + ActivityActionView( + {super.key, + required this.session, + required this.activity, + required this.actions, + this.callback, + this.resetOnLoad = true}); + final Session session; + final Activity activity; final List actions; + final Function? callback; + final bool resetOnLoad; - @override - State createState() => ActivityActionViewState(); -} + // @override + // State createState() => ActivityActionViewState(); +// } -class ActivityActionViewState extends State { +// 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 +41,210 @@ 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); + at = Provider.of(context, listen: false); + int actionCount = 0; + if (actions.isNotEmpty) { + at.setup( + ActionModel( + action: actions.first, + db: Provider.of(context)), + itemScrollController, + 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.complete) + {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: () { + showEditorSheet( + context, + ActivityActionEditor( + session: session, + activity: activity, + callback: callback)); + }); + } } } diff --git a/lib/widgets/activities/activity_card.dart b/lib/widgets/activities/activity_card.dart index 78e9130..606e408 100644 --- a/lib/widgets/activities/activity_card.dart +++ b/lib/widgets/activities/activity_card.dart @@ -49,7 +49,7 @@ class ActivityCardState extends State { clipBehavior: Clip.hardEdge, child: InkWell( onTap: () => showGenericDialog( - ActivityView(activity: widget.activity), context), + ActivityView(session: widget.session, activity: widget.activity), context), child: Column( mainAxisSize: MainAxisSize.min, children: [ diff --git a/lib/widgets/activities/activity_view.dart b/lib/widgets/activities/activity_view.dart index b15770d..f32a2d7 100644 --- a/lib/widgets/activities/activity_view.dart +++ b/lib/widgets/activities/activity_view.dart @@ -1,20 +1,23 @@ 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/providers/action_timer.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}); + const ActivityView( + {super.key, required this.session, required this.activity}); + final Session session; final Activity activity; @override @@ -22,7 +25,18 @@ class ActivityView extends StatefulWidget { } class _ActivityViewState extends State { - List activity_muscle(Activity activity) { + final _fabKey = GlobalKey(); + + void resetState() async { + final state = _fabKey.currentState; + if (state != null && state.isOpen) { + state.toggle(); + } + + setState(() {}); + } + + List activityMuscle(Activity activity) { List muscles = []; if (activity.primaryMuscles != null) { @@ -36,132 +50,83 @@ 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); + final Session session = widget.session; return FutureBuilder( future: ActionsDao(Provider.of(context)) - .fromActivity(activity), + .fromActivity(activity, session), 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( + key: _fabKey, + distance: 70, + type: ExpandableFabType.up, + overlayStyle: ExpandableFabOverlayStyle( + color: Colors.black.withOpacity(0.5), + blur: 10, + ), + onOpen: () { + // pause the activity on open + ActionTimer at = + Provider.of(context, listen: false); + if (at.started) at.pause(); + }, + 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( + session: session, + activity: activity, + action: actions.first, + callback: resetState)); + }, + ), + 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 +180,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,94 +237,42 @@ 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')), - - // 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), - ] + - 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( + session: session, + activity: activity, + actions: actions, + callback: resetState, + resetOnLoad: false) + ]), + Theme.of(context).colorScheme.surface); + }, + icon: Icon(Icons.expand), + alignment: Alignment.bottomCenter, + ) + ])), + ActivityActionView( + session: session, + activity: activity, + actions: actions, + callback: resetState) + ]))); + // ] + + // action(actions, context))); } else { return Container( alignment: Alignment.center, diff --git a/lib/widgets/activities/activity_view_categories.dart b/lib/widgets/activities/activity_view_categories.dart index 97d8ee6..dcb1b35 100644 --- a/lib/widgets/activities/activity_view_categories.dart +++ b/lib/widgets/activities/activity_view_categories.dart @@ -21,7 +21,7 @@ class ActivityViewCategories> extends StatelessWidget { itemCount: object.length, itemBuilder: (BuildContext context, int index) { return Padding( - padding: EdgeInsets.only(right: 10), + padding: EdgeInsets.only(right: 5), child: ActionChip( visualDensity: VisualDensity.compact, avatar: icon, 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_drop_down.dart b/lib/widgets/generic/elements/form_drop_down.dart new file mode 100644 index 0000000..cb476df --- /dev/null +++ b/lib/widgets/generic/elements/form_drop_down.dart @@ -0,0 +1,32 @@ +import 'package:flutter/material.dart'; +import 'package:sendtrain/helpers/widget_helpers.dart'; + +class FormDropDown extends StatelessWidget { + const FormDropDown( + {super.key, + required this.title, + required this.entries, + required this.controller}); + + final List entries; + final String title; + final TextEditingController controller; + + @override + Widget build(BuildContext context) { + return formItemWrapper( + DropdownMenu( + leadingIcon: Icon(Icons.select_all_rounded), + initialSelection: controller.text, + controller: controller, + expandedInsets: EdgeInsets.zero, + inputDecorationTheme: InputDecorationTheme( + filled: true, + border: OutlineInputBorder( + borderSide: BorderSide.none, + borderRadius: BorderRadius.circular(12))), + label: Text(title), + dropdownMenuEntries: entries), + EdgeInsets.fromLTRB(10, 5, 10, 5)); + } +} 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/lib/widgets/generic/elements/form_text_input.dart b/lib/widgets/generic/elements/form_text_input.dart index f7c4490..ba2ac95 100644 --- a/lib/widgets/generic/elements/form_text_input.dart +++ b/lib/widgets/generic/elements/form_text_input.dart @@ -1,4 +1,7 @@ import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; + +enum InputTypes { text, number } class FormTextInput extends StatelessWidget { const FormTextInput( @@ -9,7 +12,10 @@ class FormTextInput extends StatelessWidget { this.maxLines, this.minLines, this.onTap, - this.requiresValidation=true}); + this.requiresValidation = true, + this.type = InputTypes.text, + this.hint, + this.validations}); final TextEditingController controller; final String title; @@ -18,12 +24,25 @@ class FormTextInput extends StatelessWidget { final Icon? icon; final dynamic onTap; final bool requiresValidation; + final InputTypes type; + final String? hint; + final Function? validations; @override Widget build(BuildContext context) { + final Map params = {}; + if (type == InputTypes.number) { + params['keyboardType'] = TextInputType.number; + params['inputFormatters'] = [ + FilteringTextInputFormatter.digitsOnly + ]; + } + return Padding( padding: EdgeInsets.only(top: 10, bottom: 10), child: TextFormField( + keyboardType: params['keyboardType'] ?? TextInputType.text, + inputFormatters: params['inputFormatters'] ?? [], minLines: minLines ?? 1, maxLines: maxLines ?? 1, controller: controller, @@ -34,6 +53,7 @@ class FormTextInput extends StatelessWidget { borderSide: BorderSide.none, borderRadius: BorderRadius.circular(12)), labelText: title, + hintText: hint ?? '', ), validator: (String? value) { if (requiresValidation == true) { @@ -41,9 +61,11 @@ class FormTextInput extends StatelessWidget { return 'Please enter some text'; } - if (value.length < 3) { - return 'Please enter a minimum of 3 characters'; - } + if (validations != null) validations!(value); + + // if (value.length < 3) { + // return 'Please enter a minimum of 3 characters'; + // } } return null; }, diff --git a/lib/widgets/media/media_card.dart b/lib/widgets/media/media_card.dart index 042b933..eed627f 100644 --- a/lib/widgets/media/media_card.dart +++ b/lib/widgets/media/media_card.dart @@ -1,6 +1,4 @@ import 'dart:convert'; -import 'dart:io'; -import 'dart:typed_data'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -8,7 +6,6 @@ import 'package:sendtrain/daos/media_items_dao.dart'; import 'package:sendtrain/database/database.dart'; import 'package:sendtrain/helpers/widget_helpers.dart'; import 'package:sendtrain/widgets/builders/dialogs.dart'; -import 'package:video_player/video_player.dart'; class MediaCard extends StatelessWidget { const MediaCard( diff --git a/pubspec.yaml b/pubspec.yaml index a4c09d8..bb3386f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -51,6 +51,8 @@ dependencies: mime: ^2.0.0 video_player: ^2.9.2 dart_casing: ^3.0.1 + collection: ^1.18.0 + flutter_sound: ^9.23.1 flutter_launcher_name: name: "SendTrain" @@ -86,6 +88,7 @@ flutter: # - images/a_dot_burr.jpeg # - images/a_dot_ham.jpeg assets: + - assets/audio/ - assets/images/ - assets/exercises.json diff --git a/test/drift/sendtrain/generated/schema.dart b/test/drift/sendtrain/generated/schema.dart index 8558e69..a356905 100644 --- a/test/drift/sendtrain/generated/schema.dart +++ b/test/drift/sendtrain/generated/schema.dart @@ -23,6 +23,21 @@ import 'schema_v7.dart' as v7; import 'schema_v8.dart' as v8; 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; +import 'schema_v34.dart' as v34; +import 'schema_v35.dart' as v35; class GeneratedHelper implements SchemaInstantiationHelper { @override @@ -68,6 +83,36 @@ class GeneratedHelper implements SchemaInstantiationHelper { return v9.DatabaseAtV9(db); case 20: return v20.DatabaseAtV20(db); + case 21: + 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); + case 34: + return v34.DatabaseAtV34(db); + case 35: + return v35.DatabaseAtV35(db); default: throw MissingSchemaException(version, versions); } @@ -93,6 +138,21 @@ class GeneratedHelper implements SchemaInstantiationHelper { 17, 18, 19, - 20 + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35 ]; } diff --git a/test/drift/sendtrain/generated/schema_v21.dart b/test/drift/sendtrain/generated/schema_v21.dart new file mode 100644 index 0000000..ffe5e0e --- /dev/null +++ b/test/drift/sendtrain/generated/schema_v21.dart @@ -0,0 +1,2604 @@ +// 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 repWeight = GeneratedColumn( + 'rep_weight', 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 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, + repWeight, + isAlternating, + tempo, + 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']), + repWeight: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}rep_weight']), + isAlternating: attachedDatabase.typeMapping + .read(DriftSqlType.bool, data['${effectivePrefix}is_alternating'])!, + tempo: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}tempo']), + 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? repWeight; + final bool isAlternating; + final String? tempo; + 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.repWeight, + required this.isAlternating, + this.tempo, + 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 || repWeight != null) { + map['rep_weight'] = Variable(repWeight); + } + map['is_alternating'] = Variable(isAlternating); + if (!nullToAbsent || tempo != null) { + map['tempo'] = Variable(tempo); + } + 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), + repWeight: repWeight == null && nullToAbsent + ? const Value.absent() + : Value(repWeight), + isAlternating: Value(isAlternating), + tempo: + tempo == null && nullToAbsent ? const Value.absent() : Value(tempo), + 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']), + repWeight: serializer.fromJson(json['repWeight']), + isAlternating: serializer.fromJson(json['isAlternating']), + tempo: serializer.fromJson(json['tempo']), + 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), + 'repWeight': serializer.toJson(repWeight), + 'isAlternating': serializer.toJson(isAlternating), + 'tempo': serializer.toJson(tempo), + '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 repWeight = const Value.absent(), + bool? isAlternating, + Value tempo = 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, + repWeight: repWeight.present ? repWeight.value : this.repWeight, + isAlternating: isAlternating ?? this.isAlternating, + tempo: tempo.present ? tempo.value : this.tempo, + 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, + repWeight: data.repWeight.present ? data.repWeight.value : this.repWeight, + isAlternating: data.isAlternating.present + ? data.isAlternating.value + : this.isAlternating, + tempo: data.tempo.present ? data.tempo.value : this.tempo, + 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('repWeight: $repWeight, ') + ..write('isAlternating: $isAlternating, ') + ..write('tempo: $tempo, ') + ..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, + repWeight, + isAlternating, + tempo, + 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.repWeight == this.repWeight && + other.isAlternating == this.isAlternating && + other.tempo == this.tempo && + 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 repWeight; + final Value isAlternating; + final Value tempo; + 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.repWeight = const Value.absent(), + this.isAlternating = const Value.absent(), + this.tempo = 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.repWeight = const Value.absent(), + this.isAlternating = const Value.absent(), + this.tempo = 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? repWeight, + Expression? isAlternating, + Expression? tempo, + 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 (repWeight != null) 'rep_weight': repWeight, + if (isAlternating != null) 'is_alternating': isAlternating, + if (tempo != null) 'tempo': tempo, + 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? repWeight, + Value? isAlternating, + Value? tempo, + 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, + repWeight: repWeight ?? this.repWeight, + isAlternating: isAlternating ?? this.isAlternating, + tempo: tempo ?? this.tempo, + 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 (repWeight.present) { + map['rep_weight'] = Variable(repWeight.value); + } + if (isAlternating.present) { + map['is_alternating'] = Variable(isAlternating.value); + } + if (tempo.present) { + map['tempo'] = Variable(tempo.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('repWeight: $repWeight, ') + ..write('isAlternating: $isAlternating, ') + ..write('tempo: $tempo, ') + ..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 DatabaseAtV21 extends GeneratedDatabase { + DatabaseAtV21(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 => 21; +} diff --git a/test/drift/sendtrain/generated/schema_v22.dart b/test/drift/sendtrain/generated/schema_v22.dart new file mode 100644 index 0000000..02ce890 --- /dev/null +++ b/test/drift/sendtrain/generated/schema_v22.dart @@ -0,0 +1,2639 @@ +// 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 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, + 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']), + 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 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.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['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), + 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']), + 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), + '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? 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, + 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, + 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('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, + 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.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 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.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 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? 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 (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? 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, + 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 (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('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 DatabaseAtV22 extends GeneratedDatabase { + DatabaseAtV22(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 => 22; +} 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; +} diff --git a/test/drift/sendtrain/generated/schema_v34.dart b/test/drift/sendtrain/generated/schema_v34.dart new file mode 100644 index 0000000..b5c8715 --- /dev/null +++ b/test/drift/sendtrain/generated/schema_v34.dart @@ -0,0 +1,2733 @@ +// 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)')); + 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 sessionId = GeneratedColumn( + 'session_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: + GeneratedColumn.constraintIsAlways('REFERENCES sessions (id)')); + 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, sessionId, 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'])!, + sessionId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}session_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 sessionId; + final int position; + final DateTime createdAt; + const ActivityActionsData( + {required this.id, + required this.activityId, + required this.actionId, + required this.sessionId, + 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['session_id'] = Variable(sessionId); + 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), + sessionId: Value(sessionId), + 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']), + sessionId: serializer.fromJson(json['sessionId']), + 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), + 'sessionId': serializer.toJson(sessionId), + 'position': serializer.toJson(position), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ActivityActionsData copyWith( + {int? id, + int? activityId, + int? actionId, + int? sessionId, + int? position, + DateTime? createdAt}) => + ActivityActionsData( + id: id ?? this.id, + activityId: activityId ?? this.activityId, + actionId: actionId ?? this.actionId, + sessionId: sessionId ?? this.sessionId, + 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, + sessionId: data.sessionId.present ? data.sessionId.value : this.sessionId, + 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('sessionId: $sessionId, ') + ..write('position: $position, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(id, activityId, actionId, sessionId, 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.sessionId == this.sessionId && + other.position == this.position && + other.createdAt == this.createdAt); +} + +class ActivityActionsCompanion extends UpdateCompanion { + final Value id; + final Value activityId; + final Value actionId; + final Value sessionId; + final Value position; + final Value createdAt; + const ActivityActionsCompanion({ + this.id = const Value.absent(), + this.activityId = const Value.absent(), + this.actionId = const Value.absent(), + this.sessionId = 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 sessionId, + required int position, + this.createdAt = const Value.absent(), + }) : activityId = Value(activityId), + actionId = Value(actionId), + sessionId = Value(sessionId), + position = Value(position); + static Insertable custom({ + Expression? id, + Expression? activityId, + Expression? actionId, + Expression? sessionId, + Expression? position, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (activityId != null) 'activity_id': activityId, + if (actionId != null) 'action_id': actionId, + if (sessionId != null) 'session_id': sessionId, + if (position != null) 'position': position, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ActivityActionsCompanion copyWith( + {Value? id, + Value? activityId, + Value? actionId, + Value? sessionId, + Value? position, + Value? createdAt}) { + return ActivityActionsCompanion( + id: id ?? this.id, + activityId: activityId ?? this.activityId, + actionId: actionId ?? this.actionId, + sessionId: sessionId ?? this.sessionId, + 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 (sessionId.present) { + map['session_id'] = Variable(sessionId.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('sessionId: $sessionId, ') + ..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 DatabaseAtV34 extends GeneratedDatabase { + DatabaseAtV34(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 => 34; +} diff --git a/test/drift/sendtrain/generated/schema_v35.dart b/test/drift/sendtrain/generated/schema_v35.dart new file mode 100644 index 0000000..8b16461 --- /dev/null +++ b/test/drift/sendtrain/generated/schema_v35.dart @@ -0,0 +1,2733 @@ +// 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 sessionId = GeneratedColumn( + 'session_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES sessions (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, sessionId, 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'])!, + sessionId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}session_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 sessionId; + final int position; + final DateTime createdAt; + const ActivityActionsData( + {required this.id, + required this.activityId, + required this.actionId, + required this.sessionId, + 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['session_id'] = Variable(sessionId); + 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), + sessionId: Value(sessionId), + 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']), + sessionId: serializer.fromJson(json['sessionId']), + 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), + 'sessionId': serializer.toJson(sessionId), + 'position': serializer.toJson(position), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ActivityActionsData copyWith( + {int? id, + int? activityId, + int? actionId, + int? sessionId, + int? position, + DateTime? createdAt}) => + ActivityActionsData( + id: id ?? this.id, + activityId: activityId ?? this.activityId, + actionId: actionId ?? this.actionId, + sessionId: sessionId ?? this.sessionId, + 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, + sessionId: data.sessionId.present ? data.sessionId.value : this.sessionId, + 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('sessionId: $sessionId, ') + ..write('position: $position, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(id, activityId, actionId, sessionId, 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.sessionId == this.sessionId && + other.position == this.position && + other.createdAt == this.createdAt); +} + +class ActivityActionsCompanion extends UpdateCompanion { + final Value id; + final Value activityId; + final Value actionId; + final Value sessionId; + final Value position; + final Value createdAt; + const ActivityActionsCompanion({ + this.id = const Value.absent(), + this.activityId = const Value.absent(), + this.actionId = const Value.absent(), + this.sessionId = 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 sessionId, + required int position, + this.createdAt = const Value.absent(), + }) : activityId = Value(activityId), + actionId = Value(actionId), + sessionId = Value(sessionId), + position = Value(position); + static Insertable custom({ + Expression? id, + Expression? activityId, + Expression? actionId, + Expression? sessionId, + Expression? position, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (activityId != null) 'activity_id': activityId, + if (actionId != null) 'action_id': actionId, + if (sessionId != null) 'session_id': sessionId, + if (position != null) 'position': position, + if (createdAt != null) 'created_at': createdAt, + }); + } + + ActivityActionsCompanion copyWith( + {Value? id, + Value? activityId, + Value? actionId, + Value? sessionId, + Value? position, + Value? createdAt}) { + return ActivityActionsCompanion( + id: id ?? this.id, + activityId: activityId ?? this.activityId, + actionId: actionId ?? this.actionId, + sessionId: sessionId ?? this.sessionId, + 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 (sessionId.present) { + map['session_id'] = Variable(sessionId.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('sessionId: $sessionId, ') + ..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 DatabaseAtV35 extends GeneratedDatabase { + DatabaseAtV35(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 => 35; +}