diff --git a/drift_dev/lib/api/migrations.dart b/drift_dev/lib/api/migrations.dart index de93e90e..26431711 100644 --- a/drift_dev/lib/api/migrations.dart +++ b/drift_dev/lib/api/migrations.dart @@ -1,6 +1,6 @@ +import 'package:drift/drift.dart'; import 'package:drift_dev/src/services/schema/verifier_impl.dart'; import 'package:meta/meta.dart'; -import 'package:moor/moor.dart'; import 'package:sqlite3/sqlite3.dart'; abstract class SchemaVerifier { diff --git a/drift_dev/lib/src/analyzer/dart/parser.dart b/drift_dev/lib/src/analyzer/dart/parser.dart index e19621c9..bcdf74b8 100644 --- a/drift_dev/lib/src/analyzer/dart/parser.dart +++ b/drift_dev/lib/src/analyzer/dart/parser.dart @@ -3,6 +3,7 @@ import 'package:analyzer/dart/constant/value.dart'; import 'package:analyzer/dart/element/element.dart'; import 'package:analyzer/dart/element/type.dart'; import 'package:collection/collection.dart'; +import 'package:drift/sqlite_keywords.dart'; import 'package:drift_dev/moor_generator.dart'; import 'package:drift_dev/src/analyzer/errors.dart'; import 'package:drift_dev/src/analyzer/runner/steps.dart'; @@ -11,7 +12,6 @@ import 'package:drift_dev/src/model/used_type_converter.dart'; import 'package:drift_dev/src/utils/names.dart'; import 'package:drift_dev/src/utils/type_utils.dart'; import 'package:meta/meta.dart'; -import 'package:moor/sqlite_keywords.dart'; import 'package:recase/recase.dart'; import 'package:source_gen/source_gen.dart'; diff --git a/drift_dev/lib/src/analyzer/runner/steps.dart b/drift_dev/lib/src/analyzer/runner/steps.dart index be4c6e31..142ba0de 100644 --- a/drift_dev/lib/src/analyzer/runner/steps.dart +++ b/drift_dev/lib/src/analyzer/runner/steps.dart @@ -1,6 +1,7 @@ import 'package:analyzer/dart/constant/value.dart'; import 'package:analyzer/dart/element/element.dart'; import 'package:analyzer/dart/element/type.dart'; +import 'package:drift/drift.dart'; import 'package:drift_dev/moor_generator.dart'; import 'package:drift_dev/src/analyzer/dart/parser.dart'; import 'package:drift_dev/src/analyzer/errors.dart'; @@ -16,7 +17,6 @@ import 'package:drift_dev/src/analyzer/view/view_analyzer.dart'; import 'package:drift_dev/src/model/sql_query.dart'; import 'package:drift_dev/src/model/view.dart'; import 'package:drift_dev/src/utils/entity_reference_sorter.dart'; -import 'package:moor/moor.dart'; import 'package:source_gen/source_gen.dart'; part 'steps/analyze_dart.dart'; diff --git a/drift_dev/lib/src/analyzer/runner/steps/parse_dart.dart b/drift_dev/lib/src/analyzer/runner/steps/parse_dart.dart index 75849254..1f6b5530 100644 --- a/drift_dev/lib/src/analyzer/runner/steps/parse_dart.dart +++ b/drift_dev/lib/src/analyzer/runner/steps/parse_dart.dart @@ -9,8 +9,8 @@ part of '../steps.dart'; class ParseDartStep extends Step { static const _tableTypeChecker = TypeChecker.fromRuntime(Table); static const _generatedInfoChecker = TypeChecker.fromRuntime(TableInfo); - static const _useMoorChecker = TypeChecker.fromRuntime(UseMoor); - static const _useDaoChecker = TypeChecker.fromRuntime(UseDao); + static const _useMoorChecker = TypeChecker.fromRuntime(DriftDatabase); + static const _useDaoChecker = TypeChecker.fromRuntime(DriftAccessor); final LibraryElement library; diff --git a/drift_dev/lib/src/analyzer/sql_queries/type_mapping.dart b/drift_dev/lib/src/analyzer/sql_queries/type_mapping.dart index ba59bb08..3a9f8cc2 100644 --- a/drift_dev/lib/src/analyzer/sql_queries/type_mapping.dart +++ b/drift_dev/lib/src/analyzer/sql_queries/type_mapping.dart @@ -1,8 +1,8 @@ +import 'package:drift/drift.dart' as m; import 'package:drift_dev/moor_generator.dart'; import 'package:drift_dev/src/model/sql_query.dart'; import 'package:drift_dev/src/model/view.dart'; import 'package:drift_dev/src/utils/type_converter_hint.dart'; -import 'package:moor/moor.dart' as m; import 'package:sqlparser/sqlparser.dart'; import 'package:sqlparser/utils/find_referenced_tables.dart' as s; diff --git a/drift_dev/lib/src/model/sql_query.dart b/drift_dev/lib/src/model/sql_query.dart index 5e7030ed..163bd486 100644 --- a/drift_dev/lib/src/model/sql_query.dart +++ b/drift_dev/lib/src/model/sql_query.dart @@ -1,10 +1,9 @@ import 'package:collection/collection.dart'; +import 'package:drift/drift.dart' show UpdateKind; import 'package:drift_dev/src/analyzer/options.dart'; import 'package:drift_dev/src/analyzer/runner/results.dart'; import 'package:drift_dev/src/model/base_entity.dart'; -import 'package:drift_dev/src/utils/hash.dart'; import 'package:drift_dev/src/writer/writer.dart'; -import 'package:moor/moor.dart' show $mrjf, $mrjc, UpdateKind; import 'package:recase/recase.dart'; import 'package:sqlparser/sqlparser.dart'; @@ -394,10 +393,7 @@ class ResultColumn implements HasType { /// Hash-code that matching [compatibleTo], so that two compatible columns /// will have the same [compatibilityHashCode]. int get compatibilityHashCode { - return $mrjf($mrjc( - name.hashCode, - $mrjc( - type.hashCode, $mrjc(nullable.hashCode, typeConverter.hashCode)))); + return Object.hash(name, type, nullable, typeConverter); } /// Checks whether this column is compatible to the [other], meaning that they @@ -448,7 +444,7 @@ class NestedResultTable { /// [hashCode] that matches [isCompatibleTo] instead of `==`. int get compatibilityHashCode { - return $mrjf($mrjc(name.hashCode, table.hashCode)); + return Object.hash(name, table); } /// Checks whether this is compatible to the [other] nested result, which is @@ -584,7 +580,7 @@ class ExpressionDartPlaceholderType extends DartPlaceholderType { ExpressionDartPlaceholderType(this.columnType, this.defaultValue); @override - int get hashCode => hashAll([columnType, defaultValue]); + int get hashCode => Object.hash(columnType, defaultValue); @override bool operator ==(Object other) { @@ -676,7 +672,7 @@ class FoundDartPlaceholder extends FoundElement { String get dartParameterName => name; @override - int get hashCode => hashAll([type, name, ...availableResultSets]); + int get hashCode => Object.hashAll([type, name, ...availableResultSets]); @override bool operator ==(Object other) { @@ -723,7 +719,7 @@ class AvailableMoorResultSet { String get argumentType => entity.dslName; @override - int get hashCode => hashAll([name, entity]); + int get hashCode => Object.hash(name, entity); @override bool operator ==(Object other) { diff --git a/drift_dev/lib/src/model/table.dart b/drift_dev/lib/src/model/table.dart index 9078ee04..f56df93b 100644 --- a/drift_dev/lib/src/model/table.dart +++ b/drift_dev/lib/src/model/table.dart @@ -1,8 +1,8 @@ import 'package:analyzer/dart/element/element.dart'; +import 'package:drift/drift.dart' show UpdateKind; import 'package:drift_dev/src/analyzer/options.dart'; import 'package:drift_dev/src/model/used_type_converter.dart'; import 'package:drift_dev/writer.dart'; -import 'package:moor/moor.dart' show UpdateKind; import 'package:recase/recase.dart'; import 'package:sqlparser/sqlparser.dart'; diff --git a/drift_dev/lib/src/services/find_stream_update_rules.dart b/drift_dev/lib/src/services/find_stream_update_rules.dart index 33ceb04f..df83aa46 100644 --- a/drift_dev/lib/src/services/find_stream_update_rules.dart +++ b/drift_dev/lib/src/services/find_stream_update_rules.dart @@ -1,6 +1,6 @@ import 'package:collection/collection.dart'; +import 'package:drift/drift.dart'; import 'package:drift_dev/moor_generator.dart'; -import 'package:moor/moor.dart'; import 'package:sqlparser/sqlparser.dart'; class FindStreamUpdateRules { diff --git a/drift_dev/lib/src/services/schema/verifier_impl.dart b/drift_dev/lib/src/services/schema/verifier_impl.dart index 4805b396..d59c5402 100644 --- a/drift_dev/lib/src/services/schema/verifier_impl.dart +++ b/drift_dev/lib/src/services/schema/verifier_impl.dart @@ -1,8 +1,8 @@ import 'dart:math'; +import 'package:drift/drift.dart'; +import 'package:drift/native.dart'; import 'package:drift_dev/api/migrations.dart'; -import 'package:moor/ffi.dart'; -import 'package:moor/moor.dart'; import 'package:sqlite3/sqlite3.dart'; import 'find_differences.dart'; @@ -59,7 +59,7 @@ class VerifierImplementation implements SchemaVerifier { final dbForSetup = sqlite3.open(uri, uri: true); final dbForUse = sqlite3.open(uri, uri: true); - final executor = VmDatabase.opened(dbForSetup); + final executor = NativeDatabase.opened(dbForSetup); final db = helper.databaseForVersion(executor, version); // Opening the helper database will instantiate the schema for us @@ -69,7 +69,7 @@ class VerifierImplementation implements SchemaVerifier { return InitializedSchema(dbForUse, () { final db = sqlite3.open(uri, uri: true); - return DatabaseConnection.fromExecutor(VmDatabase.opened(db)); + return DatabaseConnection.fromExecutor(NativeDatabase.opened(db)); }); } diff --git a/drift_dev/lib/src/utils/hash.dart b/drift_dev/lib/src/utils/hash.dart deleted file mode 100644 index 388e360a..00000000 --- a/drift_dev/lib/src/utils/hash.dart +++ /dev/null @@ -1,12 +0,0 @@ -import 'package:moor/moor.dart' show $mrjf, $mrjc; - -int hashAll(List objects) { - if (objects.length == 1) { - return objects.single.hashCode; - } else { - final firstHash = objects.first.hashCode; - // create a chain of $mrjc(first, $mrjc(second, ...)), finish it off with a - // $mrjf in the end. - return $mrjf(objects.skip(1).map((o) => o.hashCode).fold(firstHash, $mrjc)); - } -} diff --git a/drift_dev/lib/src/writer/database_writer.dart b/drift_dev/lib/src/writer/database_writer.dart index f6c48040..bba6caf3 100644 --- a/drift_dev/lib/src/writer/database_writer.dart +++ b/drift_dev/lib/src/writer/database_writer.dart @@ -1,3 +1,4 @@ +import 'package:drift/drift.dart'; // ignore: implementation_imports import 'package:drift/src/runtime/executor/stream_queries.dart'; import 'package:drift_dev/moor_generator.dart'; @@ -5,7 +6,6 @@ import 'package:drift_dev/src/services/find_stream_update_rules.dart'; import 'package:drift_dev/src/utils/string_escaper.dart'; import 'package:drift_dev/src/utils/type_utils.dart'; import 'package:drift_dev/writer.dart'; -import 'package:moor/moor.dart'; import 'package:recase/recase.dart'; import 'tables/view_writer.dart'; diff --git a/drift_dev/lib/src/writer/tables/table_writer.dart b/drift_dev/lib/src/writer/tables/table_writer.dart index 1d295201..e3bb5012 100644 --- a/drift_dev/lib/src/writer/tables/table_writer.dart +++ b/drift_dev/lib/src/writer/tables/table_writer.dart @@ -1,9 +1,9 @@ +import 'package:drift/sqlite_keywords.dart'; import 'package:drift_dev/moor_generator.dart'; import 'package:drift_dev/src/model/declarations/declaration.dart'; import 'package:drift_dev/src/utils/string_escaper.dart'; import 'package:drift_dev/src/utils/type_utils.dart'; import 'package:drift_dev/writer.dart'; -import 'package:moor/sqlite_keywords.dart'; import 'package:sqlparser/sqlparser.dart'; /// Common writer for tables or views. diff --git a/drift_dev/pubspec.yaml b/drift_dev/pubspec.yaml index 25fd4e39..bf56936a 100644 --- a/drift_dev/pubspec.yaml +++ b/drift_dev/pubspec.yaml @@ -6,7 +6,7 @@ homepage: https://moor.simonbinder.eu/ issue_tracker: https://github.com/simolus3/moor/issues environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.14.0 <3.0.0' dependencies: charcode: ^1.2.0 diff --git a/drift_dev/test/services/find_stream_update_rules_test.dart b/drift_dev/test/services/find_stream_update_rules_test.dart index 3b208f30..1c9bbaf8 100644 --- a/drift_dev/test/services/find_stream_update_rules_test.dart +++ b/drift_dev/test/services/find_stream_update_rules_test.dart @@ -1,9 +1,8 @@ //@dart=2.9 @Tags(['analyzer']) +import 'package:drift/drift.dart'; import 'package:drift_dev/src/analyzer/runner/results.dart'; import 'package:drift_dev/src/services/find_stream_update_rules.dart'; - -import 'package:moor/moor.dart'; import 'package:test/test.dart'; import '../analyzer/utils.dart'; diff --git a/drift_dev/test/services/schema/verifier_impl_test.dart b/drift_dev/test/services/schema/verifier_impl_test.dart index 541923b0..489f7184 100644 --- a/drift_dev/test/services/schema/verifier_impl_test.dart +++ b/drift_dev/test/services/schema/verifier_impl_test.dart @@ -1,6 +1,6 @@ //@dart=2.9 +import 'package:drift/drift.dart'; import 'package:drift_dev/api/migrations.dart'; -import 'package:moor/moor.dart'; import 'package:test/test.dart'; void main() { @@ -18,7 +18,7 @@ void main() { group('migrateAndValidate', () { test('invokes a migration', () async { - moorRuntimeOptions.dontWarnAboutMultipleDatabases = true; + driftRuntimeOptions.dontWarnAboutMultipleDatabases = true; OpeningDetails capturedDetails; final connection = await verifier.startAt(3); @@ -31,7 +31,7 @@ void main() { expect(capturedDetails.versionBefore, 3); expect(capturedDetails.versionNow, 4); - moorRuntimeOptions.dontWarnAboutMultipleDatabases = false; + driftRuntimeOptions.dontWarnAboutMultipleDatabases = false; }); }); }