mirror of https://github.com/AMT-Cheif/drift.git
Fix tests
This commit is contained in:
parent
cf8d2618fa
commit
22d5f0a8ae
|
@ -11,7 +11,7 @@ class DriftProtocol {
|
||||||
static const _tag_Response_error = 2;
|
static const _tag_Response_error = 2;
|
||||||
static const _tag_Response_cancelled = 3;
|
static const _tag_Response_cancelled = 3;
|
||||||
|
|
||||||
static const _tag_NoArgsRequest_terminateAll = 1;
|
static const _tag_NoArgsRequest_terminateAll = 0;
|
||||||
|
|
||||||
static const _tag_ExecuteQuery = 3;
|
static const _tag_ExecuteQuery = 3;
|
||||||
static const _tag_ExecuteBatchedStatement = 4;
|
static const _tag_ExecuteBatchedStatement = 4;
|
||||||
|
|
|
@ -48,10 +48,10 @@ class GeneratedColumn<T extends Object> extends Column<T> {
|
||||||
/// [defaultValue] and [clientDefault] are non-null.
|
/// [defaultValue] and [clientDefault] are non-null.
|
||||||
///
|
///
|
||||||
/// See also: [BuildColumn.clientDefault].
|
/// See also: [BuildColumn.clientDefault].
|
||||||
final T Function()? clientDefault;
|
final T? Function()? clientDefault;
|
||||||
|
|
||||||
/// Additional checks performed on values before inserts or updates.
|
/// Additional checks performed on values before inserts or updates.
|
||||||
final VerificationResult Function(T, VerificationMeta)? additionalChecks;
|
final VerificationResult Function(T?, VerificationMeta)? additionalChecks;
|
||||||
|
|
||||||
/// The sql type to use for this column.
|
/// The sql type to use for this column.
|
||||||
final DriftSqlType<T> type;
|
final DriftSqlType<T> type;
|
||||||
|
@ -91,7 +91,7 @@ class GeneratedColumn<T extends Object> extends Column<T> {
|
||||||
///
|
///
|
||||||
/// This is mainly used by the generator.
|
/// This is mainly used by the generator.
|
||||||
GeneratedColumnWithTypeConverter<D, T> withConverter<D>(
|
GeneratedColumnWithTypeConverter<D, T> withConverter<D>(
|
||||||
TypeConverter<D, T> converter) {
|
TypeConverter<D, T?> converter) {
|
||||||
return GeneratedColumnWithTypeConverter._(
|
return GeneratedColumnWithTypeConverter._(
|
||||||
converter,
|
converter,
|
||||||
$name,
|
$name,
|
||||||
|
@ -186,12 +186,12 @@ class GeneratedColumn<T extends Object> extends Column<T> {
|
||||||
/// implementation only checks for nullability, but subclasses might enforce
|
/// implementation only checks for nullability, but subclasses might enforce
|
||||||
/// additional checks. For instance, a text column might verify that a text
|
/// additional checks. For instance, a text column might verify that a text
|
||||||
/// has a certain length.
|
/// has a certain length.
|
||||||
VerificationResult isAcceptableValue(T value, VerificationMeta meta) {
|
VerificationResult isAcceptableValue(T? value, VerificationMeta meta) {
|
||||||
final nullOk = $nullable;
|
final nullOk = $nullable;
|
||||||
if (!nullOk && value == null) {
|
if (!nullOk && value == null) {
|
||||||
return _invalidNull;
|
return _invalidNull;
|
||||||
} else {
|
} else {
|
||||||
return additionalChecks?.call(value, meta) ??
|
return additionalChecks?.call(value!, meta) ??
|
||||||
const VerificationResult.success();
|
const VerificationResult.success();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -204,7 +204,7 @@ class GeneratedColumn<T extends Object> extends Column<T> {
|
||||||
VerificationResult isAcceptableOrUnknown(
|
VerificationResult isAcceptableOrUnknown(
|
||||||
Expression value, VerificationMeta meta) {
|
Expression value, VerificationMeta meta) {
|
||||||
if (value is Variable) {
|
if (value is Variable) {
|
||||||
return isAcceptableValue(value.value as T, meta);
|
return isAcceptableValue(value.value as T?, meta);
|
||||||
} else {
|
} else {
|
||||||
return const VerificationResult.success();
|
return const VerificationResult.success();
|
||||||
}
|
}
|
||||||
|
@ -256,19 +256,19 @@ class GeneratedColumn<T extends Object> extends Column<T> {
|
||||||
class GeneratedColumnWithTypeConverter<D, S extends Object>
|
class GeneratedColumnWithTypeConverter<D, S extends Object>
|
||||||
extends GeneratedColumn<S> {
|
extends GeneratedColumn<S> {
|
||||||
/// The type converted used on this column.
|
/// The type converted used on this column.
|
||||||
final TypeConverter<D?, S?> converter;
|
final TypeConverter<D, S?> converter;
|
||||||
|
|
||||||
GeneratedColumnWithTypeConverter._(
|
GeneratedColumnWithTypeConverter._(
|
||||||
this.converter,
|
this.converter,
|
||||||
String name,
|
String name,
|
||||||
String tableName,
|
String tableName,
|
||||||
bool nullable,
|
bool nullable,
|
||||||
S Function()? clientDefault,
|
S? Function()? clientDefault,
|
||||||
DriftSqlType<S> type,
|
DriftSqlType<S> type,
|
||||||
String? defaultConstraints,
|
String? defaultConstraints,
|
||||||
String? customConstraints,
|
String? customConstraints,
|
||||||
Expression<S>? defaultValue,
|
Expression<S>? defaultValue,
|
||||||
VerificationResult Function(S, VerificationMeta)? additionalChecks,
|
VerificationResult Function(S?, VerificationMeta)? additionalChecks,
|
||||||
bool requiredDuringInsert,
|
bool requiredDuringInsert,
|
||||||
GeneratedAs? generatedAs,
|
GeneratedAs? generatedAs,
|
||||||
Expression<bool> Function()? check,
|
Expression<bool> Function()? check,
|
||||||
|
@ -296,7 +296,7 @@ class GeneratedColumnWithTypeConverter<D, S extends Object>
|
||||||
if ($nullable) {
|
if ($nullable) {
|
||||||
// For nullable columns, the type converter needs to accept null values.
|
// For nullable columns, the type converter needs to accept null values.
|
||||||
// ignore: unnecessary_cast, https://github.com/dart-lang/sdk/issues/34150
|
// ignore: unnecessary_cast, https://github.com/dart-lang/sdk/issues/34150
|
||||||
mappedValue = (converter as TypeConverter<D?, S>).toSql(dartValue);
|
mappedValue = (converter as TypeConverter<D?, S?>).toSql(dartValue);
|
||||||
} else {
|
} else {
|
||||||
if (dartValue == null) {
|
if (dartValue == null) {
|
||||||
throw ArgumentError(
|
throw ArgumentError(
|
||||||
|
|
|
@ -185,7 +185,7 @@ class TypedResult {
|
||||||
/// To access the underlying columns directly, use [rawData].
|
/// To access the underlying columns directly, use [rawData].
|
||||||
D? read<D extends Object>(Expression<D> expr) {
|
D? read<D extends Object>(Expression<D> expr) {
|
||||||
if (_parsedExpressions.containsKey(expr)) {
|
if (_parsedExpressions.containsKey(expr)) {
|
||||||
return _parsedExpressions[expr] as D;
|
return _parsedExpressions[expr] as D?;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw ArgumentError(
|
throw ArgumentError(
|
||||||
|
|
|
@ -157,9 +157,9 @@ enum DriftSqlType<T extends Object> {
|
||||||
return dialect == SqlDialect.sqlite ? 'INTEGER' : 'bigint';
|
return dialect == SqlDialect.sqlite ? 'INTEGER' : 'bigint';
|
||||||
case DriftSqlType.dateTime:
|
case DriftSqlType.dateTime:
|
||||||
if (context.options.types._storeDateTimesAsText) {
|
if (context.options.types._storeDateTimesAsText) {
|
||||||
return dialect == SqlDialect.sqlite ? 'INTEGER' : 'bigint';
|
|
||||||
} else {
|
|
||||||
return dialect == SqlDialect.sqlite ? 'TEXT' : 'text';
|
return dialect == SqlDialect.sqlite ? 'TEXT' : 'text';
|
||||||
|
} else {
|
||||||
|
return dialect == SqlDialect.sqlite ? 'INTEGER' : 'bigint';
|
||||||
}
|
}
|
||||||
case DriftSqlType.blob:
|
case DriftSqlType.blob:
|
||||||
return dialect == SqlDialect.sqlite ? 'BLOB' : 'bytea';
|
return dialect == SqlDialect.sqlite ? 'BLOB' : 'bytea';
|
||||||
|
|
|
@ -28,6 +28,6 @@ void main() {
|
||||||
final dataString = data.join();
|
final dataString = data.join();
|
||||||
final dataInt = data.map((e) => e.codeUnits[0]).toList();
|
final dataInt = data.map((e) => e.codeUnits[0]).toList();
|
||||||
final dataUint8 = Uint8List.fromList(dataInt);
|
final dataUint8 = Uint8List.fromList(dataInt);
|
||||||
expect(types.read(DriftSqlType.string, dataString), dataUint8);
|
expect(types.read(DriftSqlType.blob, dataString), dataUint8);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1673,7 +1673,7 @@ abstract class _$CustomTablesDb extends GeneratedDatabase {
|
||||||
return JsonResult(
|
return JsonResult(
|
||||||
row: row,
|
row: row,
|
||||||
key: row.read<String>('key'),
|
key: row.read<String>('key'),
|
||||||
value: row.read<String?>('value'),
|
value: row.readNullable<String>('value'),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1686,7 +1686,7 @@ abstract class _$CustomTablesDb extends GeneratedDatabase {
|
||||||
return JsonResult(
|
return JsonResult(
|
||||||
row: row,
|
row: row,
|
||||||
key: row.read<String>('key'),
|
key: row.read<String>('key'),
|
||||||
value: row.read<String?>('value'),
|
value: row.readNullable<String>('value'),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1713,8 +1713,8 @@ abstract class _$CustomTablesDb extends GeneratedDatabase {
|
||||||
}).map((QueryRow row) {
|
}).map((QueryRow row) {
|
||||||
return MultipleResult(
|
return MultipleResult(
|
||||||
row: row,
|
row: row,
|
||||||
a: row.read<String?>('a'),
|
a: row.readNullable<String>('a'),
|
||||||
b: row.read<int?>('b'),
|
b: row.readNullable<int>('b'),
|
||||||
c: withConstraints.mapFromRowOrNull(row, tablePrefix: 'nested_0'),
|
c: withConstraints.mapFromRowOrNull(row, tablePrefix: 'nested_0'),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -1750,11 +1750,11 @@ abstract class _$CustomTablesDb extends GeneratedDatabase {
|
||||||
row: row,
|
row: row,
|
||||||
rowid: row.read<int>('rowid'),
|
rowid: row.read<int>('rowid'),
|
||||||
configKey: row.read<String>('config_key'),
|
configKey: row.read<String>('config_key'),
|
||||||
configValue: row.read<String?>('config_value'),
|
configValue: row.readNullable<String>('config_value'),
|
||||||
syncState: NullAwareTypeConverter.wrapFromSql(
|
syncState: NullAwareTypeConverter.wrapFromSql(
|
||||||
ConfigTable.$converter0, row.read<int?>('sync_state')),
|
ConfigTable.$converter0, row.readNullable<int>('sync_state')),
|
||||||
syncStateImplicit: ConfigTable.$converter1
|
syncStateImplicit: ConfigTable.$converter1
|
||||||
.fromSql(row.read<int?>('sync_state_implicit')),
|
.fromSql(row.readNullable<int>('sync_state_implicit')),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1777,7 +1777,7 @@ abstract class _$CustomTablesDb extends GeneratedDatabase {
|
||||||
variables: [],
|
variables: [],
|
||||||
readsFrom: {
|
readsFrom: {
|
||||||
config,
|
config,
|
||||||
}).map((QueryRow row) => row.read<int?>('_c0'));
|
}).map((QueryRow row) => row.readNullable<int>('_c0'));
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<Config>> addConfig({required Insertable<Config> value}) {
|
Future<List<Config>> addConfig({required Insertable<Config> value}) {
|
||||||
|
|
|
@ -1613,10 +1613,10 @@ abstract class _$TodoDb extends GeneratedDatabase {
|
||||||
return AllTodosWithCategoryResult(
|
return AllTodosWithCategoryResult(
|
||||||
row: row,
|
row: row,
|
||||||
id: row.read<int>('id'),
|
id: row.read<int>('id'),
|
||||||
title: row.read<String?>('title'),
|
title: row.readNullable<String>('title'),
|
||||||
content: row.read<String>('content'),
|
content: row.read<String>('content'),
|
||||||
targetDate: row.read<DateTime?>('target_date'),
|
targetDate: row.readNullable<DateTime>('target_date'),
|
||||||
category: row.read<int?>('category'),
|
category: row.readNullable<int>('category'),
|
||||||
catId: row.read<int>('catId'),
|
catId: row.read<int>('catId'),
|
||||||
catDesc: row.read<String>('catDesc'),
|
catDesc: row.read<String>('catDesc'),
|
||||||
);
|
);
|
||||||
|
|
|
@ -8,10 +8,13 @@ export 'matchers.dart';
|
||||||
export 'mocks.dart';
|
export 'mocks.dart';
|
||||||
|
|
||||||
GenerationContext stubContext({DriftDatabaseOptions? options}) {
|
GenerationContext stubContext({DriftDatabaseOptions? options}) {
|
||||||
return GenerationContext(options ?? DriftDatabaseOptions(), _NullDatabase());
|
return GenerationContext(
|
||||||
|
options ?? DriftDatabaseOptions(), _NullDatabase.instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
class _NullDatabase extends GeneratedDatabase {
|
class _NullDatabase extends GeneratedDatabase {
|
||||||
|
static final instance = _NullDatabase();
|
||||||
|
|
||||||
_NullDatabase() : super(_NullExecutor());
|
_NullDatabase() : super(_NullExecutor());
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -22,4 +25,7 @@ class _NullDatabase extends GeneratedDatabase {
|
||||||
int get schemaVersion => throw UnsupportedError('stub!');
|
int get schemaVersion => throw UnsupportedError('stub!');
|
||||||
}
|
}
|
||||||
|
|
||||||
class _NullExecutor extends Fake implements QueryExecutor {}
|
class _NullExecutor extends Fake implements QueryExecutor {
|
||||||
|
@override
|
||||||
|
SqlDialect get dialect => SqlDialect.sqlite;
|
||||||
|
}
|
||||||
|
|
|
@ -160,15 +160,12 @@ class QueryWriter {
|
||||||
/// suitable type.
|
/// suitable type.
|
||||||
String readingCode(ResultColumn column, GenerationOptions generationOptions,
|
String readingCode(ResultColumn column, GenerationOptions generationOptions,
|
||||||
DriftOptions moorOptions) {
|
DriftOptions moorOptions) {
|
||||||
var rawDartType = dartTypeNames[column.type];
|
|
||||||
if (column.nullable) {
|
|
||||||
rawDartType = '$rawDartType?';
|
|
||||||
}
|
|
||||||
|
|
||||||
final specialName = _transformer.newNameFor(column.sqlParserColumn!);
|
final specialName = _transformer.newNameFor(column.sqlParserColumn!);
|
||||||
|
|
||||||
final dartLiteral = asDartLiteral(specialName ?? column.name);
|
final dartLiteral = asDartLiteral(specialName ?? column.name);
|
||||||
var code = 'row.read<$rawDartType>($dartLiteral)';
|
final method = column.nullable ? 'readNullable' : 'read';
|
||||||
|
final rawDartType = dartTypeNames[column.type];
|
||||||
|
var code = 'row.$method<$rawDartType>($dartLiteral)';
|
||||||
|
|
||||||
final converter = column.typeConverter;
|
final converter = column.typeConverter;
|
||||||
if (converter != null) {
|
if (converter != null) {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
part of 'database.dart';
|
part of 'database.dart';
|
||||||
|
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
// MoorGenerator
|
// DriftDatabaseGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
// ignore_for_file: type=lint
|
||||||
|
@ -12,17 +12,6 @@ class Category extends DataClass implements Insertable<Category> {
|
||||||
final String name;
|
final String name;
|
||||||
final Color color;
|
final Color color;
|
||||||
Category({required this.id, required this.name, required this.color});
|
Category({required this.id, required this.name, required this.color});
|
||||||
factory Category.fromData(Map<String, dynamic> data, {String? prefix}) {
|
|
||||||
final effectivePrefix = prefix ?? '';
|
|
||||||
return Category(
|
|
||||||
id: const IntType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}id'])!,
|
|
||||||
name: const StringType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}name'])!,
|
|
||||||
color: $CategoriesTable.$converter0.fromSql(const IntType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}color'])!),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@override
|
@override
|
||||||
Map<String, Expression> toColumns(bool nullToAbsent) {
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
||||||
final map = <String, Expression>{};
|
final map = <String, Expression>{};
|
||||||
|
@ -106,7 +95,7 @@ class CategoriesCompanion extends UpdateCompanion<Category> {
|
||||||
static Insertable<Category> custom({
|
static Insertable<Category> custom({
|
||||||
Expression<int>? id,
|
Expression<int>? id,
|
||||||
Expression<String>? name,
|
Expression<String>? name,
|
||||||
Expression<Color>? color,
|
Expression<int>? color,
|
||||||
}) {
|
}) {
|
||||||
return RawValuesInsertable({
|
return RawValuesInsertable({
|
||||||
if (id != null) 'id': id,
|
if (id != null) 'id': id,
|
||||||
|
@ -159,21 +148,21 @@ class $CategoriesTable extends Categories
|
||||||
$CategoriesTable(this.attachedDatabase, [this._alias]);
|
$CategoriesTable(this.attachedDatabase, [this._alias]);
|
||||||
final VerificationMeta _idMeta = const VerificationMeta('id');
|
final VerificationMeta _idMeta = const VerificationMeta('id');
|
||||||
@override
|
@override
|
||||||
late final GeneratedColumn<int?> id = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
||||||
'id', aliasedName, false,
|
'id', aliasedName, false,
|
||||||
type: const IntType(),
|
type: DriftSqlType.int,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
defaultConstraints: 'PRIMARY KEY AUTOINCREMENT');
|
defaultConstraints: 'PRIMARY KEY AUTOINCREMENT');
|
||||||
final VerificationMeta _nameMeta = const VerificationMeta('name');
|
final VerificationMeta _nameMeta = const VerificationMeta('name');
|
||||||
@override
|
@override
|
||||||
late final GeneratedColumn<String?> name = GeneratedColumn<String?>(
|
late final GeneratedColumn<String> name = GeneratedColumn<String>(
|
||||||
'name', aliasedName, false,
|
'name', aliasedName, false,
|
||||||
type: const StringType(), requiredDuringInsert: true);
|
type: DriftSqlType.string, requiredDuringInsert: true);
|
||||||
final VerificationMeta _colorMeta = const VerificationMeta('color');
|
final VerificationMeta _colorMeta = const VerificationMeta('color');
|
||||||
@override
|
@override
|
||||||
late final GeneratedColumnWithTypeConverter<Color, int?> color =
|
late final GeneratedColumnWithTypeConverter<Color, int> color =
|
||||||
GeneratedColumn<int?>('color', aliasedName, false,
|
GeneratedColumn<int>('color', aliasedName, false,
|
||||||
type: const IntType(), requiredDuringInsert: true)
|
type: DriftSqlType.int, requiredDuringInsert: true)
|
||||||
.withConverter<Color>($CategoriesTable.$converter0);
|
.withConverter<Color>($CategoriesTable.$converter0);
|
||||||
@override
|
@override
|
||||||
List<GeneratedColumn> get $columns => [id, name, color];
|
List<GeneratedColumn> get $columns => [id, name, color];
|
||||||
|
@ -203,8 +192,15 @@ class $CategoriesTable extends Categories
|
||||||
Set<GeneratedColumn> get $primaryKey => {id};
|
Set<GeneratedColumn> get $primaryKey => {id};
|
||||||
@override
|
@override
|
||||||
Category map(Map<String, dynamic> data, {String? tablePrefix}) {
|
Category map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||||
return Category.fromData(data,
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||||
prefix: tablePrefix != null ? '$tablePrefix.' : null);
|
return Category(
|
||||||
|
id: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.int, data['${effectivePrefix}id'])!,
|
||||||
|
name: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.string, data['${effectivePrefix}name'])!,
|
||||||
|
color: $CategoriesTable.$converter0.fromSql(attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.int, data['${effectivePrefix}color'])!),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -225,29 +221,16 @@ class TodoEntry extends DataClass implements Insertable<TodoEntry> {
|
||||||
required this.description,
|
required this.description,
|
||||||
this.category,
|
this.category,
|
||||||
this.dueDate});
|
this.dueDate});
|
||||||
factory TodoEntry.fromData(Map<String, dynamic> data, {String? prefix}) {
|
|
||||||
final effectivePrefix = prefix ?? '';
|
|
||||||
return TodoEntry(
|
|
||||||
id: const IntType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}id'])!,
|
|
||||||
description: const StringType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}description'])!,
|
|
||||||
category: const IntType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}category']),
|
|
||||||
dueDate: const DateTimeType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}due_date']),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@override
|
@override
|
||||||
Map<String, Expression> toColumns(bool nullToAbsent) {
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
||||||
final map = <String, Expression>{};
|
final map = <String, Expression>{};
|
||||||
map['id'] = Variable<int>(id);
|
map['id'] = Variable<int>(id);
|
||||||
map['description'] = Variable<String>(description);
|
map['description'] = Variable<String>(description);
|
||||||
if (!nullToAbsent || category != null) {
|
if (!nullToAbsent || category != null) {
|
||||||
map['category'] = Variable<int?>(category);
|
map['category'] = Variable<int>(category);
|
||||||
}
|
}
|
||||||
if (!nullToAbsent || dueDate != null) {
|
if (!nullToAbsent || dueDate != null) {
|
||||||
map['due_date'] = Variable<DateTime?>(dueDate);
|
map['due_date'] = Variable<DateTime>(dueDate);
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
@ -374,10 +357,10 @@ class TodoEntriesCompanion extends UpdateCompanion<TodoEntry> {
|
||||||
map['description'] = Variable<String>(description.value);
|
map['description'] = Variable<String>(description.value);
|
||||||
}
|
}
|
||||||
if (category.present) {
|
if (category.present) {
|
||||||
map['category'] = Variable<int?>(category.value);
|
map['category'] = Variable<int>(category.value);
|
||||||
}
|
}
|
||||||
if (dueDate.present) {
|
if (dueDate.present) {
|
||||||
map['due_date'] = Variable<DateTime?>(dueDate.value);
|
map['due_date'] = Variable<DateTime>(dueDate.value);
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
@ -402,29 +385,29 @@ class $TodoEntriesTable extends TodoEntries
|
||||||
$TodoEntriesTable(this.attachedDatabase, [this._alias]);
|
$TodoEntriesTable(this.attachedDatabase, [this._alias]);
|
||||||
final VerificationMeta _idMeta = const VerificationMeta('id');
|
final VerificationMeta _idMeta = const VerificationMeta('id');
|
||||||
@override
|
@override
|
||||||
late final GeneratedColumn<int?> id = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
||||||
'id', aliasedName, false,
|
'id', aliasedName, false,
|
||||||
type: const IntType(),
|
type: DriftSqlType.int,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
defaultConstraints: 'PRIMARY KEY AUTOINCREMENT');
|
defaultConstraints: 'PRIMARY KEY AUTOINCREMENT');
|
||||||
final VerificationMeta _descriptionMeta =
|
final VerificationMeta _descriptionMeta =
|
||||||
const VerificationMeta('description');
|
const VerificationMeta('description');
|
||||||
@override
|
@override
|
||||||
late final GeneratedColumn<String?> description = GeneratedColumn<String?>(
|
late final GeneratedColumn<String> description = GeneratedColumn<String>(
|
||||||
'description', aliasedName, false,
|
'description', aliasedName, false,
|
||||||
type: const StringType(), requiredDuringInsert: true);
|
type: DriftSqlType.string, requiredDuringInsert: true);
|
||||||
final VerificationMeta _categoryMeta = const VerificationMeta('category');
|
final VerificationMeta _categoryMeta = const VerificationMeta('category');
|
||||||
@override
|
@override
|
||||||
late final GeneratedColumn<int?> category = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> category = GeneratedColumn<int>(
|
||||||
'category', aliasedName, true,
|
'category', aliasedName, true,
|
||||||
type: const IntType(),
|
type: DriftSqlType.int,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
defaultConstraints: 'REFERENCES categories (id)');
|
defaultConstraints: 'REFERENCES categories (id)');
|
||||||
final VerificationMeta _dueDateMeta = const VerificationMeta('dueDate');
|
final VerificationMeta _dueDateMeta = const VerificationMeta('dueDate');
|
||||||
@override
|
@override
|
||||||
late final GeneratedColumn<DateTime?> dueDate = GeneratedColumn<DateTime?>(
|
late final GeneratedColumn<DateTime> dueDate = GeneratedColumn<DateTime>(
|
||||||
'due_date', aliasedName, true,
|
'due_date', aliasedName, true,
|
||||||
type: const IntType(), requiredDuringInsert: false);
|
type: DriftSqlType.dateTime, requiredDuringInsert: false);
|
||||||
@override
|
@override
|
||||||
List<GeneratedColumn> get $columns => [id, description, category, dueDate];
|
List<GeneratedColumn> get $columns => [id, description, category, dueDate];
|
||||||
@override
|
@override
|
||||||
|
@ -462,8 +445,17 @@ class $TodoEntriesTable extends TodoEntries
|
||||||
Set<GeneratedColumn> get $primaryKey => {id};
|
Set<GeneratedColumn> get $primaryKey => {id};
|
||||||
@override
|
@override
|
||||||
TodoEntry map(Map<String, dynamic> data, {String? tablePrefix}) {
|
TodoEntry map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||||
return TodoEntry.fromData(data,
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||||
prefix: tablePrefix != null ? '$tablePrefix.' : null);
|
return TodoEntry(
|
||||||
|
id: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.int, data['${effectivePrefix}id'])!,
|
||||||
|
description: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.string, data['${effectivePrefix}description'])!,
|
||||||
|
category: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.int, data['${effectivePrefix}category']),
|
||||||
|
dueDate: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.dateTime, data['${effectivePrefix}due_date']),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -475,13 +467,6 @@ class $TodoEntriesTable extends TodoEntries
|
||||||
class TextEntrie extends DataClass implements Insertable<TextEntrie> {
|
class TextEntrie extends DataClass implements Insertable<TextEntrie> {
|
||||||
final String description;
|
final String description;
|
||||||
TextEntrie({required this.description});
|
TextEntrie({required this.description});
|
||||||
factory TextEntrie.fromData(Map<String, dynamic> data, {String? prefix}) {
|
|
||||||
final effectivePrefix = prefix ?? '';
|
|
||||||
return TextEntrie(
|
|
||||||
description: const StringType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}description'])!,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@override
|
@override
|
||||||
Map<String, Expression> toColumns(bool nullToAbsent) {
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
||||||
final map = <String, Expression>{};
|
final map = <String, Expression>{};
|
||||||
|
@ -579,9 +564,9 @@ class TextEntries extends Table
|
||||||
TextEntries(this.attachedDatabase, [this._alias]);
|
TextEntries(this.attachedDatabase, [this._alias]);
|
||||||
final VerificationMeta _descriptionMeta =
|
final VerificationMeta _descriptionMeta =
|
||||||
const VerificationMeta('description');
|
const VerificationMeta('description');
|
||||||
late final GeneratedColumn<String?> description = GeneratedColumn<String?>(
|
late final GeneratedColumn<String> description = GeneratedColumn<String>(
|
||||||
'description', aliasedName, false,
|
'description', aliasedName, false,
|
||||||
type: const StringType(),
|
type: DriftSqlType.string,
|
||||||
requiredDuringInsert: true,
|
requiredDuringInsert: true,
|
||||||
$customConstraints: '');
|
$customConstraints: '');
|
||||||
@override
|
@override
|
||||||
|
@ -610,8 +595,11 @@ class TextEntries extends Table
|
||||||
Set<GeneratedColumn> get $primaryKey => <GeneratedColumn>{};
|
Set<GeneratedColumn> get $primaryKey => <GeneratedColumn>{};
|
||||||
@override
|
@override
|
||||||
TextEntrie map(Map<String, dynamic> data, {String? tablePrefix}) {
|
TextEntrie map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||||
return TextEntrie.fromData(data,
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||||
prefix: tablePrefix != null ? '$tablePrefix.' : null);
|
return TextEntrie(
|
||||||
|
description: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.string, data['${effectivePrefix}description'])!,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -627,7 +615,7 @@ class TextEntries extends Table
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class _$AppDatabase extends GeneratedDatabase {
|
abstract class _$AppDatabase extends GeneratedDatabase {
|
||||||
_$AppDatabase(QueryExecutor e) : super(SqlTypeSystem.defaultInstance, e);
|
_$AppDatabase(QueryExecutor e) : super(e);
|
||||||
_$AppDatabase.connect(DatabaseConnection c) : super.connect(c);
|
_$AppDatabase.connect(DatabaseConnection c) : super.connect(c);
|
||||||
late final $CategoriesTable categories = $CategoriesTable(this);
|
late final $CategoriesTable categories = $CategoriesTable(this);
|
||||||
late final $TodoEntriesTable todoEntries = $TodoEntriesTable(this);
|
late final $TodoEntriesTable todoEntries = $TodoEntriesTable(this);
|
||||||
|
@ -644,10 +632,10 @@ abstract class _$AppDatabase extends GeneratedDatabase {
|
||||||
categories,
|
categories,
|
||||||
}).map((QueryRow row) {
|
}).map((QueryRow row) {
|
||||||
return CategoriesWithCountResult(
|
return CategoriesWithCountResult(
|
||||||
id: row.read<int?>('id'),
|
id: row.readNullable<int>('id'),
|
||||||
name: row.read<String?>('name'),
|
name: row.readNullable<String>('name'),
|
||||||
color: NullAwareTypeConverter.wrapFromSql(
|
color: NullAwareTypeConverter.wrapFromSql(
|
||||||
$CategoriesTable.$converter0, row.read<int?>('color')),
|
$CategoriesTable.$converter0, row.readNullable<int>('color')),
|
||||||
amount: row.read<int>('amount'),
|
amount: row.read<int>('amount'),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -655,7 +643,7 @@ abstract class _$AppDatabase extends GeneratedDatabase {
|
||||||
|
|
||||||
Selectable<SearchResult> _search(String query) {
|
Selectable<SearchResult> _search(String query) {
|
||||||
return customSelect(
|
return customSelect(
|
||||||
'SELECT"todos"."id" AS "nested_0.id", "todos"."description" AS "nested_0.description", "todos"."category" AS "nested_0.category", "todos"."due_date" AS "nested_0.due_date","cat"."id" AS "nested_1.id", "cat"."name" AS "nested_1.name", "cat"."color" AS "nested_1.color" FROM text_entries INNER JOIN todo_entries AS todos ON todos.id = text_entries."rowid" LEFT OUTER JOIN categories AS cat ON cat.id = todos.category WHERE text_entries MATCH @1 ORDER BY rank',
|
'SELECT"todos"."id" AS "nested_0.id", "todos"."description" AS "nested_0.description", "todos"."category" AS "nested_0.category", "todos"."due_date" AS "nested_0.due_date","cat"."id" AS "nested_1.id", "cat"."name" AS "nested_1.name", "cat"."color" AS "nested_1.color" FROM text_entries INNER JOIN todo_entries AS todos ON todos.id = text_entries."rowid" LEFT OUTER JOIN categories AS cat ON cat.id = todos.category WHERE text_entries MATCH ?1 ORDER BY rank',
|
||||||
variables: [
|
variables: [
|
||||||
Variable<String>(query)
|
Variable<String>(query)
|
||||||
],
|
],
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
part of 'database.dart';
|
part of 'database.dart';
|
||||||
|
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
// MoorGenerator
|
// DriftDatabaseGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
// ignore_for_file: type=lint
|
||||||
|
@ -11,15 +11,6 @@ class Entrie extends DataClass implements Insertable<Entrie> {
|
||||||
final int id;
|
final int id;
|
||||||
final String value;
|
final String value;
|
||||||
Entrie({required this.id, required this.value});
|
Entrie({required this.id, required this.value});
|
||||||
factory Entrie.fromData(Map<String, dynamic> data, {String? prefix}) {
|
|
||||||
final effectivePrefix = prefix ?? '';
|
|
||||||
return Entrie(
|
|
||||||
id: const IntType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}id'])!,
|
|
||||||
value: const StringType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}text'])!,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@override
|
@override
|
||||||
Map<String, Expression> toColumns(bool nullToAbsent) {
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
||||||
final map = <String, Expression>{};
|
final map = <String, Expression>{};
|
||||||
|
@ -129,15 +120,15 @@ class Entries extends Table with TableInfo<Entries, Entrie> {
|
||||||
final String? _alias;
|
final String? _alias;
|
||||||
Entries(this.attachedDatabase, [this._alias]);
|
Entries(this.attachedDatabase, [this._alias]);
|
||||||
final VerificationMeta _idMeta = const VerificationMeta('id');
|
final VerificationMeta _idMeta = const VerificationMeta('id');
|
||||||
late final GeneratedColumn<int?> id = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
||||||
'id', aliasedName, false,
|
'id', aliasedName, false,
|
||||||
type: const IntType(),
|
type: DriftSqlType.int,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
$customConstraints: 'PRIMARY KEY');
|
$customConstraints: 'PRIMARY KEY');
|
||||||
final VerificationMeta _valueMeta = const VerificationMeta('value');
|
final VerificationMeta _valueMeta = const VerificationMeta('value');
|
||||||
late final GeneratedColumn<String?> value = GeneratedColumn<String?>(
|
late final GeneratedColumn<String> value = GeneratedColumn<String>(
|
||||||
'text', aliasedName, false,
|
'text', aliasedName, false,
|
||||||
type: const StringType(),
|
type: DriftSqlType.string,
|
||||||
requiredDuringInsert: true,
|
requiredDuringInsert: true,
|
||||||
$customConstraints: 'NOT NULL');
|
$customConstraints: 'NOT NULL');
|
||||||
@override
|
@override
|
||||||
|
@ -167,8 +158,13 @@ class Entries extends Table with TableInfo<Entries, Entrie> {
|
||||||
Set<GeneratedColumn> get $primaryKey => {id};
|
Set<GeneratedColumn> get $primaryKey => {id};
|
||||||
@override
|
@override
|
||||||
Entrie map(Map<String, dynamic> data, {String? tablePrefix}) {
|
Entrie map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||||
return Entrie.fromData(data,
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||||
prefix: tablePrefix != null ? '$tablePrefix.' : null);
|
return Entrie(
|
||||||
|
id: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.int, data['${effectivePrefix}id'])!,
|
||||||
|
value: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.string, data['${effectivePrefix}text'])!,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -181,7 +177,7 @@ class Entries extends Table with TableInfo<Entries, Entrie> {
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class _$MyDatabase extends GeneratedDatabase {
|
abstract class _$MyDatabase extends GeneratedDatabase {
|
||||||
_$MyDatabase(QueryExecutor e) : super(SqlTypeSystem.defaultInstance, e);
|
_$MyDatabase(QueryExecutor e) : super(e);
|
||||||
late final Entries entries = Entries(this);
|
late final Entries entries = Entries(this);
|
||||||
Selectable<Entrie> allEntries() {
|
Selectable<Entrie> allEntries() {
|
||||||
return customSelect('SELECT * FROM entries', variables: [], readsFrom: {
|
return customSelect('SELECT * FROM entries', variables: [], readsFrom: {
|
||||||
|
@ -191,7 +187,7 @@ abstract class _$MyDatabase extends GeneratedDatabase {
|
||||||
|
|
||||||
Future<int> addEntry(String var1) {
|
Future<int> addEntry(String var1) {
|
||||||
return customInsert(
|
return customInsert(
|
||||||
'INSERT INTO entries (text) VALUES (@1)',
|
'INSERT INTO entries (text) VALUES (?1)',
|
||||||
variables: [Variable<String>(var1)],
|
variables: [Variable<String>(var1)],
|
||||||
updates: {entries},
|
updates: {entries},
|
||||||
);
|
);
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
part of 'database.dart';
|
part of 'database.dart';
|
||||||
|
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
// MoorGenerator
|
// DriftDatabaseGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
// ignore_for_file: type=lint
|
||||||
|
@ -12,24 +12,13 @@ class User extends DataClass implements Insertable<User> {
|
||||||
final String name;
|
final String name;
|
||||||
final int? nextUser;
|
final int? nextUser;
|
||||||
User({required this.id, required this.name, this.nextUser});
|
User({required this.id, required this.name, this.nextUser});
|
||||||
factory User.fromData(Map<String, dynamic> data, {String? prefix}) {
|
|
||||||
final effectivePrefix = prefix ?? '';
|
|
||||||
return User(
|
|
||||||
id: const IntType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}id'])!,
|
|
||||||
name: const StringType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}name'])!,
|
|
||||||
nextUser: const IntType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}next_user']),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@override
|
@override
|
||||||
Map<String, Expression> toColumns(bool nullToAbsent) {
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
||||||
final map = <String, Expression>{};
|
final map = <String, Expression>{};
|
||||||
map['id'] = Variable<int>(id);
|
map['id'] = Variable<int>(id);
|
||||||
map['name'] = Variable<String>(name);
|
map['name'] = Variable<String>(name);
|
||||||
if (!nullToAbsent || nextUser != null) {
|
if (!nullToAbsent || nextUser != null) {
|
||||||
map['next_user'] = Variable<int?>(nextUser);
|
map['next_user'] = Variable<int>(nextUser);
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
@ -134,7 +123,7 @@ class UsersCompanion extends UpdateCompanion<User> {
|
||||||
map['name'] = Variable<String>(name.value);
|
map['name'] = Variable<String>(name.value);
|
||||||
}
|
}
|
||||||
if (nextUser.present) {
|
if (nextUser.present) {
|
||||||
map['next_user'] = Variable<int?>(nextUser.value);
|
map['next_user'] = Variable<int>(nextUser.value);
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
@ -157,23 +146,23 @@ class $UsersTable extends Users with TableInfo<$UsersTable, User> {
|
||||||
$UsersTable(this.attachedDatabase, [this._alias]);
|
$UsersTable(this.attachedDatabase, [this._alias]);
|
||||||
final VerificationMeta _idMeta = const VerificationMeta('id');
|
final VerificationMeta _idMeta = const VerificationMeta('id');
|
||||||
@override
|
@override
|
||||||
late final GeneratedColumn<int?> id = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
||||||
'id', aliasedName, false,
|
'id', aliasedName, false,
|
||||||
type: const IntType(),
|
type: DriftSqlType.int,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
defaultConstraints: 'PRIMARY KEY AUTOINCREMENT');
|
defaultConstraints: 'PRIMARY KEY AUTOINCREMENT');
|
||||||
final VerificationMeta _nameMeta = const VerificationMeta('name');
|
final VerificationMeta _nameMeta = const VerificationMeta('name');
|
||||||
@override
|
@override
|
||||||
late final GeneratedColumn<String?> name = GeneratedColumn<String?>(
|
late final GeneratedColumn<String> name = GeneratedColumn<String>(
|
||||||
'name', aliasedName, false,
|
'name', aliasedName, false,
|
||||||
type: const StringType(),
|
type: DriftSqlType.string,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
defaultValue: const Constant('name'));
|
defaultValue: const Constant('name'));
|
||||||
final VerificationMeta _nextUserMeta = const VerificationMeta('nextUser');
|
final VerificationMeta _nextUserMeta = const VerificationMeta('nextUser');
|
||||||
@override
|
@override
|
||||||
late final GeneratedColumn<int?> nextUser = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> nextUser = GeneratedColumn<int>(
|
||||||
'next_user', aliasedName, true,
|
'next_user', aliasedName, true,
|
||||||
type: const IntType(),
|
type: DriftSqlType.int,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
defaultConstraints: 'REFERENCES users (id)');
|
defaultConstraints: 'REFERENCES users (id)');
|
||||||
@override
|
@override
|
||||||
|
@ -205,8 +194,15 @@ class $UsersTable extends Users with TableInfo<$UsersTable, User> {
|
||||||
Set<GeneratedColumn> get $primaryKey => {id};
|
Set<GeneratedColumn> get $primaryKey => {id};
|
||||||
@override
|
@override
|
||||||
User map(Map<String, dynamic> data, {String? tablePrefix}) {
|
User map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||||
return User.fromData(data,
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||||
prefix: tablePrefix != null ? '$tablePrefix.' : null);
|
return User(
|
||||||
|
id: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.int, data['${effectivePrefix}id'])!,
|
||||||
|
name: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.string, data['${effectivePrefix}name'])!,
|
||||||
|
nextUser: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.int, data['${effectivePrefix}next_user']),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -225,26 +221,13 @@ class Group extends DataClass implements Insertable<Group> {
|
||||||
required this.title,
|
required this.title,
|
||||||
this.deleted,
|
this.deleted,
|
||||||
required this.owner});
|
required this.owner});
|
||||||
factory Group.fromData(Map<String, dynamic> data, {String? prefix}) {
|
|
||||||
final effectivePrefix = prefix ?? '';
|
|
||||||
return Group(
|
|
||||||
id: const IntType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}id'])!,
|
|
||||||
title: const StringType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}title'])!,
|
|
||||||
deleted: const BoolType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}deleted']),
|
|
||||||
owner: const IntType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}owner'])!,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@override
|
@override
|
||||||
Map<String, Expression> toColumns(bool nullToAbsent) {
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
||||||
final map = <String, Expression>{};
|
final map = <String, Expression>{};
|
||||||
map['id'] = Variable<int>(id);
|
map['id'] = Variable<int>(id);
|
||||||
map['title'] = Variable<String>(title);
|
map['title'] = Variable<String>(title);
|
||||||
if (!nullToAbsent || deleted != null) {
|
if (!nullToAbsent || deleted != null) {
|
||||||
map['deleted'] = Variable<bool?>(deleted);
|
map['deleted'] = Variable<bool>(deleted);
|
||||||
}
|
}
|
||||||
map['owner'] = Variable<int>(owner);
|
map['owner'] = Variable<int>(owner);
|
||||||
return map;
|
return map;
|
||||||
|
@ -366,7 +349,7 @@ class GroupsCompanion extends UpdateCompanion<Group> {
|
||||||
map['title'] = Variable<String>(title.value);
|
map['title'] = Variable<String>(title.value);
|
||||||
}
|
}
|
||||||
if (deleted.present) {
|
if (deleted.present) {
|
||||||
map['deleted'] = Variable<bool?>(deleted.value);
|
map['deleted'] = Variable<bool>(deleted.value);
|
||||||
}
|
}
|
||||||
if (owner.present) {
|
if (owner.present) {
|
||||||
map['owner'] = Variable<int>(owner.value);
|
map['owner'] = Variable<int>(owner.value);
|
||||||
|
@ -392,28 +375,28 @@ class Groups extends Table with TableInfo<Groups, Group> {
|
||||||
final String? _alias;
|
final String? _alias;
|
||||||
Groups(this.attachedDatabase, [this._alias]);
|
Groups(this.attachedDatabase, [this._alias]);
|
||||||
final VerificationMeta _idMeta = const VerificationMeta('id');
|
final VerificationMeta _idMeta = const VerificationMeta('id');
|
||||||
late final GeneratedColumn<int?> id = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
||||||
'id', aliasedName, false,
|
'id', aliasedName, false,
|
||||||
type: const IntType(),
|
type: DriftSqlType.int,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
$customConstraints: 'NOT NULL');
|
$customConstraints: 'NOT NULL');
|
||||||
final VerificationMeta _titleMeta = const VerificationMeta('title');
|
final VerificationMeta _titleMeta = const VerificationMeta('title');
|
||||||
late final GeneratedColumn<String?> title = GeneratedColumn<String?>(
|
late final GeneratedColumn<String> title = GeneratedColumn<String>(
|
||||||
'title', aliasedName, false,
|
'title', aliasedName, false,
|
||||||
type: const StringType(),
|
type: DriftSqlType.string,
|
||||||
requiredDuringInsert: true,
|
requiredDuringInsert: true,
|
||||||
$customConstraints: 'NOT NULL');
|
$customConstraints: 'NOT NULL');
|
||||||
final VerificationMeta _deletedMeta = const VerificationMeta('deleted');
|
final VerificationMeta _deletedMeta = const VerificationMeta('deleted');
|
||||||
late final GeneratedColumn<bool?> deleted = GeneratedColumn<bool?>(
|
late final GeneratedColumn<bool> deleted = GeneratedColumn<bool>(
|
||||||
'deleted', aliasedName, true,
|
'deleted', aliasedName, true,
|
||||||
type: const BoolType(),
|
type: DriftSqlType.bool,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
$customConstraints: 'DEFAULT FALSE',
|
$customConstraints: 'DEFAULT FALSE',
|
||||||
defaultValue: const CustomExpression<bool>('FALSE'));
|
defaultValue: const CustomExpression<bool>('FALSE'));
|
||||||
final VerificationMeta _ownerMeta = const VerificationMeta('owner');
|
final VerificationMeta _ownerMeta = const VerificationMeta('owner');
|
||||||
late final GeneratedColumn<int?> owner = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> owner = GeneratedColumn<int>(
|
||||||
'owner', aliasedName, false,
|
'owner', aliasedName, false,
|
||||||
type: const IntType(),
|
type: DriftSqlType.int,
|
||||||
requiredDuringInsert: true,
|
requiredDuringInsert: true,
|
||||||
$customConstraints: 'NOT NULL REFERENCES users (id)');
|
$customConstraints: 'NOT NULL REFERENCES users (id)');
|
||||||
@override
|
@override
|
||||||
|
@ -453,8 +436,17 @@ class Groups extends Table with TableInfo<Groups, Group> {
|
||||||
Set<GeneratedColumn> get $primaryKey => {id};
|
Set<GeneratedColumn> get $primaryKey => {id};
|
||||||
@override
|
@override
|
||||||
Group map(Map<String, dynamic> data, {String? tablePrefix}) {
|
Group map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||||
return Group.fromData(data,
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||||
prefix: tablePrefix != null ? '$tablePrefix.' : null);
|
return Group(
|
||||||
|
id: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.int, data['${effectivePrefix}id'])!,
|
||||||
|
title: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.string, data['${effectivePrefix}title'])!,
|
||||||
|
deleted: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.bool, data['${effectivePrefix}deleted']),
|
||||||
|
owner: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.int, data['${effectivePrefix}owner'])!,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -478,19 +470,6 @@ class GroupCountData extends DataClass {
|
||||||
required this.name,
|
required this.name,
|
||||||
this.nextUser,
|
this.nextUser,
|
||||||
required this.groupCount});
|
required this.groupCount});
|
||||||
factory GroupCountData.fromData(Map<String, dynamic> data, {String? prefix}) {
|
|
||||||
final effectivePrefix = prefix ?? '';
|
|
||||||
return GroupCountData(
|
|
||||||
id: const IntType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}id'])!,
|
|
||||||
name: const StringType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}name'])!,
|
|
||||||
nextUser: const IntType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}next_user']),
|
|
||||||
groupCount: const IntType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}group_count'])!,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
factory GroupCountData.fromJson(Map<String, dynamic> json,
|
factory GroupCountData.fromJson(Map<String, dynamic> json,
|
||||||
{ValueSerializer? serializer}) {
|
{ValueSerializer? serializer}) {
|
||||||
serializer ??= driftRuntimeOptions.defaultSerializer;
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
||||||
|
@ -562,21 +541,30 @@ class GroupCount extends ViewInfo<GroupCount, GroupCountData>
|
||||||
GroupCount get asDslTable => this;
|
GroupCount get asDslTable => this;
|
||||||
@override
|
@override
|
||||||
GroupCountData map(Map<String, dynamic> data, {String? tablePrefix}) {
|
GroupCountData map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||||
return GroupCountData.fromData(data,
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||||
prefix: tablePrefix != null ? '$tablePrefix.' : null);
|
return GroupCountData(
|
||||||
|
id: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.int, data['${effectivePrefix}id'])!,
|
||||||
|
name: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.string, data['${effectivePrefix}name'])!,
|
||||||
|
nextUser: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.int, data['${effectivePrefix}next_user']),
|
||||||
|
groupCount: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.int, data['${effectivePrefix}group_count'])!,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
late final GeneratedColumn<int?> id =
|
late final GeneratedColumn<int> id =
|
||||||
GeneratedColumn<int?>('id', aliasedName, false, type: const IntType());
|
GeneratedColumn<int>('id', aliasedName, false, type: DriftSqlType.int);
|
||||||
late final GeneratedColumn<String?> name = GeneratedColumn<String?>(
|
late final GeneratedColumn<String> name = GeneratedColumn<String>(
|
||||||
'name', aliasedName, false,
|
'name', aliasedName, false,
|
||||||
type: const StringType());
|
type: DriftSqlType.string);
|
||||||
late final GeneratedColumn<int?> nextUser = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> nextUser = GeneratedColumn<int>(
|
||||||
'next_user', aliasedName, true,
|
'next_user', aliasedName, true,
|
||||||
type: const IntType());
|
type: DriftSqlType.int);
|
||||||
late final GeneratedColumn<int?> groupCount = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> groupCount = GeneratedColumn<int>(
|
||||||
'group_count', aliasedName, false,
|
'group_count', aliasedName, false,
|
||||||
type: const IntType());
|
type: DriftSqlType.int);
|
||||||
@override
|
@override
|
||||||
GroupCount createAlias(String alias) {
|
GroupCount createAlias(String alias) {
|
||||||
return GroupCount(attachedDatabase, alias);
|
return GroupCount(attachedDatabase, alias);
|
||||||
|
@ -589,7 +577,7 @@ class GroupCount extends ViewInfo<GroupCount, GroupCountData>
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class _$Database extends GeneratedDatabase {
|
abstract class _$Database extends GeneratedDatabase {
|
||||||
_$Database(QueryExecutor e) : super(SqlTypeSystem.defaultInstance, e);
|
_$Database(QueryExecutor e) : super(e);
|
||||||
_$Database.connect(DatabaseConnection c) : super.connect(c);
|
_$Database.connect(DatabaseConnection c) : super.connect(c);
|
||||||
late final $UsersTable users = $UsersTable(this);
|
late final $UsersTable users = $UsersTable(this);
|
||||||
late final Groups groups = Groups(this);
|
late final Groups groups = Groups(this);
|
||||||
|
|
|
@ -7,9 +7,9 @@ class Users extends Table with TableInfo {
|
||||||
final GeneratedDatabase attachedDatabase;
|
final GeneratedDatabase attachedDatabase;
|
||||||
final String? _alias;
|
final String? _alias;
|
||||||
Users(this.attachedDatabase, [this._alias]);
|
Users(this.attachedDatabase, [this._alias]);
|
||||||
late final GeneratedColumn<int?> id = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
||||||
'id', aliasedName, false,
|
'id', aliasedName, false,
|
||||||
type: const IntType(),
|
type: DriftSqlType.int,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
defaultConstraints: 'PRIMARY KEY AUTOINCREMENT');
|
defaultConstraints: 'PRIMARY KEY AUTOINCREMENT');
|
||||||
@override
|
@override
|
||||||
|
@ -35,7 +35,7 @@ class Users extends Table with TableInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
class DatabaseAtV1 extends GeneratedDatabase {
|
class DatabaseAtV1 extends GeneratedDatabase {
|
||||||
DatabaseAtV1(QueryExecutor e) : super(SqlTypeSystem.defaultInstance, e);
|
DatabaseAtV1(QueryExecutor e) : super(e);
|
||||||
DatabaseAtV1.connect(DatabaseConnection c) : super.connect(c);
|
DatabaseAtV1.connect(DatabaseConnection c) : super.connect(c);
|
||||||
late final Users users = Users(this);
|
late final Users users = Users(this);
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -7,14 +7,14 @@ class Users extends Table with TableInfo {
|
||||||
final GeneratedDatabase attachedDatabase;
|
final GeneratedDatabase attachedDatabase;
|
||||||
final String? _alias;
|
final String? _alias;
|
||||||
Users(this.attachedDatabase, [this._alias]);
|
Users(this.attachedDatabase, [this._alias]);
|
||||||
late final GeneratedColumn<int?> id = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
||||||
'id', aliasedName, false,
|
'id', aliasedName, false,
|
||||||
type: const IntType(),
|
type: DriftSqlType.int,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
defaultConstraints: 'PRIMARY KEY AUTOINCREMENT');
|
defaultConstraints: 'PRIMARY KEY AUTOINCREMENT');
|
||||||
late final GeneratedColumn<String?> name = GeneratedColumn<String?>(
|
late final GeneratedColumn<String> name = GeneratedColumn<String>(
|
||||||
'name', aliasedName, false,
|
'name', aliasedName, false,
|
||||||
type: const StringType(), requiredDuringInsert: true);
|
type: DriftSqlType.string, requiredDuringInsert: true);
|
||||||
@override
|
@override
|
||||||
List<GeneratedColumn> get $columns => [id, name];
|
List<GeneratedColumn> get $columns => [id, name];
|
||||||
@override
|
@override
|
||||||
|
@ -38,7 +38,7 @@ class Users extends Table with TableInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
class DatabaseAtV2 extends GeneratedDatabase {
|
class DatabaseAtV2 extends GeneratedDatabase {
|
||||||
DatabaseAtV2(QueryExecutor e) : super(SqlTypeSystem.defaultInstance, e);
|
DatabaseAtV2(QueryExecutor e) : super(e);
|
||||||
DatabaseAtV2.connect(DatabaseConnection c) : super.connect(c);
|
DatabaseAtV2.connect(DatabaseConnection c) : super.connect(c);
|
||||||
late final Users users = Users(this);
|
late final Users users = Users(this);
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -7,14 +7,14 @@ class Users extends Table with TableInfo {
|
||||||
final GeneratedDatabase attachedDatabase;
|
final GeneratedDatabase attachedDatabase;
|
||||||
final String? _alias;
|
final String? _alias;
|
||||||
Users(this.attachedDatabase, [this._alias]);
|
Users(this.attachedDatabase, [this._alias]);
|
||||||
late final GeneratedColumn<int?> id = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
||||||
'id', aliasedName, false,
|
'id', aliasedName, false,
|
||||||
type: const IntType(),
|
type: DriftSqlType.int,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
defaultConstraints: 'PRIMARY KEY AUTOINCREMENT');
|
defaultConstraints: 'PRIMARY KEY AUTOINCREMENT');
|
||||||
late final GeneratedColumn<String?> name = GeneratedColumn<String?>(
|
late final GeneratedColumn<String> name = GeneratedColumn<String>(
|
||||||
'name', aliasedName, false,
|
'name', aliasedName, false,
|
||||||
type: const StringType(), requiredDuringInsert: true);
|
type: DriftSqlType.string, requiredDuringInsert: true);
|
||||||
@override
|
@override
|
||||||
List<GeneratedColumn> get $columns => [id, name];
|
List<GeneratedColumn> get $columns => [id, name];
|
||||||
@override
|
@override
|
||||||
|
@ -42,25 +42,25 @@ class Groups extends Table with TableInfo {
|
||||||
final GeneratedDatabase attachedDatabase;
|
final GeneratedDatabase attachedDatabase;
|
||||||
final String? _alias;
|
final String? _alias;
|
||||||
Groups(this.attachedDatabase, [this._alias]);
|
Groups(this.attachedDatabase, [this._alias]);
|
||||||
late final GeneratedColumn<int?> id = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
||||||
'id', aliasedName, false,
|
'id', aliasedName, false,
|
||||||
type: const IntType(),
|
type: DriftSqlType.int,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
$customConstraints: 'NOT NULL');
|
$customConstraints: 'NOT NULL');
|
||||||
late final GeneratedColumn<String?> title = GeneratedColumn<String?>(
|
late final GeneratedColumn<String> title = GeneratedColumn<String>(
|
||||||
'title', aliasedName, false,
|
'title', aliasedName, false,
|
||||||
type: const StringType(),
|
type: DriftSqlType.string,
|
||||||
requiredDuringInsert: true,
|
requiredDuringInsert: true,
|
||||||
$customConstraints: 'NOT NULL');
|
$customConstraints: 'NOT NULL');
|
||||||
late final GeneratedColumn<bool?> deleted = GeneratedColumn<bool?>(
|
late final GeneratedColumn<bool> deleted = GeneratedColumn<bool>(
|
||||||
'deleted', aliasedName, true,
|
'deleted', aliasedName, true,
|
||||||
type: const BoolType(),
|
type: DriftSqlType.bool,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
$customConstraints: 'DEFAULT FALSE',
|
$customConstraints: 'DEFAULT FALSE',
|
||||||
defaultValue: const CustomExpression<bool>('FALSE'));
|
defaultValue: const CustomExpression<bool>('FALSE'));
|
||||||
late final GeneratedColumn<int?> owner = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> owner = GeneratedColumn<int>(
|
||||||
'owner', aliasedName, false,
|
'owner', aliasedName, false,
|
||||||
type: const IntType(),
|
type: DriftSqlType.int,
|
||||||
requiredDuringInsert: true,
|
requiredDuringInsert: true,
|
||||||
$customConstraints: 'NOT NULL REFERENCES users (id)');
|
$customConstraints: 'NOT NULL REFERENCES users (id)');
|
||||||
@override
|
@override
|
||||||
|
@ -88,7 +88,7 @@ class Groups extends Table with TableInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
class DatabaseAtV3 extends GeneratedDatabase {
|
class DatabaseAtV3 extends GeneratedDatabase {
|
||||||
DatabaseAtV3(QueryExecutor e) : super(SqlTypeSystem.defaultInstance, e);
|
DatabaseAtV3(QueryExecutor e) : super(e);
|
||||||
DatabaseAtV3.connect(DatabaseConnection c) : super.connect(c);
|
DatabaseAtV3.connect(DatabaseConnection c) : super.connect(c);
|
||||||
late final Users users = Users(this);
|
late final Users users = Users(this);
|
||||||
late final Groups groups = Groups(this);
|
late final Groups groups = Groups(this);
|
||||||
|
|
|
@ -7,14 +7,14 @@ class Users extends Table with TableInfo {
|
||||||
final GeneratedDatabase attachedDatabase;
|
final GeneratedDatabase attachedDatabase;
|
||||||
final String? _alias;
|
final String? _alias;
|
||||||
Users(this.attachedDatabase, [this._alias]);
|
Users(this.attachedDatabase, [this._alias]);
|
||||||
late final GeneratedColumn<int?> id = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
||||||
'id', aliasedName, false,
|
'id', aliasedName, false,
|
||||||
type: const IntType(),
|
type: DriftSqlType.int,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
defaultConstraints: 'PRIMARY KEY AUTOINCREMENT');
|
defaultConstraints: 'PRIMARY KEY AUTOINCREMENT');
|
||||||
late final GeneratedColumn<String?> name = GeneratedColumn<String?>(
|
late final GeneratedColumn<String> name = GeneratedColumn<String>(
|
||||||
'name', aliasedName, false,
|
'name', aliasedName, false,
|
||||||
type: const StringType(),
|
type: DriftSqlType.string,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
defaultValue: const Constant('name'));
|
defaultValue: const Constant('name'));
|
||||||
@override
|
@override
|
||||||
|
@ -44,25 +44,25 @@ class Groups extends Table with TableInfo {
|
||||||
final GeneratedDatabase attachedDatabase;
|
final GeneratedDatabase attachedDatabase;
|
||||||
final String? _alias;
|
final String? _alias;
|
||||||
Groups(this.attachedDatabase, [this._alias]);
|
Groups(this.attachedDatabase, [this._alias]);
|
||||||
late final GeneratedColumn<int?> id = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
||||||
'id', aliasedName, false,
|
'id', aliasedName, false,
|
||||||
type: const IntType(),
|
type: DriftSqlType.int,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
$customConstraints: 'NOT NULL');
|
$customConstraints: 'NOT NULL');
|
||||||
late final GeneratedColumn<String?> title = GeneratedColumn<String?>(
|
late final GeneratedColumn<String> title = GeneratedColumn<String>(
|
||||||
'title', aliasedName, false,
|
'title', aliasedName, false,
|
||||||
type: const StringType(),
|
type: DriftSqlType.string,
|
||||||
requiredDuringInsert: true,
|
requiredDuringInsert: true,
|
||||||
$customConstraints: 'NOT NULL');
|
$customConstraints: 'NOT NULL');
|
||||||
late final GeneratedColumn<bool?> deleted = GeneratedColumn<bool?>(
|
late final GeneratedColumn<bool> deleted = GeneratedColumn<bool>(
|
||||||
'deleted', aliasedName, true,
|
'deleted', aliasedName, true,
|
||||||
type: const BoolType(),
|
type: DriftSqlType.bool,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
$customConstraints: 'DEFAULT FALSE',
|
$customConstraints: 'DEFAULT FALSE',
|
||||||
defaultValue: const CustomExpression<bool>('FALSE'));
|
defaultValue: const CustomExpression<bool>('FALSE'));
|
||||||
late final GeneratedColumn<int?> owner = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> owner = GeneratedColumn<int>(
|
||||||
'owner', aliasedName, false,
|
'owner', aliasedName, false,
|
||||||
type: const IntType(),
|
type: DriftSqlType.int,
|
||||||
requiredDuringInsert: true,
|
requiredDuringInsert: true,
|
||||||
$customConstraints: 'NOT NULL REFERENCES users (id)');
|
$customConstraints: 'NOT NULL REFERENCES users (id)');
|
||||||
@override
|
@override
|
||||||
|
@ -90,7 +90,7 @@ class Groups extends Table with TableInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
class DatabaseAtV4 extends GeneratedDatabase {
|
class DatabaseAtV4 extends GeneratedDatabase {
|
||||||
DatabaseAtV4(QueryExecutor e) : super(SqlTypeSystem.defaultInstance, e);
|
DatabaseAtV4(QueryExecutor e) : super(e);
|
||||||
DatabaseAtV4.connect(DatabaseConnection c) : super.connect(c);
|
DatabaseAtV4.connect(DatabaseConnection c) : super.connect(c);
|
||||||
late final Users users = Users(this);
|
late final Users users = Users(this);
|
||||||
late final Groups groups = Groups(this);
|
late final Groups groups = Groups(this);
|
||||||
|
|
|
@ -7,19 +7,19 @@ class Users extends Table with TableInfo {
|
||||||
final GeneratedDatabase attachedDatabase;
|
final GeneratedDatabase attachedDatabase;
|
||||||
final String? _alias;
|
final String? _alias;
|
||||||
Users(this.attachedDatabase, [this._alias]);
|
Users(this.attachedDatabase, [this._alias]);
|
||||||
late final GeneratedColumn<int?> id = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
||||||
'id', aliasedName, false,
|
'id', aliasedName, false,
|
||||||
type: const IntType(),
|
type: DriftSqlType.int,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
defaultConstraints: 'PRIMARY KEY AUTOINCREMENT');
|
defaultConstraints: 'PRIMARY KEY AUTOINCREMENT');
|
||||||
late final GeneratedColumn<String?> name = GeneratedColumn<String?>(
|
late final GeneratedColumn<String> name = GeneratedColumn<String>(
|
||||||
'name', aliasedName, false,
|
'name', aliasedName, false,
|
||||||
type: const StringType(),
|
type: DriftSqlType.string,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
defaultValue: const Constant('name'));
|
defaultValue: const Constant('name'));
|
||||||
late final GeneratedColumn<int?> nextUser = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> nextUser = GeneratedColumn<int>(
|
||||||
'next_user', aliasedName, true,
|
'next_user', aliasedName, true,
|
||||||
type: const IntType(),
|
type: DriftSqlType.int,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
defaultConstraints: 'REFERENCES users (id)');
|
defaultConstraints: 'REFERENCES users (id)');
|
||||||
@override
|
@override
|
||||||
|
@ -49,25 +49,25 @@ class Groups extends Table with TableInfo {
|
||||||
final GeneratedDatabase attachedDatabase;
|
final GeneratedDatabase attachedDatabase;
|
||||||
final String? _alias;
|
final String? _alias;
|
||||||
Groups(this.attachedDatabase, [this._alias]);
|
Groups(this.attachedDatabase, [this._alias]);
|
||||||
late final GeneratedColumn<int?> id = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
||||||
'id', aliasedName, false,
|
'id', aliasedName, false,
|
||||||
type: const IntType(),
|
type: DriftSqlType.int,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
$customConstraints: 'NOT NULL');
|
$customConstraints: 'NOT NULL');
|
||||||
late final GeneratedColumn<String?> title = GeneratedColumn<String?>(
|
late final GeneratedColumn<String> title = GeneratedColumn<String>(
|
||||||
'title', aliasedName, false,
|
'title', aliasedName, false,
|
||||||
type: const StringType(),
|
type: DriftSqlType.string,
|
||||||
requiredDuringInsert: true,
|
requiredDuringInsert: true,
|
||||||
$customConstraints: 'NOT NULL');
|
$customConstraints: 'NOT NULL');
|
||||||
late final GeneratedColumn<bool?> deleted = GeneratedColumn<bool?>(
|
late final GeneratedColumn<bool> deleted = GeneratedColumn<bool>(
|
||||||
'deleted', aliasedName, true,
|
'deleted', aliasedName, true,
|
||||||
type: const BoolType(),
|
type: DriftSqlType.bool,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
$customConstraints: 'DEFAULT FALSE',
|
$customConstraints: 'DEFAULT FALSE',
|
||||||
defaultValue: const CustomExpression<bool>('FALSE'));
|
defaultValue: const CustomExpression<bool>('FALSE'));
|
||||||
late final GeneratedColumn<int?> owner = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> owner = GeneratedColumn<int>(
|
||||||
'owner', aliasedName, false,
|
'owner', aliasedName, false,
|
||||||
type: const IntType(),
|
type: DriftSqlType.int,
|
||||||
requiredDuringInsert: true,
|
requiredDuringInsert: true,
|
||||||
$customConstraints: 'NOT NULL REFERENCES users (id)');
|
$customConstraints: 'NOT NULL REFERENCES users (id)');
|
||||||
@override
|
@override
|
||||||
|
@ -114,17 +114,17 @@ class GroupCount extends ViewInfo<GroupCount, Never> implements HasResultSet {
|
||||||
throw UnsupportedError('TableInfo.map in schema verification code');
|
throw UnsupportedError('TableInfo.map in schema verification code');
|
||||||
}
|
}
|
||||||
|
|
||||||
late final GeneratedColumn<int?> id =
|
late final GeneratedColumn<int> id =
|
||||||
GeneratedColumn<int?>('id', aliasedName, false, type: const IntType());
|
GeneratedColumn<int>('id', aliasedName, false, type: DriftSqlType.int);
|
||||||
late final GeneratedColumn<String?> name = GeneratedColumn<String?>(
|
late final GeneratedColumn<String> name = GeneratedColumn<String>(
|
||||||
'name', aliasedName, false,
|
'name', aliasedName, false,
|
||||||
type: const StringType());
|
type: DriftSqlType.string);
|
||||||
late final GeneratedColumn<int?> nextUser = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> nextUser = GeneratedColumn<int>(
|
||||||
'next_user', aliasedName, true,
|
'next_user', aliasedName, true,
|
||||||
type: const IntType());
|
type: DriftSqlType.int);
|
||||||
late final GeneratedColumn<int?> groupCount = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> groupCount = GeneratedColumn<int>(
|
||||||
'group_count', aliasedName, false,
|
'group_count', aliasedName, false,
|
||||||
type: const IntType());
|
type: DriftSqlType.int);
|
||||||
@override
|
@override
|
||||||
GroupCount createAlias(String alias) {
|
GroupCount createAlias(String alias) {
|
||||||
return GroupCount(attachedDatabase, alias);
|
return GroupCount(attachedDatabase, alias);
|
||||||
|
@ -137,7 +137,7 @@ class GroupCount extends ViewInfo<GroupCount, Never> implements HasResultSet {
|
||||||
}
|
}
|
||||||
|
|
||||||
class DatabaseAtV5 extends GeneratedDatabase {
|
class DatabaseAtV5 extends GeneratedDatabase {
|
||||||
DatabaseAtV5(QueryExecutor e) : super(SqlTypeSystem.defaultInstance, e);
|
DatabaseAtV5(QueryExecutor e) : super(e);
|
||||||
DatabaseAtV5.connect(DatabaseConnection c) : super.connect(c);
|
DatabaseAtV5.connect(DatabaseConnection c) : super.connect(c);
|
||||||
late final Users users = Users(this);
|
late final Users users = Users(this);
|
||||||
late final Groups groups = Groups(this);
|
late final Groups groups = Groups(this);
|
||||||
|
|
|
@ -5,13 +5,6 @@ import 'package:drift/drift.dart';
|
||||||
class UsersData extends DataClass implements Insertable<UsersData> {
|
class UsersData extends DataClass implements Insertable<UsersData> {
|
||||||
final int id;
|
final int id;
|
||||||
UsersData({required this.id});
|
UsersData({required this.id});
|
||||||
factory UsersData.fromData(Map<String, dynamic> data, {String? prefix}) {
|
|
||||||
final effectivePrefix = prefix ?? '';
|
|
||||||
return UsersData(
|
|
||||||
id: const IntType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}id'])!,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@override
|
@override
|
||||||
Map<String, Expression> toColumns(bool nullToAbsent) {
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
||||||
final map = <String, Expression>{};
|
final map = <String, Expression>{};
|
||||||
|
@ -103,9 +96,9 @@ class Users extends Table with TableInfo<Users, UsersData> {
|
||||||
final GeneratedDatabase attachedDatabase;
|
final GeneratedDatabase attachedDatabase;
|
||||||
final String? _alias;
|
final String? _alias;
|
||||||
Users(this.attachedDatabase, [this._alias]);
|
Users(this.attachedDatabase, [this._alias]);
|
||||||
late final GeneratedColumn<int?> id = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
||||||
'id', aliasedName, false,
|
'id', aliasedName, false,
|
||||||
type: const IntType(),
|
type: DriftSqlType.int,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
defaultConstraints: 'PRIMARY KEY AUTOINCREMENT');
|
defaultConstraints: 'PRIMARY KEY AUTOINCREMENT');
|
||||||
@override
|
@override
|
||||||
|
@ -118,8 +111,11 @@ class Users extends Table with TableInfo<Users, UsersData> {
|
||||||
Set<GeneratedColumn> get $primaryKey => {id};
|
Set<GeneratedColumn> get $primaryKey => {id};
|
||||||
@override
|
@override
|
||||||
UsersData map(Map<String, dynamic> data, {String? tablePrefix}) {
|
UsersData map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||||
return UsersData.fromData(data,
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||||
prefix: tablePrefix != null ? '$tablePrefix.' : null);
|
return UsersData(
|
||||||
|
id: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.int, data['${effectivePrefix}id'])!,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -132,7 +128,7 @@ class Users extends Table with TableInfo<Users, UsersData> {
|
||||||
}
|
}
|
||||||
|
|
||||||
class DatabaseAtV1 extends GeneratedDatabase {
|
class DatabaseAtV1 extends GeneratedDatabase {
|
||||||
DatabaseAtV1(QueryExecutor e) : super(SqlTypeSystem.defaultInstance, e);
|
DatabaseAtV1(QueryExecutor e) : super(e);
|
||||||
DatabaseAtV1.connect(DatabaseConnection c) : super.connect(c);
|
DatabaseAtV1.connect(DatabaseConnection c) : super.connect(c);
|
||||||
late final Users users = Users(this);
|
late final Users users = Users(this);
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -6,15 +6,6 @@ class UsersData extends DataClass implements Insertable<UsersData> {
|
||||||
final int id;
|
final int id;
|
||||||
final String name;
|
final String name;
|
||||||
UsersData({required this.id, required this.name});
|
UsersData({required this.id, required this.name});
|
||||||
factory UsersData.fromData(Map<String, dynamic> data, {String? prefix}) {
|
|
||||||
final effectivePrefix = prefix ?? '';
|
|
||||||
return UsersData(
|
|
||||||
id: const IntType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}id'])!,
|
|
||||||
name: const StringType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}name'])!,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@override
|
@override
|
||||||
Map<String, Expression> toColumns(bool nullToAbsent) {
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
||||||
final map = <String, Expression>{};
|
final map = <String, Expression>{};
|
||||||
|
@ -123,14 +114,14 @@ class Users extends Table with TableInfo<Users, UsersData> {
|
||||||
final GeneratedDatabase attachedDatabase;
|
final GeneratedDatabase attachedDatabase;
|
||||||
final String? _alias;
|
final String? _alias;
|
||||||
Users(this.attachedDatabase, [this._alias]);
|
Users(this.attachedDatabase, [this._alias]);
|
||||||
late final GeneratedColumn<int?> id = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
||||||
'id', aliasedName, false,
|
'id', aliasedName, false,
|
||||||
type: const IntType(),
|
type: DriftSqlType.int,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
defaultConstraints: 'PRIMARY KEY AUTOINCREMENT');
|
defaultConstraints: 'PRIMARY KEY AUTOINCREMENT');
|
||||||
late final GeneratedColumn<String?> name = GeneratedColumn<String?>(
|
late final GeneratedColumn<String> name = GeneratedColumn<String>(
|
||||||
'name', aliasedName, false,
|
'name', aliasedName, false,
|
||||||
type: const StringType(), requiredDuringInsert: true);
|
type: DriftSqlType.string, requiredDuringInsert: true);
|
||||||
@override
|
@override
|
||||||
List<GeneratedColumn> get $columns => [id, name];
|
List<GeneratedColumn> get $columns => [id, name];
|
||||||
@override
|
@override
|
||||||
|
@ -141,8 +132,13 @@ class Users extends Table with TableInfo<Users, UsersData> {
|
||||||
Set<GeneratedColumn> get $primaryKey => {id};
|
Set<GeneratedColumn> get $primaryKey => {id};
|
||||||
@override
|
@override
|
||||||
UsersData map(Map<String, dynamic> data, {String? tablePrefix}) {
|
UsersData map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||||
return UsersData.fromData(data,
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||||
prefix: tablePrefix != null ? '$tablePrefix.' : null);
|
return UsersData(
|
||||||
|
id: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.int, data['${effectivePrefix}id'])!,
|
||||||
|
name: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.string, data['${effectivePrefix}name'])!,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -155,7 +151,7 @@ class Users extends Table with TableInfo<Users, UsersData> {
|
||||||
}
|
}
|
||||||
|
|
||||||
class DatabaseAtV2 extends GeneratedDatabase {
|
class DatabaseAtV2 extends GeneratedDatabase {
|
||||||
DatabaseAtV2(QueryExecutor e) : super(SqlTypeSystem.defaultInstance, e);
|
DatabaseAtV2(QueryExecutor e) : super(e);
|
||||||
DatabaseAtV2.connect(DatabaseConnection c) : super.connect(c);
|
DatabaseAtV2.connect(DatabaseConnection c) : super.connect(c);
|
||||||
late final Users users = Users(this);
|
late final Users users = Users(this);
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -6,15 +6,6 @@ class UsersData extends DataClass implements Insertable<UsersData> {
|
||||||
final int id;
|
final int id;
|
||||||
final String name;
|
final String name;
|
||||||
UsersData({required this.id, required this.name});
|
UsersData({required this.id, required this.name});
|
||||||
factory UsersData.fromData(Map<String, dynamic> data, {String? prefix}) {
|
|
||||||
final effectivePrefix = prefix ?? '';
|
|
||||||
return UsersData(
|
|
||||||
id: const IntType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}id'])!,
|
|
||||||
name: const StringType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}name'])!,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@override
|
@override
|
||||||
Map<String, Expression> toColumns(bool nullToAbsent) {
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
||||||
final map = <String, Expression>{};
|
final map = <String, Expression>{};
|
||||||
|
@ -123,14 +114,14 @@ class Users extends Table with TableInfo<Users, UsersData> {
|
||||||
final GeneratedDatabase attachedDatabase;
|
final GeneratedDatabase attachedDatabase;
|
||||||
final String? _alias;
|
final String? _alias;
|
||||||
Users(this.attachedDatabase, [this._alias]);
|
Users(this.attachedDatabase, [this._alias]);
|
||||||
late final GeneratedColumn<int?> id = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
||||||
'id', aliasedName, false,
|
'id', aliasedName, false,
|
||||||
type: const IntType(),
|
type: DriftSqlType.int,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
defaultConstraints: 'PRIMARY KEY AUTOINCREMENT');
|
defaultConstraints: 'PRIMARY KEY AUTOINCREMENT');
|
||||||
late final GeneratedColumn<String?> name = GeneratedColumn<String?>(
|
late final GeneratedColumn<String> name = GeneratedColumn<String>(
|
||||||
'name', aliasedName, false,
|
'name', aliasedName, false,
|
||||||
type: const StringType(), requiredDuringInsert: true);
|
type: DriftSqlType.string, requiredDuringInsert: true);
|
||||||
@override
|
@override
|
||||||
List<GeneratedColumn> get $columns => [id, name];
|
List<GeneratedColumn> get $columns => [id, name];
|
||||||
@override
|
@override
|
||||||
|
@ -141,8 +132,13 @@ class Users extends Table with TableInfo<Users, UsersData> {
|
||||||
Set<GeneratedColumn> get $primaryKey => {id};
|
Set<GeneratedColumn> get $primaryKey => {id};
|
||||||
@override
|
@override
|
||||||
UsersData map(Map<String, dynamic> data, {String? tablePrefix}) {
|
UsersData map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||||
return UsersData.fromData(data,
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||||
prefix: tablePrefix != null ? '$tablePrefix.' : null);
|
return UsersData(
|
||||||
|
id: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.int, data['${effectivePrefix}id'])!,
|
||||||
|
name: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.string, data['${effectivePrefix}name'])!,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -164,26 +160,13 @@ class GroupsData extends DataClass implements Insertable<GroupsData> {
|
||||||
required this.title,
|
required this.title,
|
||||||
this.deleted,
|
this.deleted,
|
||||||
required this.owner});
|
required this.owner});
|
||||||
factory GroupsData.fromData(Map<String, dynamic> data, {String? prefix}) {
|
|
||||||
final effectivePrefix = prefix ?? '';
|
|
||||||
return GroupsData(
|
|
||||||
id: const IntType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}id'])!,
|
|
||||||
title: const StringType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}title'])!,
|
|
||||||
deleted: const BoolType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}deleted']),
|
|
||||||
owner: const IntType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}owner'])!,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@override
|
@override
|
||||||
Map<String, Expression> toColumns(bool nullToAbsent) {
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
||||||
final map = <String, Expression>{};
|
final map = <String, Expression>{};
|
||||||
map['id'] = Variable<int>(id);
|
map['id'] = Variable<int>(id);
|
||||||
map['title'] = Variable<String>(title);
|
map['title'] = Variable<String>(title);
|
||||||
if (!nullToAbsent || deleted != null) {
|
if (!nullToAbsent || deleted != null) {
|
||||||
map['deleted'] = Variable<bool?>(deleted);
|
map['deleted'] = Variable<bool>(deleted);
|
||||||
}
|
}
|
||||||
map['owner'] = Variable<int>(owner);
|
map['owner'] = Variable<int>(owner);
|
||||||
return map;
|
return map;
|
||||||
|
@ -306,7 +289,7 @@ class GroupsCompanion extends UpdateCompanion<GroupsData> {
|
||||||
map['title'] = Variable<String>(title.value);
|
map['title'] = Variable<String>(title.value);
|
||||||
}
|
}
|
||||||
if (deleted.present) {
|
if (deleted.present) {
|
||||||
map['deleted'] = Variable<bool?>(deleted.value);
|
map['deleted'] = Variable<bool>(deleted.value);
|
||||||
}
|
}
|
||||||
if (owner.present) {
|
if (owner.present) {
|
||||||
map['owner'] = Variable<int>(owner.value);
|
map['owner'] = Variable<int>(owner.value);
|
||||||
|
@ -331,25 +314,25 @@ class Groups extends Table with TableInfo<Groups, GroupsData> {
|
||||||
final GeneratedDatabase attachedDatabase;
|
final GeneratedDatabase attachedDatabase;
|
||||||
final String? _alias;
|
final String? _alias;
|
||||||
Groups(this.attachedDatabase, [this._alias]);
|
Groups(this.attachedDatabase, [this._alias]);
|
||||||
late final GeneratedColumn<int?> id = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
||||||
'id', aliasedName, false,
|
'id', aliasedName, false,
|
||||||
type: const IntType(),
|
type: DriftSqlType.int,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
$customConstraints: 'NOT NULL');
|
$customConstraints: 'NOT NULL');
|
||||||
late final GeneratedColumn<String?> title = GeneratedColumn<String?>(
|
late final GeneratedColumn<String> title = GeneratedColumn<String>(
|
||||||
'title', aliasedName, false,
|
'title', aliasedName, false,
|
||||||
type: const StringType(),
|
type: DriftSqlType.string,
|
||||||
requiredDuringInsert: true,
|
requiredDuringInsert: true,
|
||||||
$customConstraints: 'NOT NULL');
|
$customConstraints: 'NOT NULL');
|
||||||
late final GeneratedColumn<bool?> deleted = GeneratedColumn<bool?>(
|
late final GeneratedColumn<bool> deleted = GeneratedColumn<bool>(
|
||||||
'deleted', aliasedName, true,
|
'deleted', aliasedName, true,
|
||||||
type: const BoolType(),
|
type: DriftSqlType.bool,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
$customConstraints: 'DEFAULT FALSE',
|
$customConstraints: 'DEFAULT FALSE',
|
||||||
defaultValue: const CustomExpression<bool>('FALSE'));
|
defaultValue: const CustomExpression<bool>('FALSE'));
|
||||||
late final GeneratedColumn<int?> owner = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> owner = GeneratedColumn<int>(
|
||||||
'owner', aliasedName, false,
|
'owner', aliasedName, false,
|
||||||
type: const IntType(),
|
type: DriftSqlType.int,
|
||||||
requiredDuringInsert: true,
|
requiredDuringInsert: true,
|
||||||
$customConstraints: 'NOT NULL REFERENCES users (id)');
|
$customConstraints: 'NOT NULL REFERENCES users (id)');
|
||||||
@override
|
@override
|
||||||
|
@ -362,8 +345,17 @@ class Groups extends Table with TableInfo<Groups, GroupsData> {
|
||||||
Set<GeneratedColumn> get $primaryKey => {id};
|
Set<GeneratedColumn> get $primaryKey => {id};
|
||||||
@override
|
@override
|
||||||
GroupsData map(Map<String, dynamic> data, {String? tablePrefix}) {
|
GroupsData map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||||
return GroupsData.fromData(data,
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||||
prefix: tablePrefix != null ? '$tablePrefix.' : null);
|
return GroupsData(
|
||||||
|
id: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.int, data['${effectivePrefix}id'])!,
|
||||||
|
title: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.string, data['${effectivePrefix}title'])!,
|
||||||
|
deleted: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.bool, data['${effectivePrefix}deleted']),
|
||||||
|
owner: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.int, data['${effectivePrefix}owner'])!,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -378,7 +370,7 @@ class Groups extends Table with TableInfo<Groups, GroupsData> {
|
||||||
}
|
}
|
||||||
|
|
||||||
class DatabaseAtV3 extends GeneratedDatabase {
|
class DatabaseAtV3 extends GeneratedDatabase {
|
||||||
DatabaseAtV3(QueryExecutor e) : super(SqlTypeSystem.defaultInstance, e);
|
DatabaseAtV3(QueryExecutor e) : super(e);
|
||||||
DatabaseAtV3.connect(DatabaseConnection c) : super.connect(c);
|
DatabaseAtV3.connect(DatabaseConnection c) : super.connect(c);
|
||||||
late final Users users = Users(this);
|
late final Users users = Users(this);
|
||||||
late final Groups groups = Groups(this);
|
late final Groups groups = Groups(this);
|
||||||
|
|
|
@ -6,15 +6,6 @@ class UsersData extends DataClass implements Insertable<UsersData> {
|
||||||
final int id;
|
final int id;
|
||||||
final String name;
|
final String name;
|
||||||
UsersData({required this.id, required this.name});
|
UsersData({required this.id, required this.name});
|
||||||
factory UsersData.fromData(Map<String, dynamic> data, {String? prefix}) {
|
|
||||||
final effectivePrefix = prefix ?? '';
|
|
||||||
return UsersData(
|
|
||||||
id: const IntType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}id'])!,
|
|
||||||
name: const StringType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}name'])!,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@override
|
@override
|
||||||
Map<String, Expression> toColumns(bool nullToAbsent) {
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
||||||
final map = <String, Expression>{};
|
final map = <String, Expression>{};
|
||||||
|
@ -123,14 +114,14 @@ class Users extends Table with TableInfo<Users, UsersData> {
|
||||||
final GeneratedDatabase attachedDatabase;
|
final GeneratedDatabase attachedDatabase;
|
||||||
final String? _alias;
|
final String? _alias;
|
||||||
Users(this.attachedDatabase, [this._alias]);
|
Users(this.attachedDatabase, [this._alias]);
|
||||||
late final GeneratedColumn<int?> id = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
||||||
'id', aliasedName, false,
|
'id', aliasedName, false,
|
||||||
type: const IntType(),
|
type: DriftSqlType.int,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
defaultConstraints: 'PRIMARY KEY AUTOINCREMENT');
|
defaultConstraints: 'PRIMARY KEY AUTOINCREMENT');
|
||||||
late final GeneratedColumn<String?> name = GeneratedColumn<String?>(
|
late final GeneratedColumn<String> name = GeneratedColumn<String>(
|
||||||
'name', aliasedName, false,
|
'name', aliasedName, false,
|
||||||
type: const StringType(),
|
type: DriftSqlType.string,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
defaultValue: const Constant('name'));
|
defaultValue: const Constant('name'));
|
||||||
@override
|
@override
|
||||||
|
@ -143,8 +134,13 @@ class Users extends Table with TableInfo<Users, UsersData> {
|
||||||
Set<GeneratedColumn> get $primaryKey => {id};
|
Set<GeneratedColumn> get $primaryKey => {id};
|
||||||
@override
|
@override
|
||||||
UsersData map(Map<String, dynamic> data, {String? tablePrefix}) {
|
UsersData map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||||
return UsersData.fromData(data,
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||||
prefix: tablePrefix != null ? '$tablePrefix.' : null);
|
return UsersData(
|
||||||
|
id: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.int, data['${effectivePrefix}id'])!,
|
||||||
|
name: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.string, data['${effectivePrefix}name'])!,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -166,26 +162,13 @@ class GroupsData extends DataClass implements Insertable<GroupsData> {
|
||||||
required this.title,
|
required this.title,
|
||||||
this.deleted,
|
this.deleted,
|
||||||
required this.owner});
|
required this.owner});
|
||||||
factory GroupsData.fromData(Map<String, dynamic> data, {String? prefix}) {
|
|
||||||
final effectivePrefix = prefix ?? '';
|
|
||||||
return GroupsData(
|
|
||||||
id: const IntType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}id'])!,
|
|
||||||
title: const StringType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}title'])!,
|
|
||||||
deleted: const BoolType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}deleted']),
|
|
||||||
owner: const IntType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}owner'])!,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@override
|
@override
|
||||||
Map<String, Expression> toColumns(bool nullToAbsent) {
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
||||||
final map = <String, Expression>{};
|
final map = <String, Expression>{};
|
||||||
map['id'] = Variable<int>(id);
|
map['id'] = Variable<int>(id);
|
||||||
map['title'] = Variable<String>(title);
|
map['title'] = Variable<String>(title);
|
||||||
if (!nullToAbsent || deleted != null) {
|
if (!nullToAbsent || deleted != null) {
|
||||||
map['deleted'] = Variable<bool?>(deleted);
|
map['deleted'] = Variable<bool>(deleted);
|
||||||
}
|
}
|
||||||
map['owner'] = Variable<int>(owner);
|
map['owner'] = Variable<int>(owner);
|
||||||
return map;
|
return map;
|
||||||
|
@ -308,7 +291,7 @@ class GroupsCompanion extends UpdateCompanion<GroupsData> {
|
||||||
map['title'] = Variable<String>(title.value);
|
map['title'] = Variable<String>(title.value);
|
||||||
}
|
}
|
||||||
if (deleted.present) {
|
if (deleted.present) {
|
||||||
map['deleted'] = Variable<bool?>(deleted.value);
|
map['deleted'] = Variable<bool>(deleted.value);
|
||||||
}
|
}
|
||||||
if (owner.present) {
|
if (owner.present) {
|
||||||
map['owner'] = Variable<int>(owner.value);
|
map['owner'] = Variable<int>(owner.value);
|
||||||
|
@ -333,25 +316,25 @@ class Groups extends Table with TableInfo<Groups, GroupsData> {
|
||||||
final GeneratedDatabase attachedDatabase;
|
final GeneratedDatabase attachedDatabase;
|
||||||
final String? _alias;
|
final String? _alias;
|
||||||
Groups(this.attachedDatabase, [this._alias]);
|
Groups(this.attachedDatabase, [this._alias]);
|
||||||
late final GeneratedColumn<int?> id = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
||||||
'id', aliasedName, false,
|
'id', aliasedName, false,
|
||||||
type: const IntType(),
|
type: DriftSqlType.int,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
$customConstraints: 'NOT NULL');
|
$customConstraints: 'NOT NULL');
|
||||||
late final GeneratedColumn<String?> title = GeneratedColumn<String?>(
|
late final GeneratedColumn<String> title = GeneratedColumn<String>(
|
||||||
'title', aliasedName, false,
|
'title', aliasedName, false,
|
||||||
type: const StringType(),
|
type: DriftSqlType.string,
|
||||||
requiredDuringInsert: true,
|
requiredDuringInsert: true,
|
||||||
$customConstraints: 'NOT NULL');
|
$customConstraints: 'NOT NULL');
|
||||||
late final GeneratedColumn<bool?> deleted = GeneratedColumn<bool?>(
|
late final GeneratedColumn<bool> deleted = GeneratedColumn<bool>(
|
||||||
'deleted', aliasedName, true,
|
'deleted', aliasedName, true,
|
||||||
type: const BoolType(),
|
type: DriftSqlType.bool,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
$customConstraints: 'DEFAULT FALSE',
|
$customConstraints: 'DEFAULT FALSE',
|
||||||
defaultValue: const CustomExpression<bool>('FALSE'));
|
defaultValue: const CustomExpression<bool>('FALSE'));
|
||||||
late final GeneratedColumn<int?> owner = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> owner = GeneratedColumn<int>(
|
||||||
'owner', aliasedName, false,
|
'owner', aliasedName, false,
|
||||||
type: const IntType(),
|
type: DriftSqlType.int,
|
||||||
requiredDuringInsert: true,
|
requiredDuringInsert: true,
|
||||||
$customConstraints: 'NOT NULL REFERENCES users (id)');
|
$customConstraints: 'NOT NULL REFERENCES users (id)');
|
||||||
@override
|
@override
|
||||||
|
@ -364,8 +347,17 @@ class Groups extends Table with TableInfo<Groups, GroupsData> {
|
||||||
Set<GeneratedColumn> get $primaryKey => {id};
|
Set<GeneratedColumn> get $primaryKey => {id};
|
||||||
@override
|
@override
|
||||||
GroupsData map(Map<String, dynamic> data, {String? tablePrefix}) {
|
GroupsData map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||||
return GroupsData.fromData(data,
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||||
prefix: tablePrefix != null ? '$tablePrefix.' : null);
|
return GroupsData(
|
||||||
|
id: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.int, data['${effectivePrefix}id'])!,
|
||||||
|
title: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.string, data['${effectivePrefix}title'])!,
|
||||||
|
deleted: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.bool, data['${effectivePrefix}deleted']),
|
||||||
|
owner: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.int, data['${effectivePrefix}owner'])!,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -380,7 +372,7 @@ class Groups extends Table with TableInfo<Groups, GroupsData> {
|
||||||
}
|
}
|
||||||
|
|
||||||
class DatabaseAtV4 extends GeneratedDatabase {
|
class DatabaseAtV4 extends GeneratedDatabase {
|
||||||
DatabaseAtV4(QueryExecutor e) : super(SqlTypeSystem.defaultInstance, e);
|
DatabaseAtV4(QueryExecutor e) : super(e);
|
||||||
DatabaseAtV4.connect(DatabaseConnection c) : super.connect(c);
|
DatabaseAtV4.connect(DatabaseConnection c) : super.connect(c);
|
||||||
late final Users users = Users(this);
|
late final Users users = Users(this);
|
||||||
late final Groups groups = Groups(this);
|
late final Groups groups = Groups(this);
|
||||||
|
|
|
@ -7,24 +7,13 @@ class UsersData extends DataClass implements Insertable<UsersData> {
|
||||||
final String name;
|
final String name;
|
||||||
final int? nextUser;
|
final int? nextUser;
|
||||||
UsersData({required this.id, required this.name, this.nextUser});
|
UsersData({required this.id, required this.name, this.nextUser});
|
||||||
factory UsersData.fromData(Map<String, dynamic> data, {String? prefix}) {
|
|
||||||
final effectivePrefix = prefix ?? '';
|
|
||||||
return UsersData(
|
|
||||||
id: const IntType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}id'])!,
|
|
||||||
name: const StringType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}name'])!,
|
|
||||||
nextUser: const IntType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}next_user']),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@override
|
@override
|
||||||
Map<String, Expression> toColumns(bool nullToAbsent) {
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
||||||
final map = <String, Expression>{};
|
final map = <String, Expression>{};
|
||||||
map['id'] = Variable<int>(id);
|
map['id'] = Variable<int>(id);
|
||||||
map['name'] = Variable<String>(name);
|
map['name'] = Variable<String>(name);
|
||||||
if (!nullToAbsent || nextUser != null) {
|
if (!nullToAbsent || nextUser != null) {
|
||||||
map['next_user'] = Variable<int?>(nextUser);
|
map['next_user'] = Variable<int>(nextUser);
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
@ -129,7 +118,7 @@ class UsersCompanion extends UpdateCompanion<UsersData> {
|
||||||
map['name'] = Variable<String>(name.value);
|
map['name'] = Variable<String>(name.value);
|
||||||
}
|
}
|
||||||
if (nextUser.present) {
|
if (nextUser.present) {
|
||||||
map['next_user'] = Variable<int?>(nextUser.value);
|
map['next_user'] = Variable<int>(nextUser.value);
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
@ -150,19 +139,19 @@ class Users extends Table with TableInfo<Users, UsersData> {
|
||||||
final GeneratedDatabase attachedDatabase;
|
final GeneratedDatabase attachedDatabase;
|
||||||
final String? _alias;
|
final String? _alias;
|
||||||
Users(this.attachedDatabase, [this._alias]);
|
Users(this.attachedDatabase, [this._alias]);
|
||||||
late final GeneratedColumn<int?> id = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
||||||
'id', aliasedName, false,
|
'id', aliasedName, false,
|
||||||
type: const IntType(),
|
type: DriftSqlType.int,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
defaultConstraints: 'PRIMARY KEY AUTOINCREMENT');
|
defaultConstraints: 'PRIMARY KEY AUTOINCREMENT');
|
||||||
late final GeneratedColumn<String?> name = GeneratedColumn<String?>(
|
late final GeneratedColumn<String> name = GeneratedColumn<String>(
|
||||||
'name', aliasedName, false,
|
'name', aliasedName, false,
|
||||||
type: const StringType(),
|
type: DriftSqlType.string,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
defaultValue: const Constant('name'));
|
defaultValue: const Constant('name'));
|
||||||
late final GeneratedColumn<int?> nextUser = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> nextUser = GeneratedColumn<int>(
|
||||||
'next_user', aliasedName, true,
|
'next_user', aliasedName, true,
|
||||||
type: const IntType(),
|
type: DriftSqlType.int,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
defaultConstraints: 'REFERENCES users (id)');
|
defaultConstraints: 'REFERENCES users (id)');
|
||||||
@override
|
@override
|
||||||
|
@ -175,8 +164,15 @@ class Users extends Table with TableInfo<Users, UsersData> {
|
||||||
Set<GeneratedColumn> get $primaryKey => {id};
|
Set<GeneratedColumn> get $primaryKey => {id};
|
||||||
@override
|
@override
|
||||||
UsersData map(Map<String, dynamic> data, {String? tablePrefix}) {
|
UsersData map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||||
return UsersData.fromData(data,
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||||
prefix: tablePrefix != null ? '$tablePrefix.' : null);
|
return UsersData(
|
||||||
|
id: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.int, data['${effectivePrefix}id'])!,
|
||||||
|
name: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.string, data['${effectivePrefix}name'])!,
|
||||||
|
nextUser: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.int, data['${effectivePrefix}next_user']),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -198,26 +194,13 @@ class GroupsData extends DataClass implements Insertable<GroupsData> {
|
||||||
required this.title,
|
required this.title,
|
||||||
this.deleted,
|
this.deleted,
|
||||||
required this.owner});
|
required this.owner});
|
||||||
factory GroupsData.fromData(Map<String, dynamic> data, {String? prefix}) {
|
|
||||||
final effectivePrefix = prefix ?? '';
|
|
||||||
return GroupsData(
|
|
||||||
id: const IntType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}id'])!,
|
|
||||||
title: const StringType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}title'])!,
|
|
||||||
deleted: const BoolType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}deleted']),
|
|
||||||
owner: const IntType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}owner'])!,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@override
|
@override
|
||||||
Map<String, Expression> toColumns(bool nullToAbsent) {
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
||||||
final map = <String, Expression>{};
|
final map = <String, Expression>{};
|
||||||
map['id'] = Variable<int>(id);
|
map['id'] = Variable<int>(id);
|
||||||
map['title'] = Variable<String>(title);
|
map['title'] = Variable<String>(title);
|
||||||
if (!nullToAbsent || deleted != null) {
|
if (!nullToAbsent || deleted != null) {
|
||||||
map['deleted'] = Variable<bool?>(deleted);
|
map['deleted'] = Variable<bool>(deleted);
|
||||||
}
|
}
|
||||||
map['owner'] = Variable<int>(owner);
|
map['owner'] = Variable<int>(owner);
|
||||||
return map;
|
return map;
|
||||||
|
@ -340,7 +323,7 @@ class GroupsCompanion extends UpdateCompanion<GroupsData> {
|
||||||
map['title'] = Variable<String>(title.value);
|
map['title'] = Variable<String>(title.value);
|
||||||
}
|
}
|
||||||
if (deleted.present) {
|
if (deleted.present) {
|
||||||
map['deleted'] = Variable<bool?>(deleted.value);
|
map['deleted'] = Variable<bool>(deleted.value);
|
||||||
}
|
}
|
||||||
if (owner.present) {
|
if (owner.present) {
|
||||||
map['owner'] = Variable<int>(owner.value);
|
map['owner'] = Variable<int>(owner.value);
|
||||||
|
@ -365,25 +348,25 @@ class Groups extends Table with TableInfo<Groups, GroupsData> {
|
||||||
final GeneratedDatabase attachedDatabase;
|
final GeneratedDatabase attachedDatabase;
|
||||||
final String? _alias;
|
final String? _alias;
|
||||||
Groups(this.attachedDatabase, [this._alias]);
|
Groups(this.attachedDatabase, [this._alias]);
|
||||||
late final GeneratedColumn<int?> id = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
||||||
'id', aliasedName, false,
|
'id', aliasedName, false,
|
||||||
type: const IntType(),
|
type: DriftSqlType.int,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
$customConstraints: 'NOT NULL');
|
$customConstraints: 'NOT NULL');
|
||||||
late final GeneratedColumn<String?> title = GeneratedColumn<String?>(
|
late final GeneratedColumn<String> title = GeneratedColumn<String>(
|
||||||
'title', aliasedName, false,
|
'title', aliasedName, false,
|
||||||
type: const StringType(),
|
type: DriftSqlType.string,
|
||||||
requiredDuringInsert: true,
|
requiredDuringInsert: true,
|
||||||
$customConstraints: 'NOT NULL');
|
$customConstraints: 'NOT NULL');
|
||||||
late final GeneratedColumn<bool?> deleted = GeneratedColumn<bool?>(
|
late final GeneratedColumn<bool> deleted = GeneratedColumn<bool>(
|
||||||
'deleted', aliasedName, true,
|
'deleted', aliasedName, true,
|
||||||
type: const BoolType(),
|
type: DriftSqlType.bool,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
$customConstraints: 'DEFAULT FALSE',
|
$customConstraints: 'DEFAULT FALSE',
|
||||||
defaultValue: const CustomExpression<bool>('FALSE'));
|
defaultValue: const CustomExpression<bool>('FALSE'));
|
||||||
late final GeneratedColumn<int?> owner = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> owner = GeneratedColumn<int>(
|
||||||
'owner', aliasedName, false,
|
'owner', aliasedName, false,
|
||||||
type: const IntType(),
|
type: DriftSqlType.int,
|
||||||
requiredDuringInsert: true,
|
requiredDuringInsert: true,
|
||||||
$customConstraints: 'NOT NULL REFERENCES users (id)');
|
$customConstraints: 'NOT NULL REFERENCES users (id)');
|
||||||
@override
|
@override
|
||||||
|
@ -396,8 +379,17 @@ class Groups extends Table with TableInfo<Groups, GroupsData> {
|
||||||
Set<GeneratedColumn> get $primaryKey => {id};
|
Set<GeneratedColumn> get $primaryKey => {id};
|
||||||
@override
|
@override
|
||||||
GroupsData map(Map<String, dynamic> data, {String? tablePrefix}) {
|
GroupsData map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||||
return GroupsData.fromData(data,
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||||
prefix: tablePrefix != null ? '$tablePrefix.' : null);
|
return GroupsData(
|
||||||
|
id: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.int, data['${effectivePrefix}id'])!,
|
||||||
|
title: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.string, data['${effectivePrefix}title'])!,
|
||||||
|
deleted: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.bool, data['${effectivePrefix}deleted']),
|
||||||
|
owner: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.int, data['${effectivePrefix}owner'])!,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -421,19 +413,6 @@ class GroupCountData extends DataClass {
|
||||||
required this.name,
|
required this.name,
|
||||||
this.nextUser,
|
this.nextUser,
|
||||||
required this.groupCount});
|
required this.groupCount});
|
||||||
factory GroupCountData.fromData(Map<String, dynamic> data, {String? prefix}) {
|
|
||||||
final effectivePrefix = prefix ?? '';
|
|
||||||
return GroupCountData(
|
|
||||||
id: const IntType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}id'])!,
|
|
||||||
name: const StringType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}name'])!,
|
|
||||||
nextUser: const IntType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}next_user']),
|
|
||||||
groupCount: const IntType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}group_count'])!,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
factory GroupCountData.fromJson(Map<String, dynamic> json,
|
factory GroupCountData.fromJson(Map<String, dynamic> json,
|
||||||
{ValueSerializer? serializer}) {
|
{ValueSerializer? serializer}) {
|
||||||
serializer ??= driftRuntimeOptions.defaultSerializer;
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
||||||
|
@ -504,21 +483,30 @@ class GroupCount extends ViewInfo<GroupCount, GroupCountData>
|
||||||
GroupCount get asDslTable => this;
|
GroupCount get asDslTable => this;
|
||||||
@override
|
@override
|
||||||
GroupCountData map(Map<String, dynamic> data, {String? tablePrefix}) {
|
GroupCountData map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||||
return GroupCountData.fromData(data,
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||||
prefix: tablePrefix != null ? '$tablePrefix.' : null);
|
return GroupCountData(
|
||||||
|
id: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.int, data['${effectivePrefix}id'])!,
|
||||||
|
name: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.string, data['${effectivePrefix}name'])!,
|
||||||
|
nextUser: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.int, data['${effectivePrefix}next_user']),
|
||||||
|
groupCount: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.int, data['${effectivePrefix}group_count'])!,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
late final GeneratedColumn<int?> id =
|
late final GeneratedColumn<int> id =
|
||||||
GeneratedColumn<int?>('id', aliasedName, false, type: const IntType());
|
GeneratedColumn<int>('id', aliasedName, false, type: DriftSqlType.int);
|
||||||
late final GeneratedColumn<String?> name = GeneratedColumn<String?>(
|
late final GeneratedColumn<String> name = GeneratedColumn<String>(
|
||||||
'name', aliasedName, false,
|
'name', aliasedName, false,
|
||||||
type: const StringType());
|
type: DriftSqlType.string);
|
||||||
late final GeneratedColumn<int?> nextUser = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> nextUser = GeneratedColumn<int>(
|
||||||
'next_user', aliasedName, true,
|
'next_user', aliasedName, true,
|
||||||
type: const IntType());
|
type: DriftSqlType.int);
|
||||||
late final GeneratedColumn<int?> groupCount = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> groupCount = GeneratedColumn<int>(
|
||||||
'group_count', aliasedName, false,
|
'group_count', aliasedName, false,
|
||||||
type: const IntType());
|
type: DriftSqlType.int);
|
||||||
@override
|
@override
|
||||||
GroupCount createAlias(String alias) {
|
GroupCount createAlias(String alias) {
|
||||||
return GroupCount(attachedDatabase, alias);
|
return GroupCount(attachedDatabase, alias);
|
||||||
|
@ -531,7 +519,7 @@ class GroupCount extends ViewInfo<GroupCount, GroupCountData>
|
||||||
}
|
}
|
||||||
|
|
||||||
class DatabaseAtV5 extends GeneratedDatabase {
|
class DatabaseAtV5 extends GeneratedDatabase {
|
||||||
DatabaseAtV5(QueryExecutor e) : super(SqlTypeSystem.defaultInstance, e);
|
DatabaseAtV5(QueryExecutor e) : super(e);
|
||||||
DatabaseAtV5.connect(DatabaseConnection c) : super.connect(c);
|
DatabaseAtV5.connect(DatabaseConnection c) : super.connect(c);
|
||||||
late final Users users = Users(this);
|
late final Users users = Users(this);
|
||||||
late final Groups groups = Groups(this);
|
late final Groups groups = Groups(this);
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
part of 'database.dart';
|
part of 'database.dart';
|
||||||
|
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
// MoorGenerator
|
// DriftDatabaseGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
// ignore_for_file: type=lint
|
||||||
|
@ -11,15 +11,6 @@ class Entrie extends DataClass implements Insertable<Entrie> {
|
||||||
final int id;
|
final int id;
|
||||||
final String value;
|
final String value;
|
||||||
Entrie({required this.id, required this.value});
|
Entrie({required this.id, required this.value});
|
||||||
factory Entrie.fromData(Map<String, dynamic> data, {String? prefix}) {
|
|
||||||
final effectivePrefix = prefix ?? '';
|
|
||||||
return Entrie(
|
|
||||||
id: const IntType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}id'])!,
|
|
||||||
value: const StringType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}text'])!,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@override
|
@override
|
||||||
Map<String, Expression> toColumns(bool nullToAbsent) {
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
||||||
final map = <String, Expression>{};
|
final map = <String, Expression>{};
|
||||||
|
@ -129,15 +120,15 @@ class Entries extends Table with TableInfo<Entries, Entrie> {
|
||||||
final String? _alias;
|
final String? _alias;
|
||||||
Entries(this.attachedDatabase, [this._alias]);
|
Entries(this.attachedDatabase, [this._alias]);
|
||||||
final VerificationMeta _idMeta = const VerificationMeta('id');
|
final VerificationMeta _idMeta = const VerificationMeta('id');
|
||||||
late final GeneratedColumn<int?> id = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
||||||
'id', aliasedName, false,
|
'id', aliasedName, false,
|
||||||
type: const IntType(),
|
type: DriftSqlType.int,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
$customConstraints: 'PRIMARY KEY');
|
$customConstraints: 'PRIMARY KEY');
|
||||||
final VerificationMeta _valueMeta = const VerificationMeta('value');
|
final VerificationMeta _valueMeta = const VerificationMeta('value');
|
||||||
late final GeneratedColumn<String?> value = GeneratedColumn<String?>(
|
late final GeneratedColumn<String> value = GeneratedColumn<String>(
|
||||||
'text', aliasedName, false,
|
'text', aliasedName, false,
|
||||||
type: const StringType(),
|
type: DriftSqlType.string,
|
||||||
requiredDuringInsert: true,
|
requiredDuringInsert: true,
|
||||||
$customConstraints: 'NOT NULL');
|
$customConstraints: 'NOT NULL');
|
||||||
@override
|
@override
|
||||||
|
@ -167,8 +158,13 @@ class Entries extends Table with TableInfo<Entries, Entrie> {
|
||||||
Set<GeneratedColumn> get $primaryKey => {id};
|
Set<GeneratedColumn> get $primaryKey => {id};
|
||||||
@override
|
@override
|
||||||
Entrie map(Map<String, dynamic> data, {String? tablePrefix}) {
|
Entrie map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||||
return Entrie.fromData(data,
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||||
prefix: tablePrefix != null ? '$tablePrefix.' : null);
|
return Entrie(
|
||||||
|
id: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.int, data['${effectivePrefix}id'])!,
|
||||||
|
value: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.string, data['${effectivePrefix}text'])!,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -181,7 +177,7 @@ class Entries extends Table with TableInfo<Entries, Entrie> {
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class _$MyDatabase extends GeneratedDatabase {
|
abstract class _$MyDatabase extends GeneratedDatabase {
|
||||||
_$MyDatabase(QueryExecutor e) : super(SqlTypeSystem.defaultInstance, e);
|
_$MyDatabase(QueryExecutor e) : super(e);
|
||||||
_$MyDatabase.connect(DatabaseConnection c) : super.connect(c);
|
_$MyDatabase.connect(DatabaseConnection c) : super.connect(c);
|
||||||
late final Entries entries = Entries(this);
|
late final Entries entries = Entries(this);
|
||||||
Selectable<Entrie> allEntries() {
|
Selectable<Entrie> allEntries() {
|
||||||
|
@ -192,7 +188,7 @@ abstract class _$MyDatabase extends GeneratedDatabase {
|
||||||
|
|
||||||
Future<int> addEntry(String var1) {
|
Future<int> addEntry(String var1) {
|
||||||
return customInsert(
|
return customInsert(
|
||||||
'INSERT INTO entries (text) VALUES (@1)',
|
'INSERT INTO entries (text) VALUES (?1)',
|
||||||
variables: [Variable<String>(var1)],
|
variables: [Variable<String>(var1)],
|
||||||
updates: {entries},
|
updates: {entries},
|
||||||
);
|
);
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
part of 'database.dart';
|
part of 'database.dart';
|
||||||
|
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
// MoorGenerator
|
// DriftDatabaseGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
// ignore_for_file: type=lint
|
||||||
|
@ -11,15 +11,6 @@ class User extends DataClass implements Insertable<User> {
|
||||||
final int id;
|
final int id;
|
||||||
final String name;
|
final String name;
|
||||||
User({required this.id, required this.name});
|
User({required this.id, required this.name});
|
||||||
factory User.fromData(Map<String, dynamic> data, {String? prefix}) {
|
|
||||||
final effectivePrefix = prefix ?? '';
|
|
||||||
return User(
|
|
||||||
id: const IntType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}id'])!,
|
|
||||||
name: const StringType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}name'])!,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@override
|
@override
|
||||||
Map<String, Expression> toColumns(bool nullToAbsent) {
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
||||||
final map = <String, Expression>{};
|
final map = <String, Expression>{};
|
||||||
|
@ -129,15 +120,15 @@ class Users extends Table with TableInfo<Users, User> {
|
||||||
final String? _alias;
|
final String? _alias;
|
||||||
Users(this.attachedDatabase, [this._alias]);
|
Users(this.attachedDatabase, [this._alias]);
|
||||||
final VerificationMeta _idMeta = const VerificationMeta('id');
|
final VerificationMeta _idMeta = const VerificationMeta('id');
|
||||||
late final GeneratedColumn<int?> id = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
||||||
'id', aliasedName, false,
|
'id', aliasedName, false,
|
||||||
type: const IntType(),
|
type: DriftSqlType.int,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
$customConstraints: 'NOT NULL PRIMARY KEY AUTOINCREMENT');
|
$customConstraints: 'NOT NULL PRIMARY KEY AUTOINCREMENT');
|
||||||
final VerificationMeta _nameMeta = const VerificationMeta('name');
|
final VerificationMeta _nameMeta = const VerificationMeta('name');
|
||||||
late final GeneratedColumn<String?> name = GeneratedColumn<String?>(
|
late final GeneratedColumn<String> name = GeneratedColumn<String>(
|
||||||
'name', aliasedName, false,
|
'name', aliasedName, false,
|
||||||
type: const StringType(),
|
type: DriftSqlType.string,
|
||||||
requiredDuringInsert: true,
|
requiredDuringInsert: true,
|
||||||
$customConstraints: 'NOT NULL');
|
$customConstraints: 'NOT NULL');
|
||||||
@override
|
@override
|
||||||
|
@ -167,8 +158,13 @@ class Users extends Table with TableInfo<Users, User> {
|
||||||
Set<GeneratedColumn> get $primaryKey => {id};
|
Set<GeneratedColumn> get $primaryKey => {id};
|
||||||
@override
|
@override
|
||||||
User map(Map<String, dynamic> data, {String? tablePrefix}) {
|
User map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||||
return User.fromData(data,
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||||
prefix: tablePrefix != null ? '$tablePrefix.' : null);
|
return User(
|
||||||
|
id: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.int, data['${effectivePrefix}id'])!,
|
||||||
|
name: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.string, data['${effectivePrefix}name'])!,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -181,7 +177,7 @@ class Users extends Table with TableInfo<Users, User> {
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class _$Database extends GeneratedDatabase {
|
abstract class _$Database extends GeneratedDatabase {
|
||||||
_$Database(QueryExecutor e) : super(SqlTypeSystem.defaultInstance, e);
|
_$Database(QueryExecutor e) : super(e);
|
||||||
late final Users users = Users(this);
|
late final Users users = Users(this);
|
||||||
@override
|
@override
|
||||||
Iterable<TableInfo> get allTables => allSchemaEntities.whereType<TableInfo>();
|
Iterable<TableInfo> get allTables => allSchemaEntities.whereType<TableInfo>();
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
part of 'database.dart';
|
part of 'database.dart';
|
||||||
|
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
// MoorGenerator
|
// DriftDatabaseGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
// ignore_for_file: type=lint
|
||||||
|
@ -11,15 +11,6 @@ class KeyValue extends DataClass implements Insertable<KeyValue> {
|
||||||
final String key;
|
final String key;
|
||||||
final String value;
|
final String value;
|
||||||
KeyValue({required this.key, required this.value});
|
KeyValue({required this.key, required this.value});
|
||||||
factory KeyValue.fromData(Map<String, dynamic> data, {String? prefix}) {
|
|
||||||
final effectivePrefix = prefix ?? '';
|
|
||||||
return KeyValue(
|
|
||||||
key: const StringType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}key'])!,
|
|
||||||
value: const StringType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}value'])!,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@override
|
@override
|
||||||
Map<String, Expression> toColumns(bool nullToAbsent) {
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
||||||
final map = <String, Expression>{};
|
final map = <String, Expression>{};
|
||||||
|
@ -132,14 +123,14 @@ class $KeyValuesTable extends KeyValues
|
||||||
$KeyValuesTable(this.attachedDatabase, [this._alias]);
|
$KeyValuesTable(this.attachedDatabase, [this._alias]);
|
||||||
final VerificationMeta _keyMeta = const VerificationMeta('key');
|
final VerificationMeta _keyMeta = const VerificationMeta('key');
|
||||||
@override
|
@override
|
||||||
late final GeneratedColumn<String?> key = GeneratedColumn<String?>(
|
late final GeneratedColumn<String> key = GeneratedColumn<String>(
|
||||||
'key', aliasedName, false,
|
'key', aliasedName, false,
|
||||||
type: const StringType(), requiredDuringInsert: true);
|
type: DriftSqlType.string, requiredDuringInsert: true);
|
||||||
final VerificationMeta _valueMeta = const VerificationMeta('value');
|
final VerificationMeta _valueMeta = const VerificationMeta('value');
|
||||||
@override
|
@override
|
||||||
late final GeneratedColumn<String?> value = GeneratedColumn<String?>(
|
late final GeneratedColumn<String> value = GeneratedColumn<String>(
|
||||||
'value', aliasedName, false,
|
'value', aliasedName, false,
|
||||||
type: const StringType(), requiredDuringInsert: true);
|
type: DriftSqlType.string, requiredDuringInsert: true);
|
||||||
@override
|
@override
|
||||||
List<GeneratedColumn> get $columns => [key, value];
|
List<GeneratedColumn> get $columns => [key, value];
|
||||||
@override
|
@override
|
||||||
|
@ -170,8 +161,13 @@ class $KeyValuesTable extends KeyValues
|
||||||
Set<GeneratedColumn> get $primaryKey => {key};
|
Set<GeneratedColumn> get $primaryKey => {key};
|
||||||
@override
|
@override
|
||||||
KeyValue map(Map<String, dynamic> data, {String? tablePrefix}) {
|
KeyValue map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||||
return KeyValue.fromData(data,
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||||
prefix: tablePrefix != null ? '$tablePrefix.' : null);
|
return KeyValue(
|
||||||
|
key: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.string, data['${effectivePrefix}key'])!,
|
||||||
|
value: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.string, data['${effectivePrefix}value'])!,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -181,7 +177,7 @@ class $KeyValuesTable extends KeyValues
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class _$Database extends GeneratedDatabase {
|
abstract class _$Database extends GeneratedDatabase {
|
||||||
_$Database(QueryExecutor e) : super(SqlTypeSystem.defaultInstance, e);
|
_$Database(QueryExecutor e) : super(e);
|
||||||
late final $KeyValuesTable keyValues = $KeyValuesTable(this);
|
late final $KeyValuesTable keyValues = $KeyValuesTable(this);
|
||||||
@override
|
@override
|
||||||
Iterable<TableInfo> get allTables => allSchemaEntities.whereType<TableInfo>();
|
Iterable<TableInfo> get allTables => allSchemaEntities.whereType<TableInfo>();
|
||||||
|
|
|
@ -16,7 +16,7 @@ Map<String, dynamic> _$PreferencesToJson(Preferences instance) =>
|
||||||
};
|
};
|
||||||
|
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
// MoorGenerator
|
// DriftDatabaseGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
// ignore_for_file: type=lint
|
||||||
|
@ -37,21 +37,6 @@ class User extends DataClass implements Insertable<User> {
|
||||||
required this.birthDate,
|
required this.birthDate,
|
||||||
this.profilePicture,
|
this.profilePicture,
|
||||||
this.preferences});
|
this.preferences});
|
||||||
factory User.fromData(Map<String, dynamic> data, {String? prefix}) {
|
|
||||||
final effectivePrefix = prefix ?? '';
|
|
||||||
return User(
|
|
||||||
id: const IntType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}id'])!,
|
|
||||||
name: const StringType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}name'])!,
|
|
||||||
birthDate: const DateTimeType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}birth_date'])!,
|
|
||||||
profilePicture: const BlobType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}profile_picture']),
|
|
||||||
preferences: $UsersTable.$converter0.fromSql(const StringType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}preferences'])),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@override
|
@override
|
||||||
Map<String, Expression> toColumns(bool nullToAbsent) {
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
||||||
final map = <String, Expression>{};
|
final map = <String, Expression>{};
|
||||||
|
@ -59,11 +44,11 @@ class User extends DataClass implements Insertable<User> {
|
||||||
map['name'] = Variable<String>(name);
|
map['name'] = Variable<String>(name);
|
||||||
map['birth_date'] = Variable<DateTime>(birthDate);
|
map['birth_date'] = Variable<DateTime>(birthDate);
|
||||||
if (!nullToAbsent || profilePicture != null) {
|
if (!nullToAbsent || profilePicture != null) {
|
||||||
map['profile_picture'] = Variable<Uint8List?>(profilePicture);
|
map['profile_picture'] = Variable<Uint8List>(profilePicture);
|
||||||
}
|
}
|
||||||
if (!nullToAbsent || preferences != null) {
|
if (!nullToAbsent || preferences != null) {
|
||||||
final converter = $UsersTable.$converter0;
|
final converter = $UsersTable.$converter0;
|
||||||
map['preferences'] = Variable<String?>(converter.toSql(preferences));
|
map['preferences'] = Variable<String>(converter.toSql(preferences));
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
@ -175,7 +160,7 @@ class UsersCompanion extends UpdateCompanion<User> {
|
||||||
Expression<String>? name,
|
Expression<String>? name,
|
||||||
Expression<DateTime>? birthDate,
|
Expression<DateTime>? birthDate,
|
||||||
Expression<Uint8List>? profilePicture,
|
Expression<Uint8List>? profilePicture,
|
||||||
Expression<Preferences>? preferences,
|
Expression<String>? preferences,
|
||||||
}) {
|
}) {
|
||||||
return RawValuesInsertable({
|
return RawValuesInsertable({
|
||||||
if (id != null) 'id': id,
|
if (id != null) 'id': id,
|
||||||
|
@ -214,12 +199,11 @@ class UsersCompanion extends UpdateCompanion<User> {
|
||||||
map['birth_date'] = Variable<DateTime>(birthDate.value);
|
map['birth_date'] = Variable<DateTime>(birthDate.value);
|
||||||
}
|
}
|
||||||
if (profilePicture.present) {
|
if (profilePicture.present) {
|
||||||
map['profile_picture'] = Variable<Uint8List?>(profilePicture.value);
|
map['profile_picture'] = Variable<Uint8List>(profilePicture.value);
|
||||||
}
|
}
|
||||||
if (preferences.present) {
|
if (preferences.present) {
|
||||||
final converter = $UsersTable.$converter0;
|
final converter = $UsersTable.$converter0;
|
||||||
map['preferences'] =
|
map['preferences'] = Variable<String>(converter.toSql(preferences.value));
|
||||||
Variable<String?>(converter.toSql(preferences.value));
|
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
@ -244,33 +228,33 @@ class $UsersTable extends Users with TableInfo<$UsersTable, User> {
|
||||||
$UsersTable(this.attachedDatabase, [this._alias]);
|
$UsersTable(this.attachedDatabase, [this._alias]);
|
||||||
final VerificationMeta _idMeta = const VerificationMeta('id');
|
final VerificationMeta _idMeta = const VerificationMeta('id');
|
||||||
@override
|
@override
|
||||||
late final GeneratedColumn<int?> id = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
||||||
'id', aliasedName, false,
|
'id', aliasedName, false,
|
||||||
type: const IntType(),
|
type: DriftSqlType.int,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
defaultConstraints: 'PRIMARY KEY AUTOINCREMENT');
|
defaultConstraints: 'PRIMARY KEY AUTOINCREMENT');
|
||||||
final VerificationMeta _nameMeta = const VerificationMeta('name');
|
final VerificationMeta _nameMeta = const VerificationMeta('name');
|
||||||
@override
|
@override
|
||||||
late final GeneratedColumn<String?> name = GeneratedColumn<String?>(
|
late final GeneratedColumn<String> name = GeneratedColumn<String>(
|
||||||
'name', aliasedName, false,
|
'name', aliasedName, false,
|
||||||
type: const StringType(), requiredDuringInsert: true);
|
type: DriftSqlType.string, requiredDuringInsert: true);
|
||||||
final VerificationMeta _birthDateMeta = const VerificationMeta('birthDate');
|
final VerificationMeta _birthDateMeta = const VerificationMeta('birthDate');
|
||||||
@override
|
@override
|
||||||
late final GeneratedColumn<DateTime?> birthDate = GeneratedColumn<DateTime?>(
|
late final GeneratedColumn<DateTime> birthDate = GeneratedColumn<DateTime>(
|
||||||
'birth_date', aliasedName, false,
|
'birth_date', aliasedName, false,
|
||||||
type: const IntType(), requiredDuringInsert: true);
|
type: DriftSqlType.dateTime, requiredDuringInsert: true);
|
||||||
final VerificationMeta _profilePictureMeta =
|
final VerificationMeta _profilePictureMeta =
|
||||||
const VerificationMeta('profilePicture');
|
const VerificationMeta('profilePicture');
|
||||||
@override
|
@override
|
||||||
late final GeneratedColumn<Uint8List?> profilePicture =
|
late final GeneratedColumn<Uint8List> profilePicture =
|
||||||
GeneratedColumn<Uint8List?>('profile_picture', aliasedName, true,
|
GeneratedColumn<Uint8List>('profile_picture', aliasedName, true,
|
||||||
type: const BlobType(), requiredDuringInsert: false);
|
type: DriftSqlType.blob, requiredDuringInsert: false);
|
||||||
final VerificationMeta _preferencesMeta =
|
final VerificationMeta _preferencesMeta =
|
||||||
const VerificationMeta('preferences');
|
const VerificationMeta('preferences');
|
||||||
@override
|
@override
|
||||||
late final GeneratedColumnWithTypeConverter<Preferences?, String?>
|
late final GeneratedColumnWithTypeConverter<Preferences?, String>
|
||||||
preferences = GeneratedColumn<String?>('preferences', aliasedName, true,
|
preferences = GeneratedColumn<String>('preferences', aliasedName, true,
|
||||||
type: const StringType(), requiredDuringInsert: false)
|
type: DriftSqlType.string, requiredDuringInsert: false)
|
||||||
.withConverter<Preferences?>($UsersTable.$converter0);
|
.withConverter<Preferences?>($UsersTable.$converter0);
|
||||||
@override
|
@override
|
||||||
List<GeneratedColumn> get $columns =>
|
List<GeneratedColumn> get $columns =>
|
||||||
|
@ -313,8 +297,20 @@ class $UsersTable extends Users with TableInfo<$UsersTable, User> {
|
||||||
Set<GeneratedColumn> get $primaryKey => {id};
|
Set<GeneratedColumn> get $primaryKey => {id};
|
||||||
@override
|
@override
|
||||||
User map(Map<String, dynamic> data, {String? tablePrefix}) {
|
User map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||||
return User.fromData(data,
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||||
prefix: tablePrefix != null ? '$tablePrefix.' : null);
|
return User(
|
||||||
|
id: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.int, data['${effectivePrefix}id'])!,
|
||||||
|
name: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.string, data['${effectivePrefix}name'])!,
|
||||||
|
birthDate: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.dateTime, data['${effectivePrefix}birth_date'])!,
|
||||||
|
profilePicture: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.blob, data['${effectivePrefix}profile_picture']),
|
||||||
|
preferences: $UsersTable.$converter0.fromSql(attachedDatabase
|
||||||
|
.options.types
|
||||||
|
.read(DriftSqlType.string, data['${effectivePrefix}preferences'])),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -334,17 +330,6 @@ class Friendship extends DataClass implements Insertable<Friendship> {
|
||||||
{required this.firstUser,
|
{required this.firstUser,
|
||||||
required this.secondUser,
|
required this.secondUser,
|
||||||
required this.reallyGoodFriends});
|
required this.reallyGoodFriends});
|
||||||
factory Friendship.fromData(Map<String, dynamic> data, {String? prefix}) {
|
|
||||||
final effectivePrefix = prefix ?? '';
|
|
||||||
return Friendship(
|
|
||||||
firstUser: const IntType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}first_user'])!,
|
|
||||||
secondUser: const IntType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}second_user'])!,
|
|
||||||
reallyGoodFriends: const BoolType().mapFromDatabaseResponse(
|
|
||||||
data['${effectivePrefix}really_good_friends'])!,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@override
|
@override
|
||||||
Map<String, Expression> toColumns(bool nullToAbsent) {
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
||||||
final map = <String, Expression>{};
|
final map = <String, Expression>{};
|
||||||
|
@ -486,20 +471,20 @@ class $FriendshipsTable extends Friendships
|
||||||
$FriendshipsTable(this.attachedDatabase, [this._alias]);
|
$FriendshipsTable(this.attachedDatabase, [this._alias]);
|
||||||
final VerificationMeta _firstUserMeta = const VerificationMeta('firstUser');
|
final VerificationMeta _firstUserMeta = const VerificationMeta('firstUser');
|
||||||
@override
|
@override
|
||||||
late final GeneratedColumn<int?> firstUser = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> firstUser = GeneratedColumn<int>(
|
||||||
'first_user', aliasedName, false,
|
'first_user', aliasedName, false,
|
||||||
type: const IntType(), requiredDuringInsert: true);
|
type: DriftSqlType.int, requiredDuringInsert: true);
|
||||||
final VerificationMeta _secondUserMeta = const VerificationMeta('secondUser');
|
final VerificationMeta _secondUserMeta = const VerificationMeta('secondUser');
|
||||||
@override
|
@override
|
||||||
late final GeneratedColumn<int?> secondUser = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> secondUser = GeneratedColumn<int>(
|
||||||
'second_user', aliasedName, false,
|
'second_user', aliasedName, false,
|
||||||
type: const IntType(), requiredDuringInsert: true);
|
type: DriftSqlType.int, requiredDuringInsert: true);
|
||||||
final VerificationMeta _reallyGoodFriendsMeta =
|
final VerificationMeta _reallyGoodFriendsMeta =
|
||||||
const VerificationMeta('reallyGoodFriends');
|
const VerificationMeta('reallyGoodFriends');
|
||||||
@override
|
@override
|
||||||
late final GeneratedColumn<bool?> reallyGoodFriends = GeneratedColumn<bool?>(
|
late final GeneratedColumn<bool> reallyGoodFriends = GeneratedColumn<bool>(
|
||||||
'really_good_friends', aliasedName, false,
|
'really_good_friends', aliasedName, false,
|
||||||
type: const BoolType(),
|
type: DriftSqlType.bool,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
defaultConstraints: 'CHECK (really_good_friends IN (0, 1))',
|
defaultConstraints: 'CHECK (really_good_friends IN (0, 1))',
|
||||||
defaultValue: const Constant(false));
|
defaultValue: const Constant(false));
|
||||||
|
@ -542,8 +527,15 @@ class $FriendshipsTable extends Friendships
|
||||||
Set<GeneratedColumn> get $primaryKey => {firstUser, secondUser};
|
Set<GeneratedColumn> get $primaryKey => {firstUser, secondUser};
|
||||||
@override
|
@override
|
||||||
Friendship map(Map<String, dynamic> data, {String? tablePrefix}) {
|
Friendship map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||||
return Friendship.fromData(data,
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||||
prefix: tablePrefix != null ? '$tablePrefix.' : null);
|
return Friendship(
|
||||||
|
firstUser: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.int, data['${effectivePrefix}first_user'])!,
|
||||||
|
secondUser: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.int, data['${effectivePrefix}second_user'])!,
|
||||||
|
reallyGoodFriends: attachedDatabase.options.types.read(
|
||||||
|
DriftSqlType.bool, data['${effectivePrefix}really_good_friends'])!,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -553,7 +545,7 @@ class $FriendshipsTable extends Friendships
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class _$Database extends GeneratedDatabase {
|
abstract class _$Database extends GeneratedDatabase {
|
||||||
_$Database(QueryExecutor e) : super(SqlTypeSystem.defaultInstance, e);
|
_$Database(QueryExecutor e) : super(e);
|
||||||
_$Database.connect(DatabaseConnection c) : super.connect(c);
|
_$Database.connect(DatabaseConnection c) : super.connect(c);
|
||||||
late final $UsersTable users = $UsersTable(this);
|
late final $UsersTable users = $UsersTable(this);
|
||||||
late final $FriendshipsTable friendships = $FriendshipsTable(this);
|
late final $FriendshipsTable friendships = $FriendshipsTable(this);
|
||||||
|
@ -612,8 +604,8 @@ abstract class _$Database extends GeneratedDatabase {
|
||||||
],
|
],
|
||||||
readsFrom: {
|
readsFrom: {
|
||||||
users,
|
users,
|
||||||
}).map((QueryRow row) =>
|
}).map((QueryRow row) => $UsersTable.$converter0
|
||||||
$UsersTable.$converter0.fromSql(row.read<String?>('preferences')));
|
.fromSql(row.readNullable<String>('preferences')));
|
||||||
}
|
}
|
||||||
|
|
||||||
Selectable<User> usersById(List<int> var1) {
|
Selectable<User> usersById(List<int> var1) {
|
||||||
|
|
|
@ -235,8 +235,7 @@ Future<void> _testWith(DriftWebStorage storage) async {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _FakeDatabase extends GeneratedDatabase {
|
class _FakeDatabase extends GeneratedDatabase {
|
||||||
_FakeDatabase(QueryExecutor executor)
|
_FakeDatabase(QueryExecutor executor) : super(executor);
|
||||||
: super(const SqlTypeSystem.withDefaults(), executor);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Iterable<TableInfo<Table, DataClass>> get allTables => const [];
|
Iterable<TableInfo<Table, DataClass>> get allTables => const [];
|
||||||
|
|
|
@ -3,20 +3,13 @@
|
||||||
part of 'saves_after_migration_regression_test.dart';
|
part of 'saves_after_migration_regression_test.dart';
|
||||||
|
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
// MoorGenerator
|
// DriftDatabaseGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
// ignore_for_file: type=lint
|
||||||
class Foo extends DataClass implements Insertable<Foo> {
|
class Foo extends DataClass implements Insertable<Foo> {
|
||||||
final int id;
|
final int id;
|
||||||
Foo({required this.id});
|
Foo({required this.id});
|
||||||
factory Foo.fromData(Map<String, dynamic> data, {String? prefix}) {
|
|
||||||
final effectivePrefix = prefix ?? '';
|
|
||||||
return Foo(
|
|
||||||
id: const IntType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}id'])!,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@override
|
@override
|
||||||
Map<String, Expression> toColumns(bool nullToAbsent) {
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
||||||
final map = <String, Expression>{};
|
final map = <String, Expression>{};
|
||||||
|
@ -110,9 +103,9 @@ class $FoosTable extends Foos with TableInfo<$FoosTable, Foo> {
|
||||||
$FoosTable(this.attachedDatabase, [this._alias]);
|
$FoosTable(this.attachedDatabase, [this._alias]);
|
||||||
final VerificationMeta _idMeta = const VerificationMeta('id');
|
final VerificationMeta _idMeta = const VerificationMeta('id');
|
||||||
@override
|
@override
|
||||||
late final GeneratedColumn<int?> id = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
||||||
'id', aliasedName, false,
|
'id', aliasedName, false,
|
||||||
type: const IntType(),
|
type: DriftSqlType.int,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
defaultConstraints: 'PRIMARY KEY AUTOINCREMENT');
|
defaultConstraints: 'PRIMARY KEY AUTOINCREMENT');
|
||||||
@override
|
@override
|
||||||
|
@ -136,8 +129,11 @@ class $FoosTable extends Foos with TableInfo<$FoosTable, Foo> {
|
||||||
Set<GeneratedColumn> get $primaryKey => {id};
|
Set<GeneratedColumn> get $primaryKey => {id};
|
||||||
@override
|
@override
|
||||||
Foo map(Map<String, dynamic> data, {String? tablePrefix}) {
|
Foo map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||||
return Foo.fromData(data,
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||||
prefix: tablePrefix != null ? '$tablePrefix.' : null);
|
return Foo(
|
||||||
|
id: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.int, data['${effectivePrefix}id'])!,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -149,13 +145,6 @@ class $FoosTable extends Foos with TableInfo<$FoosTable, Foo> {
|
||||||
class Bar extends DataClass implements Insertable<Bar> {
|
class Bar extends DataClass implements Insertable<Bar> {
|
||||||
final int id;
|
final int id;
|
||||||
Bar({required this.id});
|
Bar({required this.id});
|
||||||
factory Bar.fromData(Map<String, dynamic> data, {String? prefix}) {
|
|
||||||
final effectivePrefix = prefix ?? '';
|
|
||||||
return Bar(
|
|
||||||
id: const IntType()
|
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}id'])!,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@override
|
@override
|
||||||
Map<String, Expression> toColumns(bool nullToAbsent) {
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
||||||
final map = <String, Expression>{};
|
final map = <String, Expression>{};
|
||||||
|
@ -249,9 +238,9 @@ class $BarsTable extends Bars with TableInfo<$BarsTable, Bar> {
|
||||||
$BarsTable(this.attachedDatabase, [this._alias]);
|
$BarsTable(this.attachedDatabase, [this._alias]);
|
||||||
final VerificationMeta _idMeta = const VerificationMeta('id');
|
final VerificationMeta _idMeta = const VerificationMeta('id');
|
||||||
@override
|
@override
|
||||||
late final GeneratedColumn<int?> id = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
||||||
'id', aliasedName, false,
|
'id', aliasedName, false,
|
||||||
type: const IntType(),
|
type: DriftSqlType.int,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
defaultConstraints: 'PRIMARY KEY AUTOINCREMENT');
|
defaultConstraints: 'PRIMARY KEY AUTOINCREMENT');
|
||||||
@override
|
@override
|
||||||
|
@ -275,8 +264,11 @@ class $BarsTable extends Bars with TableInfo<$BarsTable, Bar> {
|
||||||
Set<GeneratedColumn> get $primaryKey => {id};
|
Set<GeneratedColumn> get $primaryKey => {id};
|
||||||
@override
|
@override
|
||||||
Bar map(Map<String, dynamic> data, {String? tablePrefix}) {
|
Bar map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||||
return Bar.fromData(data,
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||||
prefix: tablePrefix != null ? '$tablePrefix.' : null);
|
return Bar(
|
||||||
|
id: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.int, data['${effectivePrefix}id'])!,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -286,7 +278,7 @@ class $BarsTable extends Bars with TableInfo<$BarsTable, Bar> {
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class _$_FakeDb extends GeneratedDatabase {
|
abstract class _$_FakeDb extends GeneratedDatabase {
|
||||||
_$_FakeDb(QueryExecutor e) : super(SqlTypeSystem.defaultInstance, e);
|
_$_FakeDb(QueryExecutor e) : super(e);
|
||||||
late final $FoosTable foos = $FoosTable(this);
|
late final $FoosTable foos = $FoosTable(this);
|
||||||
late final $BarsTable bars = $BarsTable(this);
|
late final $BarsTable bars = $BarsTable(this);
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -199,11 +199,11 @@ class $TodosTable extends Todos with TableInfo<$TodosTable, TodoEntry> {
|
||||||
'content', aliasedName, false,
|
'content', aliasedName, false,
|
||||||
typeName: 'TEXT', requiredDuringInsert: true);
|
typeName: 'TEXT', requiredDuringInsert: true);
|
||||||
final VerificationMeta _targetDateMeta = const VerificationMeta('targetDate');
|
final VerificationMeta _targetDateMeta = const VerificationMeta('targetDate');
|
||||||
late final GeneratedColumn<DateTime?> targetDate = GeneratedColumn<DateTime?>(
|
late final GeneratedColumn<DateTime> targetDate = GeneratedColumn<DateTime>(
|
||||||
'target_date', aliasedName, true,
|
'target_date', aliasedName, true,
|
||||||
typeName: 'INTEGER', requiredDuringInsert: false);
|
typeName: 'INTEGER', requiredDuringInsert: false);
|
||||||
final VerificationMeta _categoryMeta = const VerificationMeta('category');
|
final VerificationMeta _categoryMeta = const VerificationMeta('category');
|
||||||
late final GeneratedColumn<int?> category = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> category = GeneratedColumn<int>(
|
||||||
'category', aliasedName, true,
|
'category', aliasedName, true,
|
||||||
typeName: 'INTEGER',
|
typeName: 'INTEGER',
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
|
@ -380,7 +380,7 @@ class $CategoriesTable extends Categories
|
||||||
final String? _alias;
|
final String? _alias;
|
||||||
$CategoriesTable(this._db, [this._alias]);
|
$CategoriesTable(this._db, [this._alias]);
|
||||||
final VerificationMeta _idMeta = const VerificationMeta('id');
|
final VerificationMeta _idMeta = const VerificationMeta('id');
|
||||||
late final GeneratedColumn<int?> id = GeneratedColumn<int?>(
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
||||||
'id', aliasedName, false,
|
'id', aliasedName, false,
|
||||||
typeName: 'INTEGER',
|
typeName: 'INTEGER',
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
|
|
Loading…
Reference in New Issue