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