2703 lines
98 KiB
Dart

// 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<Sessions, SessionsData> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
Sessions(this.attachedDatabase, [this._alias]);
late final GeneratedColumn<int> id = GeneratedColumn<int>(
'id', aliasedName, false,
hasAutoIncrement: true,
type: DriftSqlType.int,
requiredDuringInsert: false,
defaultConstraints:
GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT'));
late final GeneratedColumn<String> title = GeneratedColumn<String>(
'title', aliasedName, false,
additionalChecks:
GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 32),
type: DriftSqlType.string,
requiredDuringInsert: true);
late final GeneratedColumn<String> content = GeneratedColumn<String>(
'body', aliasedName, false,
type: DriftSqlType.string, requiredDuringInsert: true);
late final GeneratedColumn<String> status = GeneratedColumn<String>(
'status', aliasedName, false,
type: DriftSqlType.string, requiredDuringInsert: true);
late final GeneratedColumn<String> achievements = GeneratedColumn<String>(
'achievements', aliasedName, true,
type: DriftSqlType.string, requiredDuringInsert: false);
late final GeneratedColumn<String> address = GeneratedColumn<String>(
'address', aliasedName, true,
additionalChecks:
GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 256),
type: DriftSqlType.string,
requiredDuringInsert: false);
late final GeneratedColumn<DateTime> date = GeneratedColumn<DateTime>(
'date', aliasedName, true,
type: DriftSqlType.dateTime, requiredDuringInsert: false);
late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(
'created_at', aliasedName, false,
type: DriftSqlType.dateTime,
requiredDuringInsert: false,
defaultValue: Variable(DateTime.now()));
@override
List<GeneratedColumn> 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<GeneratedColumn> get $primaryKey => {id};
@override
SessionsData map(Map<String, dynamic> 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<SessionsData> {
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<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['id'] = Variable<int>(id);
map['title'] = Variable<String>(title);
map['body'] = Variable<String>(content);
map['status'] = Variable<String>(status);
if (!nullToAbsent || achievements != null) {
map['achievements'] = Variable<String>(achievements);
}
if (!nullToAbsent || address != null) {
map['address'] = Variable<String>(address);
}
if (!nullToAbsent || date != null) {
map['date'] = Variable<DateTime>(date);
}
map['created_at'] = Variable<DateTime>(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<String, dynamic> json,
{ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return SessionsData(
id: serializer.fromJson<int>(json['id']),
title: serializer.fromJson<String>(json['title']),
content: serializer.fromJson<String>(json['content']),
status: serializer.fromJson<String>(json['status']),
achievements: serializer.fromJson<String?>(json['achievements']),
address: serializer.fromJson<String?>(json['address']),
date: serializer.fromJson<DateTime?>(json['date']),
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'id': serializer.toJson<int>(id),
'title': serializer.toJson<String>(title),
'content': serializer.toJson<String>(content),
'status': serializer.toJson<String>(status),
'achievements': serializer.toJson<String?>(achievements),
'address': serializer.toJson<String?>(address),
'date': serializer.toJson<DateTime?>(date),
'createdAt': serializer.toJson<DateTime>(createdAt),
};
}
SessionsData copyWith(
{int? id,
String? title,
String? content,
String? status,
Value<String?> achievements = const Value.absent(),
Value<String?> address = const Value.absent(),
Value<DateTime?> 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<SessionsData> {
final Value<int> id;
final Value<String> title;
final Value<String> content;
final Value<String> status;
final Value<String?> achievements;
final Value<String?> address;
final Value<DateTime?> date;
final Value<DateTime> 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<SessionsData> custom({
Expression<int>? id,
Expression<String>? title,
Expression<String>? content,
Expression<String>? status,
Expression<String>? achievements,
Expression<String>? address,
Expression<DateTime>? date,
Expression<DateTime>? 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<int>? id,
Value<String>? title,
Value<String>? content,
Value<String>? status,
Value<String?>? achievements,
Value<String?>? address,
Value<DateTime?>? date,
Value<DateTime>? 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<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (id.present) {
map['id'] = Variable<int>(id.value);
}
if (title.present) {
map['title'] = Variable<String>(title.value);
}
if (content.present) {
map['body'] = Variable<String>(content.value);
}
if (status.present) {
map['status'] = Variable<String>(status.value);
}
if (achievements.present) {
map['achievements'] = Variable<String>(achievements.value);
}
if (address.present) {
map['address'] = Variable<String>(address.value);
}
if (date.present) {
map['date'] = Variable<DateTime>(date.value);
}
if (createdAt.present) {
map['created_at'] = Variable<DateTime>(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<Activities, ActivitiesData> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
Activities(this.attachedDatabase, [this._alias]);
late final GeneratedColumn<int> id = GeneratedColumn<int>(
'id', aliasedName, false,
hasAutoIncrement: true,
type: DriftSqlType.int,
requiredDuringInsert: false,
defaultConstraints:
GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT'));
late final GeneratedColumn<String> title = GeneratedColumn<String>(
'title', aliasedName, false,
additionalChecks:
GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 100),
type: DriftSqlType.string,
requiredDuringInsert: true);
late final GeneratedColumn<String> type = GeneratedColumn<String>(
'type', aliasedName, true,
type: DriftSqlType.string, requiredDuringInsert: false);
late final GeneratedColumn<String> description = GeneratedColumn<String>(
'body', aliasedName, true,
type: DriftSqlType.string, requiredDuringInsert: false);
late final GeneratedColumn<String> category = GeneratedColumn<String>(
'category', aliasedName, true,
type: DriftSqlType.string, requiredDuringInsert: false);
late final GeneratedColumn<String> force = GeneratedColumn<String>(
'force', aliasedName, true,
type: DriftSqlType.string, requiredDuringInsert: false);
late final GeneratedColumn<String> level = GeneratedColumn<String>(
'level', aliasedName, true,
type: DriftSqlType.string, requiredDuringInsert: false);
late final GeneratedColumn<String> mechanic = GeneratedColumn<String>(
'mechanic', aliasedName, true,
type: DriftSqlType.string, requiredDuringInsert: false);
late final GeneratedColumn<String> equipment = GeneratedColumn<String>(
'equipment', aliasedName, true,
type: DriftSqlType.string, requiredDuringInsert: false);
late final GeneratedColumn<String> primaryMuscles = GeneratedColumn<String>(
'primary_muscles', aliasedName, true,
type: DriftSqlType.string, requiredDuringInsert: false);
late final GeneratedColumn<String> secondaryMuscles = GeneratedColumn<String>(
'secondary_muscles', aliasedName, true,
type: DriftSqlType.string, requiredDuringInsert: false);
late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(
'created_at', aliasedName, false,
type: DriftSqlType.dateTime,
requiredDuringInsert: false,
defaultValue: Variable(DateTime.now()));
@override
List<GeneratedColumn> 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<GeneratedColumn> get $primaryKey => {id};
@override
ActivitiesData map(Map<String, dynamic> 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<ActivitiesData> {
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<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['id'] = Variable<int>(id);
map['title'] = Variable<String>(title);
if (!nullToAbsent || type != null) {
map['type'] = Variable<String>(type);
}
if (!nullToAbsent || description != null) {
map['body'] = Variable<String>(description);
}
if (!nullToAbsent || category != null) {
map['category'] = Variable<String>(category);
}
if (!nullToAbsent || force != null) {
map['force'] = Variable<String>(force);
}
if (!nullToAbsent || level != null) {
map['level'] = Variable<String>(level);
}
if (!nullToAbsent || mechanic != null) {
map['mechanic'] = Variable<String>(mechanic);
}
if (!nullToAbsent || equipment != null) {
map['equipment'] = Variable<String>(equipment);
}
if (!nullToAbsent || primaryMuscles != null) {
map['primary_muscles'] = Variable<String>(primaryMuscles);
}
if (!nullToAbsent || secondaryMuscles != null) {
map['secondary_muscles'] = Variable<String>(secondaryMuscles);
}
map['created_at'] = Variable<DateTime>(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<String, dynamic> json,
{ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return ActivitiesData(
id: serializer.fromJson<int>(json['id']),
title: serializer.fromJson<String>(json['title']),
type: serializer.fromJson<String?>(json['type']),
description: serializer.fromJson<String?>(json['description']),
category: serializer.fromJson<String?>(json['category']),
force: serializer.fromJson<String?>(json['force']),
level: serializer.fromJson<String?>(json['level']),
mechanic: serializer.fromJson<String?>(json['mechanic']),
equipment: serializer.fromJson<String?>(json['equipment']),
primaryMuscles: serializer.fromJson<String?>(json['primaryMuscles']),
secondaryMuscles: serializer.fromJson<String?>(json['secondaryMuscles']),
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'id': serializer.toJson<int>(id),
'title': serializer.toJson<String>(title),
'type': serializer.toJson<String?>(type),
'description': serializer.toJson<String?>(description),
'category': serializer.toJson<String?>(category),
'force': serializer.toJson<String?>(force),
'level': serializer.toJson<String?>(level),
'mechanic': serializer.toJson<String?>(mechanic),
'equipment': serializer.toJson<String?>(equipment),
'primaryMuscles': serializer.toJson<String?>(primaryMuscles),
'secondaryMuscles': serializer.toJson<String?>(secondaryMuscles),
'createdAt': serializer.toJson<DateTime>(createdAt),
};
}
ActivitiesData copyWith(
{int? id,
String? title,
Value<String?> type = const Value.absent(),
Value<String?> description = const Value.absent(),
Value<String?> category = const Value.absent(),
Value<String?> force = const Value.absent(),
Value<String?> level = const Value.absent(),
Value<String?> mechanic = const Value.absent(),
Value<String?> equipment = const Value.absent(),
Value<String?> primaryMuscles = const Value.absent(),
Value<String?> 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<ActivitiesData> {
final Value<int> id;
final Value<String> title;
final Value<String?> type;
final Value<String?> description;
final Value<String?> category;
final Value<String?> force;
final Value<String?> level;
final Value<String?> mechanic;
final Value<String?> equipment;
final Value<String?> primaryMuscles;
final Value<String?> secondaryMuscles;
final Value<DateTime> 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<ActivitiesData> custom({
Expression<int>? id,
Expression<String>? title,
Expression<String>? type,
Expression<String>? description,
Expression<String>? category,
Expression<String>? force,
Expression<String>? level,
Expression<String>? mechanic,
Expression<String>? equipment,
Expression<String>? primaryMuscles,
Expression<String>? secondaryMuscles,
Expression<DateTime>? 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<int>? id,
Value<String>? title,
Value<String?>? type,
Value<String?>? description,
Value<String?>? category,
Value<String?>? force,
Value<String?>? level,
Value<String?>? mechanic,
Value<String?>? equipment,
Value<String?>? primaryMuscles,
Value<String?>? secondaryMuscles,
Value<DateTime>? 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<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (id.present) {
map['id'] = Variable<int>(id.value);
}
if (title.present) {
map['title'] = Variable<String>(title.value);
}
if (type.present) {
map['type'] = Variable<String>(type.value);
}
if (description.present) {
map['body'] = Variable<String>(description.value);
}
if (category.present) {
map['category'] = Variable<String>(category.value);
}
if (force.present) {
map['force'] = Variable<String>(force.value);
}
if (level.present) {
map['level'] = Variable<String>(level.value);
}
if (mechanic.present) {
map['mechanic'] = Variable<String>(mechanic.value);
}
if (equipment.present) {
map['equipment'] = Variable<String>(equipment.value);
}
if (primaryMuscles.present) {
map['primary_muscles'] = Variable<String>(primaryMuscles.value);
}
if (secondaryMuscles.present) {
map['secondary_muscles'] = Variable<String>(secondaryMuscles.value);
}
if (createdAt.present) {
map['created_at'] = Variable<DateTime>(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<SessionActivities, SessionActivitiesData> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
SessionActivities(this.attachedDatabase, [this._alias]);
late final GeneratedColumn<int> id = GeneratedColumn<int>(
'id', aliasedName, false,
hasAutoIncrement: true,
type: DriftSqlType.int,
requiredDuringInsert: false,
defaultConstraints:
GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT'));
late final GeneratedColumn<int> sessionId = GeneratedColumn<int>(
'session_id', aliasedName, false,
type: DriftSqlType.int,
requiredDuringInsert: true,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'REFERENCES sessions (id) ON DELETE CASCADE'));
late final GeneratedColumn<int> activityId = GeneratedColumn<int>(
'activity_id', aliasedName, false,
type: DriftSqlType.int,
requiredDuringInsert: true,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'REFERENCES activities (id) ON DELETE CASCADE'));
late final GeneratedColumn<int> position = GeneratedColumn<int>(
'position', aliasedName, false,
type: DriftSqlType.int, requiredDuringInsert: true);
late final GeneratedColumn<String> results = GeneratedColumn<String>(
'results', aliasedName, true,
type: DriftSqlType.string, requiredDuringInsert: false);
late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(
'created_at', aliasedName, false,
type: DriftSqlType.dateTime,
requiredDuringInsert: false,
defaultValue: Variable(DateTime.now()));
@override
List<GeneratedColumn> 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<GeneratedColumn> get $primaryKey => {id};
@override
SessionActivitiesData map(Map<String, dynamic> 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<SessionActivitiesData> {
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<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['id'] = Variable<int>(id);
map['session_id'] = Variable<int>(sessionId);
map['activity_id'] = Variable<int>(activityId);
map['position'] = Variable<int>(position);
if (!nullToAbsent || results != null) {
map['results'] = Variable<String>(results);
}
map['created_at'] = Variable<DateTime>(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<String, dynamic> json,
{ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return SessionActivitiesData(
id: serializer.fromJson<int>(json['id']),
sessionId: serializer.fromJson<int>(json['sessionId']),
activityId: serializer.fromJson<int>(json['activityId']),
position: serializer.fromJson<int>(json['position']),
results: serializer.fromJson<String?>(json['results']),
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'id': serializer.toJson<int>(id),
'sessionId': serializer.toJson<int>(sessionId),
'activityId': serializer.toJson<int>(activityId),
'position': serializer.toJson<int>(position),
'results': serializer.toJson<String?>(results),
'createdAt': serializer.toJson<DateTime>(createdAt),
};
}
SessionActivitiesData copyWith(
{int? id,
int? sessionId,
int? activityId,
int? position,
Value<String?> 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<SessionActivitiesData> {
final Value<int> id;
final Value<int> sessionId;
final Value<int> activityId;
final Value<int> position;
final Value<String?> results;
final Value<DateTime> 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<SessionActivitiesData> custom({
Expression<int>? id,
Expression<int>? sessionId,
Expression<int>? activityId,
Expression<int>? position,
Expression<String>? results,
Expression<DateTime>? 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<int>? id,
Value<int>? sessionId,
Value<int>? activityId,
Value<int>? position,
Value<String?>? results,
Value<DateTime>? 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<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (id.present) {
map['id'] = Variable<int>(id.value);
}
if (sessionId.present) {
map['session_id'] = Variable<int>(sessionId.value);
}
if (activityId.present) {
map['activity_id'] = Variable<int>(activityId.value);
}
if (position.present) {
map['position'] = Variable<int>(position.value);
}
if (results.present) {
map['results'] = Variable<String>(results.value);
}
if (createdAt.present) {
map['created_at'] = Variable<DateTime>(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<Actions, ActionsData> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
Actions(this.attachedDatabase, [this._alias]);
late final GeneratedColumn<int> id = GeneratedColumn<int>(
'id', aliasedName, false,
hasAutoIncrement: true,
type: DriftSqlType.int,
requiredDuringInsert: false,
defaultConstraints:
GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT'));
late final GeneratedColumn<String> title = GeneratedColumn<String>(
'title', aliasedName, false,
additionalChecks:
GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 64),
type: DriftSqlType.string,
requiredDuringInsert: true);
late final GeneratedColumn<String> description = GeneratedColumn<String>(
'body', aliasedName, false,
type: DriftSqlType.string, requiredDuringInsert: true);
late final GeneratedColumn<int> totalSets = GeneratedColumn<int>(
'total_sets', aliasedName, false,
type: DriftSqlType.int, requiredDuringInsert: true);
late final GeneratedColumn<String> totalReps = GeneratedColumn<String>(
'total_reps', aliasedName, false,
additionalChecks:
GeneratedColumn.checkTextLength(minTextLength: 1, maxTextLength: 32),
type: DriftSqlType.string,
requiredDuringInsert: true);
late final GeneratedColumn<int> restBeforeSets = GeneratedColumn<int>(
'rest_before_sets', aliasedName, true,
type: DriftSqlType.int, requiredDuringInsert: false);
late final GeneratedColumn<int> restBetweenSets = GeneratedColumn<int>(
'rest_between_sets', aliasedName, true,
type: DriftSqlType.int, requiredDuringInsert: false);
late final GeneratedColumn<int> restBetweenReps = GeneratedColumn<int>(
'rest_between_reps', aliasedName, true,
type: DriftSqlType.int, requiredDuringInsert: false);
late final GeneratedColumn<int> restAfterSets = GeneratedColumn<int>(
'rest_after_sets', aliasedName, true,
type: DriftSqlType.int, requiredDuringInsert: false);
late final GeneratedColumn<String> repType = GeneratedColumn<String>(
'rep_type', aliasedName, false,
type: DriftSqlType.string, requiredDuringInsert: true);
late final GeneratedColumn<int> repLength = GeneratedColumn<int>(
'rep_length', aliasedName, true,
type: DriftSqlType.int, requiredDuringInsert: false);
late final GeneratedColumn<String> repWeights = GeneratedColumn<String>(
'rep_weights', aliasedName, true,
type: DriftSqlType.string, requiredDuringInsert: false);
late final GeneratedColumn<String> setWeights = GeneratedColumn<String>(
'set_weights', aliasedName, true,
type: DriftSqlType.string, requiredDuringInsert: false);
late final GeneratedColumn<bool> isAlternating = GeneratedColumn<bool>(
'is_alternating', aliasedName, false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'CHECK ("is_alternating" IN (0, 1))'),
defaultValue: Variable(false));
late final GeneratedColumn<String> tempo = GeneratedColumn<String>(
'tempo', aliasedName, true,
additionalChecks:
GeneratedColumn.checkTextLength(minTextLength: 6, maxTextLength: 36),
type: DriftSqlType.string,
requiredDuringInsert: false);
late final GeneratedColumn<String> status = GeneratedColumn<String>(
'status', aliasedName, false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: Variable('pending'));
late final GeneratedColumn<String> state = GeneratedColumn<String>(
'state', aliasedName, false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: Variable(
"{\"currentSet\": 1, \"currentRep\": 1, \"currentTime\": 0, \"currentAction\": 0}"));
late final GeneratedColumn<String> set = GeneratedColumn<String>(
'set', aliasedName, false,
type: DriftSqlType.string, requiredDuringInsert: true);
late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(
'created_at', aliasedName, false,
type: DriftSqlType.dateTime,
requiredDuringInsert: false,
defaultValue: Variable(DateTime.now()));
@override
List<GeneratedColumn> 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<GeneratedColumn> get $primaryKey => {id};
@override
ActionsData map(Map<String, dynamic> 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<ActionsData> {
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<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['id'] = Variable<int>(id);
map['title'] = Variable<String>(title);
map['body'] = Variable<String>(description);
map['total_sets'] = Variable<int>(totalSets);
map['total_reps'] = Variable<String>(totalReps);
if (!nullToAbsent || restBeforeSets != null) {
map['rest_before_sets'] = Variable<int>(restBeforeSets);
}
if (!nullToAbsent || restBetweenSets != null) {
map['rest_between_sets'] = Variable<int>(restBetweenSets);
}
if (!nullToAbsent || restBetweenReps != null) {
map['rest_between_reps'] = Variable<int>(restBetweenReps);
}
if (!nullToAbsent || restAfterSets != null) {
map['rest_after_sets'] = Variable<int>(restAfterSets);
}
map['rep_type'] = Variable<String>(repType);
if (!nullToAbsent || repLength != null) {
map['rep_length'] = Variable<int>(repLength);
}
if (!nullToAbsent || repWeights != null) {
map['rep_weights'] = Variable<String>(repWeights);
}
if (!nullToAbsent || setWeights != null) {
map['set_weights'] = Variable<String>(setWeights);
}
map['is_alternating'] = Variable<bool>(isAlternating);
if (!nullToAbsent || tempo != null) {
map['tempo'] = Variable<String>(tempo);
}
map['status'] = Variable<String>(status);
map['state'] = Variable<String>(state);
map['set'] = Variable<String>(set);
map['created_at'] = Variable<DateTime>(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<String, dynamic> json,
{ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return ActionsData(
id: serializer.fromJson<int>(json['id']),
title: serializer.fromJson<String>(json['title']),
description: serializer.fromJson<String>(json['description']),
totalSets: serializer.fromJson<int>(json['totalSets']),
totalReps: serializer.fromJson<String>(json['totalReps']),
restBeforeSets: serializer.fromJson<int?>(json['restBeforeSets']),
restBetweenSets: serializer.fromJson<int?>(json['restBetweenSets']),
restBetweenReps: serializer.fromJson<int?>(json['restBetweenReps']),
restAfterSets: serializer.fromJson<int?>(json['restAfterSets']),
repType: serializer.fromJson<String>(json['repType']),
repLength: serializer.fromJson<int?>(json['repLength']),
repWeights: serializer.fromJson<String?>(json['repWeights']),
setWeights: serializer.fromJson<String?>(json['setWeights']),
isAlternating: serializer.fromJson<bool>(json['isAlternating']),
tempo: serializer.fromJson<String?>(json['tempo']),
status: serializer.fromJson<String>(json['status']),
state: serializer.fromJson<String>(json['state']),
set: serializer.fromJson<String>(json['set']),
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'id': serializer.toJson<int>(id),
'title': serializer.toJson<String>(title),
'description': serializer.toJson<String>(description),
'totalSets': serializer.toJson<int>(totalSets),
'totalReps': serializer.toJson<String>(totalReps),
'restBeforeSets': serializer.toJson<int?>(restBeforeSets),
'restBetweenSets': serializer.toJson<int?>(restBetweenSets),
'restBetweenReps': serializer.toJson<int?>(restBetweenReps),
'restAfterSets': serializer.toJson<int?>(restAfterSets),
'repType': serializer.toJson<String>(repType),
'repLength': serializer.toJson<int?>(repLength),
'repWeights': serializer.toJson<String?>(repWeights),
'setWeights': serializer.toJson<String?>(setWeights),
'isAlternating': serializer.toJson<bool>(isAlternating),
'tempo': serializer.toJson<String?>(tempo),
'status': serializer.toJson<String>(status),
'state': serializer.toJson<String>(state),
'set': serializer.toJson<String>(set),
'createdAt': serializer.toJson<DateTime>(createdAt),
};
}
ActionsData copyWith(
{int? id,
String? title,
String? description,
int? totalSets,
String? totalReps,
Value<int?> restBeforeSets = const Value.absent(),
Value<int?> restBetweenSets = const Value.absent(),
Value<int?> restBetweenReps = const Value.absent(),
Value<int?> restAfterSets = const Value.absent(),
String? repType,
Value<int?> repLength = const Value.absent(),
Value<String?> repWeights = const Value.absent(),
Value<String?> setWeights = const Value.absent(),
bool? isAlternating,
Value<String?> 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<ActionsData> {
final Value<int> id;
final Value<String> title;
final Value<String> description;
final Value<int> totalSets;
final Value<String> totalReps;
final Value<int?> restBeforeSets;
final Value<int?> restBetweenSets;
final Value<int?> restBetweenReps;
final Value<int?> restAfterSets;
final Value<String> repType;
final Value<int?> repLength;
final Value<String?> repWeights;
final Value<String?> setWeights;
final Value<bool> isAlternating;
final Value<String?> tempo;
final Value<String> status;
final Value<String> state;
final Value<String> set;
final Value<DateTime> 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<ActionsData> custom({
Expression<int>? id,
Expression<String>? title,
Expression<String>? description,
Expression<int>? totalSets,
Expression<String>? totalReps,
Expression<int>? restBeforeSets,
Expression<int>? restBetweenSets,
Expression<int>? restBetweenReps,
Expression<int>? restAfterSets,
Expression<String>? repType,
Expression<int>? repLength,
Expression<String>? repWeights,
Expression<String>? setWeights,
Expression<bool>? isAlternating,
Expression<String>? tempo,
Expression<String>? status,
Expression<String>? state,
Expression<String>? set,
Expression<DateTime>? 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<int>? id,
Value<String>? title,
Value<String>? description,
Value<int>? totalSets,
Value<String>? totalReps,
Value<int?>? restBeforeSets,
Value<int?>? restBetweenSets,
Value<int?>? restBetweenReps,
Value<int?>? restAfterSets,
Value<String>? repType,
Value<int?>? repLength,
Value<String?>? repWeights,
Value<String?>? setWeights,
Value<bool>? isAlternating,
Value<String?>? tempo,
Value<String>? status,
Value<String>? state,
Value<String>? set,
Value<DateTime>? 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<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (id.present) {
map['id'] = Variable<int>(id.value);
}
if (title.present) {
map['title'] = Variable<String>(title.value);
}
if (description.present) {
map['body'] = Variable<String>(description.value);
}
if (totalSets.present) {
map['total_sets'] = Variable<int>(totalSets.value);
}
if (totalReps.present) {
map['total_reps'] = Variable<String>(totalReps.value);
}
if (restBeforeSets.present) {
map['rest_before_sets'] = Variable<int>(restBeforeSets.value);
}
if (restBetweenSets.present) {
map['rest_between_sets'] = Variable<int>(restBetweenSets.value);
}
if (restBetweenReps.present) {
map['rest_between_reps'] = Variable<int>(restBetweenReps.value);
}
if (restAfterSets.present) {
map['rest_after_sets'] = Variable<int>(restAfterSets.value);
}
if (repType.present) {
map['rep_type'] = Variable<String>(repType.value);
}
if (repLength.present) {
map['rep_length'] = Variable<int>(repLength.value);
}
if (repWeights.present) {
map['rep_weights'] = Variable<String>(repWeights.value);
}
if (setWeights.present) {
map['set_weights'] = Variable<String>(setWeights.value);
}
if (isAlternating.present) {
map['is_alternating'] = Variable<bool>(isAlternating.value);
}
if (tempo.present) {
map['tempo'] = Variable<String>(tempo.value);
}
if (status.present) {
map['status'] = Variable<String>(status.value);
}
if (state.present) {
map['state'] = Variable<String>(state.value);
}
if (set.present) {
map['set'] = Variable<String>(set.value);
}
if (createdAt.present) {
map['created_at'] = Variable<DateTime>(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<ActivityActions, ActivityActionsData> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
ActivityActions(this.attachedDatabase, [this._alias]);
late final GeneratedColumn<int> id = GeneratedColumn<int>(
'id', aliasedName, false,
hasAutoIncrement: true,
type: DriftSqlType.int,
requiredDuringInsert: false,
defaultConstraints:
GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT'));
late final GeneratedColumn<int> activityId = GeneratedColumn<int>(
'activity_id', aliasedName, false,
type: DriftSqlType.int,
requiredDuringInsert: true,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'REFERENCES activities (id) ON DELETE CASCADE'));
late final GeneratedColumn<int> actionId = GeneratedColumn<int>(
'action_id', aliasedName, false,
type: DriftSqlType.int,
requiredDuringInsert: true,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'REFERENCES actions (id) ON DELETE CASCADE'));
late final GeneratedColumn<int> position = GeneratedColumn<int>(
'position', aliasedName, false,
type: DriftSqlType.int, requiredDuringInsert: true);
late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(
'created_at', aliasedName, false,
type: DriftSqlType.dateTime,
requiredDuringInsert: false,
defaultValue: Variable(DateTime.now()));
@override
List<GeneratedColumn> 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<GeneratedColumn> get $primaryKey => {id};
@override
ActivityActionsData map(Map<String, dynamic> 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<ActivityActionsData> {
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<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['id'] = Variable<int>(id);
map['activity_id'] = Variable<int>(activityId);
map['action_id'] = Variable<int>(actionId);
map['position'] = Variable<int>(position);
map['created_at'] = Variable<DateTime>(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<String, dynamic> json,
{ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return ActivityActionsData(
id: serializer.fromJson<int>(json['id']),
activityId: serializer.fromJson<int>(json['activityId']),
actionId: serializer.fromJson<int>(json['actionId']),
position: serializer.fromJson<int>(json['position']),
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'id': serializer.toJson<int>(id),
'activityId': serializer.toJson<int>(activityId),
'actionId': serializer.toJson<int>(actionId),
'position': serializer.toJson<int>(position),
'createdAt': serializer.toJson<DateTime>(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<ActivityActionsData> {
final Value<int> id;
final Value<int> activityId;
final Value<int> actionId;
final Value<int> position;
final Value<DateTime> 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<ActivityActionsData> custom({
Expression<int>? id,
Expression<int>? activityId,
Expression<int>? actionId,
Expression<int>? position,
Expression<DateTime>? 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<int>? id,
Value<int>? activityId,
Value<int>? actionId,
Value<int>? position,
Value<DateTime>? 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<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (id.present) {
map['id'] = Variable<int>(id.value);
}
if (activityId.present) {
map['activity_id'] = Variable<int>(activityId.value);
}
if (actionId.present) {
map['action_id'] = Variable<int>(actionId.value);
}
if (position.present) {
map['position'] = Variable<int>(position.value);
}
if (createdAt.present) {
map['created_at'] = Variable<DateTime>(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<MediaItems, MediaItemsData> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
MediaItems(this.attachedDatabase, [this._alias]);
late final GeneratedColumn<int> id = GeneratedColumn<int>(
'id', aliasedName, false,
hasAutoIncrement: true,
type: DriftSqlType.int,
requiredDuringInsert: false,
defaultConstraints:
GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT'));
late final GeneratedColumn<String> title = GeneratedColumn<String>(
'title', aliasedName, false,
additionalChecks:
GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 64),
type: DriftSqlType.string,
requiredDuringInsert: true);
late final GeneratedColumn<String> description = GeneratedColumn<String>(
'body', aliasedName, false,
type: DriftSqlType.string, requiredDuringInsert: true);
late final GeneratedColumn<String> reference = GeneratedColumn<String>(
'reference', aliasedName, false,
type: DriftSqlType.string, requiredDuringInsert: true);
late final GeneratedColumn<String> type = GeneratedColumn<String>(
'type', aliasedName, false,
type: DriftSqlType.string, requiredDuringInsert: true);
late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(
'created_at', aliasedName, false,
type: DriftSqlType.dateTime,
requiredDuringInsert: false,
defaultValue: Variable(DateTime.now()));
@override
List<GeneratedColumn> 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<GeneratedColumn> get $primaryKey => {id};
@override
MediaItemsData map(Map<String, dynamic> 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<MediaItemsData> {
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<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['id'] = Variable<int>(id);
map['title'] = Variable<String>(title);
map['body'] = Variable<String>(description);
map['reference'] = Variable<String>(reference);
map['type'] = Variable<String>(type);
map['created_at'] = Variable<DateTime>(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<String, dynamic> json,
{ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return MediaItemsData(
id: serializer.fromJson<int>(json['id']),
title: serializer.fromJson<String>(json['title']),
description: serializer.fromJson<String>(json['description']),
reference: serializer.fromJson<String>(json['reference']),
type: serializer.fromJson<String>(json['type']),
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'id': serializer.toJson<int>(id),
'title': serializer.toJson<String>(title),
'description': serializer.toJson<String>(description),
'reference': serializer.toJson<String>(reference),
'type': serializer.toJson<String>(type),
'createdAt': serializer.toJson<DateTime>(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<MediaItemsData> {
final Value<int> id;
final Value<String> title;
final Value<String> description;
final Value<String> reference;
final Value<String> type;
final Value<DateTime> 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<MediaItemsData> custom({
Expression<int>? id,
Expression<String>? title,
Expression<String>? description,
Expression<String>? reference,
Expression<String>? type,
Expression<DateTime>? 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<int>? id,
Value<String>? title,
Value<String>? description,
Value<String>? reference,
Value<String>? type,
Value<DateTime>? 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<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (id.present) {
map['id'] = Variable<int>(id.value);
}
if (title.present) {
map['title'] = Variable<String>(title.value);
}
if (description.present) {
map['body'] = Variable<String>(description.value);
}
if (reference.present) {
map['reference'] = Variable<String>(reference.value);
}
if (type.present) {
map['type'] = Variable<String>(type.value);
}
if (createdAt.present) {
map['created_at'] = Variable<DateTime>(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<ObjectMediaItems, ObjectMediaItemsData> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
ObjectMediaItems(this.attachedDatabase, [this._alias]);
late final GeneratedColumn<int> id = GeneratedColumn<int>(
'id', aliasedName, false,
hasAutoIncrement: true,
type: DriftSqlType.int,
requiredDuringInsert: false,
defaultConstraints:
GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT'));
late final GeneratedColumn<int> objectId = GeneratedColumn<int>(
'object_id', aliasedName, false,
type: DriftSqlType.int, requiredDuringInsert: true);
late final GeneratedColumn<String> objectType = GeneratedColumn<String>(
'object_type', aliasedName, false,
type: DriftSqlType.string, requiredDuringInsert: true);
late final GeneratedColumn<int> mediaId = GeneratedColumn<int>(
'media_id', aliasedName, false,
type: DriftSqlType.int,
requiredDuringInsert: true,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'REFERENCES media_items (id) ON DELETE CASCADE'));
late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(
'created_at', aliasedName, false,
type: DriftSqlType.dateTime,
requiredDuringInsert: false,
defaultValue: Variable(DateTime.now()));
@override
List<GeneratedColumn> 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<GeneratedColumn> get $primaryKey => {id};
@override
ObjectMediaItemsData map(Map<String, dynamic> 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<ObjectMediaItemsData> {
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<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['id'] = Variable<int>(id);
map['object_id'] = Variable<int>(objectId);
map['object_type'] = Variable<String>(objectType);
map['media_id'] = Variable<int>(mediaId);
map['created_at'] = Variable<DateTime>(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<String, dynamic> json,
{ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return ObjectMediaItemsData(
id: serializer.fromJson<int>(json['id']),
objectId: serializer.fromJson<int>(json['objectId']),
objectType: serializer.fromJson<String>(json['objectType']),
mediaId: serializer.fromJson<int>(json['mediaId']),
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'id': serializer.toJson<int>(id),
'objectId': serializer.toJson<int>(objectId),
'objectType': serializer.toJson<String>(objectType),
'mediaId': serializer.toJson<int>(mediaId),
'createdAt': serializer.toJson<DateTime>(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<ObjectMediaItemsData> {
final Value<int> id;
final Value<int> objectId;
final Value<String> objectType;
final Value<int> mediaId;
final Value<DateTime> 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<ObjectMediaItemsData> custom({
Expression<int>? id,
Expression<int>? objectId,
Expression<String>? objectType,
Expression<int>? mediaId,
Expression<DateTime>? 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<int>? id,
Value<int>? objectId,
Value<String>? objectType,
Value<int>? mediaId,
Value<DateTime>? 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<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (id.present) {
map['id'] = Variable<int>(id.value);
}
if (objectId.present) {
map['object_id'] = Variable<int>(objectId.value);
}
if (objectType.present) {
map['object_type'] = Variable<String>(objectType.value);
}
if (mediaId.present) {
map['media_id'] = Variable<int>(mediaId.value);
}
if (createdAt.present) {
map['created_at'] = Variable<DateTime>(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<TableInfo<Table, Object?>> get allTables =>
allSchemaEntities.whereType<TableInfo<Table, Object?>>();
@override
List<DatabaseSchemaEntity> get allSchemaEntities => [
sessions,
activities,
sessionActivities,
actions,
activityActions,
mediaItems,
objectMediaItems
];
@override
int get schemaVersion => 32;
}