mirror of https://github.com/AMT-Cheif/drift.git
Fix imports in drift_dev
This commit is contained in:
parent
2219a15e5f
commit
3a56de1830
|
@ -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 {
|
||||
|
|
|
@ -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';
|
||||
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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';
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
import 'package:moor/moor.dart' show $mrjf, $mrjc;
|
||||
|
||||
int hashAll(List<dynamic> 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));
|
||||
}
|
||||
}
|
|
@ -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';
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue