From ad4558cd0f1c37fbe1ccb5164becf472c4a86858 Mon Sep 17 00:00:00 2001 From: "thomashii@dukefirehawk.com" Date: Sun, 2 May 2021 19:44:38 +0800 Subject: [PATCH] Migrated angel_migration_runner --- CHANGELOG.md | 8 ++++---- .../lib/src/postgres/runner.dart | 8 ++++---- .../lib/src/postgres/table.dart | 6 +++--- .../angel_migration_runner/lib/src/util.dart | 4 ++-- .../orm/angel_migration_runner/pubspec.yaml | 17 +++++++---------- packages/orm/angel_orm_generator/pubspec.yaml | 5 +---- 6 files changed, 21 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 28d66ce5..08c95d55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,8 +34,8 @@ * Migrated angel_orm to 3.0.0 (0/0 tests passed) * Migrated angel_migration to 3.0.0 (0/0 tests passed) * Added inflection2 and migrated to 1.0.0 (28/32 tests passed) -* Updated angel_orm_generator to 3.0.0 (in progress) -* Updated angel_migration_runner to 3.0.0 (in progress) +* Updated angel_orm_generator to 4.0.0 (0/0 tests passed) +* Updated angel_migration_runner to 3.0.0 (0/0 tests passed) * Updated angel_orm_test to 1.0.0 (in progress) * Updated angel_orm_postgres to 2.0.0 (in progress) * Update orm-sdk-2.12.x boilerplate (in progress) <= Milestone 2 @@ -69,8 +69,8 @@ * Updated angel_serialize_generator to 3.0.0 (33/33 tests passed) * Updated angel_orm to 3.0.0 (0/0 tests passed) * Updated angel_migration to 3.0.0 (0/0 tests passed) -* Updated angel_orm_generator to 3.0.0 (use a fork of postgres) -* Updated angel_migration_runner to 3.0.0 +* Updated angel_orm_generator to 3.0.0 (0/0 tests passed, use a fork of postgres) +* Updated angel_migration_runner to 3.0.0 (0/0 tests passed) * Updated angel_orm_test to 1.0.0 * Updated angel_orm_postgres to 2.0.0 * Update orm-sdk-2.12.x boilerplate diff --git a/packages/orm/angel_migration_runner/lib/src/postgres/runner.dart b/packages/orm/angel_migration_runner/lib/src/postgres/runner.dart index 076a40a3..c493ccb9 100755 --- a/packages/orm/angel_migration_runner/lib/src/postgres/runner.dart +++ b/packages/orm/angel_migration_runner/lib/src/postgres/runner.dart @@ -14,7 +14,7 @@ class PostgresMigrationRunner implements MigrationRunner { PostgresMigrationRunner(this.connection, {Iterable migrations = const [], bool connected: false}) { - if (migrations?.isNotEmpty == true) migrations.forEach(addMigration); + if (migrations.isNotEmpty == true) migrations.forEach(addMigration); _connected = connected == true; } @@ -62,7 +62,7 @@ class PostgresMigrationRunner implements MigrationRunner { int batch = curBatch + 1; for (var k in toRun) { - var migration = migrations[k]; + var migration = migrations[k]!; var schema = new PostgresSchema(); migration.up(schema); print('Bringing up "$k"...'); @@ -93,7 +93,7 @@ class PostgresMigrationRunner implements MigrationRunner { if (toRun.isNotEmpty) { for (var k in toRun.reversed) { - var migration = migrations[k]; + var migration = migrations[k]!; var schema = new PostgresSchema(); migration.down(schema); print('Bringing down "$k"...'); @@ -117,7 +117,7 @@ class PostgresMigrationRunner implements MigrationRunner { if (toRun.isNotEmpty) { for (var k in toRun.reversed) { - var migration = migrations[k]; + var migration = migrations[k]!; var schema = new PostgresSchema(); migration.down(schema); print('Bringing down "$k"...'); diff --git a/packages/orm/angel_migration_runner/lib/src/postgres/table.dart b/packages/orm/angel_migration_runner/lib/src/postgres/table.dart index c5f6d9e1..c8816463 100755 --- a/packages/orm/angel_migration_runner/lib/src/postgres/table.dart +++ b/packages/orm/angel_migration_runner/lib/src/postgres/table.dart @@ -5,7 +5,7 @@ import 'package:charcode/ascii.dart'; abstract class PostgresGenerator { static String columnType(MigrationColumn column) { - var str = column.type.name; + var str = column.type!.name; if (column.length != null) return '$str(${column.length})'; else @@ -53,7 +53,7 @@ abstract class PostgresGenerator { static String compileReference(MigrationColumnReference ref) { var buf = new StringBuffer( 'REFERENCES "${ref.foreignTable}"("${ref.foreignKey}")'); - if (ref.behavior != null) buf.write(' ' + ref.behavior); + if (ref.behavior != null) buf.write(' ' + ref.behavior!); return buf.toString(); } } @@ -143,7 +143,7 @@ class PostgresAlterTable extends Table implements MutableTable { } @override - void changeColumnType(String name, ColumnType type, {int length}) { + void changeColumnType(String name, ColumnType type, {int? length}) { _stack.add('ALTER COLUMN "$name" TYPE ' + PostgresGenerator.columnType( new MigrationColumn(type, length: length))); diff --git a/packages/orm/angel_migration_runner/lib/src/util.dart b/packages/orm/angel_migration_runner/lib/src/util.dart index 24db1b16..ebfdd3b4 100755 --- a/packages/orm/angel_migration_runner/lib/src/util.dart +++ b/packages/orm/angel_migration_runner/lib/src/util.dart @@ -4,10 +4,10 @@ import 'dart:mirrors'; Future absoluteSourcePath(Type type) async { var mirror = reflectType(type); - var uri = mirror.location.sourceUri; + var uri = mirror.location!.sourceUri; if (uri.scheme == 'package') { - uri = await Isolate.resolvePackageUri(uri); + uri = await (Isolate.resolvePackageUri(uri) as FutureOr); } return uri.toFilePath() + '#' + MirrorSystem.getName(mirror.simpleName); diff --git a/packages/orm/angel_migration_runner/pubspec.yaml b/packages/orm/angel_migration_runner/pubspec.yaml index c709c2f3..1c40032c 100755 --- a/packages/orm/angel_migration_runner/pubspec.yaml +++ b/packages/orm/angel_migration_runner/pubspec.yaml @@ -1,24 +1,21 @@ name: angel_migration_runner -version: 3.0.0 +version: 4.0.0 description: Command-line based database migration runner for Angel's ORM. -author: Tobe O -homepage: https://github.com/angel-dart/migration +homepage: https://github.com/dukefirehawk/angel publish_to: none environment: - sdk: '>=2.10.0 <3.0.0' + sdk: '>=2.12.0 <3.0.0' dependencies: angel_migration: git: url: https://github.com/dukefirehawk/angel.git - ref: sdk-2.12.x + ref: sdk-2.12.x_nnbd path: packages/orm/angel_migration angel_orm: git: url: https://github.com/dukefirehawk/angel.git - ref: sdk-2.12.x + ref: sdk-2.12.x_nnbd path: packages/orm/angel_orm - args: ^2.0.0 + args: ^2.1.0 charcode: ^1.2.0 - postgres: - git: - url: https://github.com/dukefirehawk/postgresql-dart + postgres: ^2.3.2 diff --git a/packages/orm/angel_orm_generator/pubspec.yaml b/packages/orm/angel_orm_generator/pubspec.yaml index 556c33f9..2b8e3381 100644 --- a/packages/orm/angel_orm_generator/pubspec.yaml +++ b/packages/orm/angel_orm_generator/pubspec.yaml @@ -40,7 +40,7 @@ dependencies: path: ^1.8.0 recase: ^4.0.0 source_gen: ^1.0.0 - collection: ^1.15.0-nullsafety.4 + collection: ^1.15.0 dev_dependencies: angel_framework: git: @@ -54,9 +54,6 @@ dev_dependencies: path: packages/orm/angel_migration #angel_test: ^1.0.0 build_runner: ^2.0.1 - collection: ^1.15.0 pedantic: ^1.11.0 postgres: ^2.3.2 - # git: - # url: https://github.com/dukefirehawk/postgresql-dart test: ^1.17.3