diff --git a/drift/lib/src/runtime/devtools/shared.g.dart b/drift/lib/src/runtime/devtools/shared.g.dart deleted file mode 100644 index f74fcb71..00000000 --- a/drift/lib/src/runtime/devtools/shared.g.dart +++ /dev/null @@ -1,77 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'shared.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -TypeDescription _$TypeDescriptionFromJson(Map json) => - TypeDescription( - type: $enumDecodeNullable(_$DriftSqlTypeEnumMap, json['type']), - customTypeName: json['customTypeName'] as String?, - ); - -Map _$TypeDescriptionToJson(TypeDescription instance) => - { - 'type': _$DriftSqlTypeEnumMap[instance.type], - 'customTypeName': instance.customTypeName, - }; - -const _$DriftSqlTypeEnumMap = { - DriftSqlType.bool: 'bool', - DriftSqlType.string: 'string', - DriftSqlType.bigInt: 'bigInt', - DriftSqlType.int: 'int', - DriftSqlType.dateTime: 'dateTime', - DriftSqlType.blob: 'blob', - DriftSqlType.double: 'double', - DriftSqlType.any: 'any', -}; - -ColumnDescription _$ColumnDescriptionFromJson(Map json) => - ColumnDescription( - name: json['name'] as String, - type: json['type'] == null - ? null - : TypeDescription.fromJson(json['type'] as Map), - isNullable: json['isNullable'] as bool, - ); - -Map _$ColumnDescriptionToJson(ColumnDescription instance) => - { - 'name': instance.name, - 'type': instance.type, - 'isNullable': instance.isNullable, - }; - -EntityDescription _$EntityDescriptionFromJson(Map json) => - EntityDescription( - name: json['name'] as String, - type: json['type'] as String, - columns: (json['columns'] as List?) - ?.map((e) => ColumnDescription.fromJson(e as Map)) - .toList(), - ); - -Map _$EntityDescriptionToJson(EntityDescription instance) => - { - 'name': instance.name, - 'type': instance.type, - 'columns': instance.columns, - }; - -DatabaseDescription _$DatabaseDescriptionFromJson(Map json) => - DatabaseDescription( - dateTimeAsText: json['dateTimeAsText'] as bool, - entities: (json['entities'] as List) - .map((e) => EntityDescription.fromJson(e as Map)) - .toList(), - ); - -Map _$DatabaseDescriptionToJson( - DatabaseDescription instance) => - { - 'dateTimeAsText': instance.dateTimeAsText, - 'entities': instance.entities, - }; diff --git a/drift/test/test_utils/test_utils.mocks.dart b/drift/test/test_utils/test_utils.mocks.dart index fad373d8..0e96ecb1 100644 --- a/drift/test/test_utils/test_utils.mocks.dart +++ b/drift/test/test_utils/test_utils.mocks.dart @@ -64,6 +64,7 @@ class MockDatabaseDelegate extends _i1.Mock implements _i2.DatabaseDelegate { returnValue: false, returnValueForMissingStub: false, ) as bool); + @override set isInTransaction(bool? _isInTransaction) => super.noSuchMethod( Invocation.setter( @@ -72,6 +73,7 @@ class MockDatabaseDelegate extends _i1.Mock implements _i2.DatabaseDelegate { ), returnValueForMissingStub: null, ); + @override _i2.DbVersionDelegate get versionDelegate => (super.noSuchMethod( Invocation.getter(#versionDelegate), @@ -84,6 +86,7 @@ class MockDatabaseDelegate extends _i1.Mock implements _i2.DatabaseDelegate { Invocation.getter(#versionDelegate), ), ) as _i2.DbVersionDelegate); + @override _i2.TransactionDelegate get transactionDelegate => (super.noSuchMethod( Invocation.getter(#transactionDelegate), @@ -96,12 +99,14 @@ class MockDatabaseDelegate extends _i1.Mock implements _i2.DatabaseDelegate { Invocation.getter(#transactionDelegate), ), ) as _i2.TransactionDelegate); + @override _i4.FutureOr get isOpen => (super.noSuchMethod( Invocation.getter(#isOpen), returnValue: _i4.Future.value(false), returnValueForMissingStub: _i4.Future.value(false), ) as _i4.FutureOr); + @override _i4.Future open(_i5.QueryExecutorUser? db) => (super.noSuchMethod( Invocation.method( @@ -111,6 +116,7 @@ class MockDatabaseDelegate extends _i1.Mock implements _i2.DatabaseDelegate { returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); + @override _i4.Future close() => (super.noSuchMethod( Invocation.method( @@ -120,6 +126,7 @@ class MockDatabaseDelegate extends _i1.Mock implements _i2.DatabaseDelegate { returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); + @override void notifyDatabaseOpened(_i5.OpeningDetails? details) => super.noSuchMethod( Invocation.method( @@ -128,6 +135,7 @@ class MockDatabaseDelegate extends _i1.Mock implements _i2.DatabaseDelegate { ), returnValueForMissingStub: null, ); + @override _i4.Future<_i3.QueryResult> runSelect( String? statement, @@ -163,6 +171,7 @@ class MockDatabaseDelegate extends _i1.Mock implements _i2.DatabaseDelegate { ), )), ) as _i4.Future<_i3.QueryResult>); + @override _i4.Future runUpdate( String? statement, @@ -179,6 +188,7 @@ class MockDatabaseDelegate extends _i1.Mock implements _i2.DatabaseDelegate { returnValue: _i4.Future.value(0), returnValueForMissingStub: _i4.Future.value(0), ) as _i4.Future); + @override _i4.Future runInsert( String? statement, @@ -195,6 +205,7 @@ class MockDatabaseDelegate extends _i1.Mock implements _i2.DatabaseDelegate { returnValue: _i4.Future.value(0), returnValueForMissingStub: _i4.Future.value(0), ) as _i4.Future); + @override _i4.Future runCustom( String? statement, @@ -211,6 +222,7 @@ class MockDatabaseDelegate extends _i1.Mock implements _i2.DatabaseDelegate { returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); + @override _i4.Future runBatched(_i5.BatchedStatements? statements) => (super.noSuchMethod( @@ -234,6 +246,7 @@ class MockDynamicVersionDelegate extends _i1.Mock returnValue: _i4.Future.value(0), returnValueForMissingStub: _i4.Future.value(0), ) as _i4.Future); + @override _i4.Future setSchemaVersion(int? version) => (super.noSuchMethod( Invocation.method( @@ -256,6 +269,7 @@ class MockSupportedTransactionDelegate extends _i1.Mock returnValue: false, returnValueForMissingStub: false, ) as bool); + @override _i4.FutureOr startTransaction( _i4.Future Function(_i2.QueryDelegate)? run) => @@ -284,6 +298,7 @@ class MockStreamQueries extends _i1.Mock implements _i6.StreamQueryStore { returnValueForMissingStub: _i4.Stream>>.empty(), ) as _i4.Stream>>); + @override _i4.Stream> updatesForSync( _i5.TableUpdateQuery? query) => @@ -295,6 +310,7 @@ class MockStreamQueries extends _i1.Mock implements _i6.StreamQueryStore { returnValue: _i4.Stream>.empty(), returnValueForMissingStub: _i4.Stream>.empty(), ) as _i4.Stream>); + @override void handleTableUpdates(Set<_i5.TableUpdate>? updates) => super.noSuchMethod( Invocation.method( @@ -303,6 +319,7 @@ class MockStreamQueries extends _i1.Mock implements _i6.StreamQueryStore { ), returnValueForMissingStub: null, ); + @override void markAsClosed( _i6.QueryStream? stream, @@ -318,6 +335,7 @@ class MockStreamQueries extends _i1.Mock implements _i6.StreamQueryStore { ), returnValueForMissingStub: null, ); + @override void markAsOpened(_i6.QueryStream? stream) => super.noSuchMethod( Invocation.method( @@ -326,6 +344,7 @@ class MockStreamQueries extends _i1.Mock implements _i6.StreamQueryStore { ), returnValueForMissingStub: null, ); + @override _i4.Future close() => (super.noSuchMethod( Invocation.method( diff --git a/examples/app/lib/database/database.g.dart b/examples/app/lib/database/database.g.dart index 8a412b58..52aebbf6 100644 --- a/examples/app/lib/database/database.g.dart +++ b/examples/app/lib/database/database.g.dart @@ -32,9 +32,10 @@ class $CategoriesTable extends Categories @override List get $columns => [id, name, color]; @override - String get aliasedName => _alias ?? 'categories'; + String get aliasedName => _alias ?? actualTableName; @override - String get actualTableName => 'categories'; + String get actualTableName => $name; + static const String $name = 'categories'; @override VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { @@ -194,6 +195,7 @@ class CategoriesCompanion extends UpdateCompanion { } if (color.present) { final converter = $CategoriesTable.$convertercolor; + map['color'] = Variable(converter.toSql(color.value)); } return map; @@ -249,9 +251,10 @@ class $TodoEntriesTable extends TodoEntries @override List get $columns => [id, description, category, dueDate]; @override - String get aliasedName => _alias ?? 'todo_entries'; + String get aliasedName => _alias ?? actualTableName; @override - String get actualTableName => 'todo_entries'; + String get actualTableName => $name; + static const String $name = 'todo_entries'; @override VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { @@ -486,9 +489,10 @@ class TextEntries extends Table @override List get $columns => [description]; @override - String get aliasedName => _alias ?? 'text_entries'; + String get aliasedName => _alias ?? actualTableName; @override - String get actualTableName => 'text_entries'; + String get actualTableName => $name; + static const String $name = 'text_entries'; @override VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { diff --git a/examples/encryption/lib/database.g.dart b/examples/encryption/lib/database.g.dart index 123a6dce..bec75774 100644 --- a/examples/encryption/lib/database.g.dart +++ b/examples/encryption/lib/database.g.dart @@ -26,9 +26,10 @@ class $NotesTable extends Notes with TableInfo<$NotesTable, Note> { @override List get $columns => [id, content]; @override - String get aliasedName => _alias ?? 'notes'; + String get aliasedName => _alias ?? actualTableName; @override - String get actualTableName => 'notes'; + String get actualTableName => $name; + static const String $name = 'notes'; @override VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { diff --git a/examples/modular/lib/src/users.drift.dart b/examples/modular/lib/src/users.drift.dart index a2153113..f76dc728 100644 --- a/examples/modular/lib/src/users.drift.dart +++ b/examples/modular/lib/src/users.drift.dart @@ -292,6 +292,7 @@ class UsersCompanion extends i0.UpdateCompanion { } if (preferences.present) { final converter = i1.Users.$converterpreferencesn; + map['preferences'] = i0.Variable(converter.toSql(preferences.value)); } diff --git a/extras/integration_tests/drift_testcases/lib/database/database.g.dart b/extras/integration_tests/drift_testcases/lib/database/database.g.dart index 44742d05..0f25f1a7 100644 --- a/extras/integration_tests/drift_testcases/lib/database/database.g.dart +++ b/extras/integration_tests/drift_testcases/lib/database/database.g.dart @@ -295,6 +295,7 @@ class UsersCompanion extends UpdateCompanion { } if (preferences.present) { final converter = $UsersTable.$converterpreferences; + map['preferences'] = Variable(converter.toSql(preferences.value)); } return map;