From 28c4705898620b8d673b94794267b59b2900bf64 Mon Sep 17 00:00:00 2001 From: thomashii Date: Mon, 19 Jul 2021 12:49:31 +0800 Subject: [PATCH] Updated angel_migration_runner --- packages/orm/angel_migration/README.md | 2 +- .../orm/angel_migration_runner/CHANGELOG.md | 52 +++++++++++++------ packages/orm/angel_migration_runner/README.md | 11 ++-- .../lib/src/postgres/table.dart | 2 +- .../angel_migration_runner/lib/src/util.dart | 10 +++- .../orm/angel_migration_runner/pubspec.yaml | 8 +-- 6 files changed, 60 insertions(+), 25 deletions(-) diff --git a/packages/orm/angel_migration/README.md b/packages/orm/angel_migration/README.md index 45b9df53..49f01ab2 100755 --- a/packages/orm/angel_migration/README.md +++ b/packages/orm/angel_migration/README.md @@ -6,7 +6,7 @@ [![License](https://img.shields.io/github/license/dukefirehawk/angel)](https://github.com/dukefirehawk/angel/tree/angel3/packages/orm/angel_migration/LICENSE) -A database migration framework built for Angel3 ORM +A database migration framework built for Angel3 ORM. Supported database: diff --git a/packages/orm/angel_migration_runner/CHANGELOG.md b/packages/orm/angel_migration_runner/CHANGELOG.md index 87830198..114d23e1 100755 --- a/packages/orm/angel_migration_runner/CHANGELOG.md +++ b/packages/orm/angel_migration_runner/CHANGELOG.md @@ -1,41 +1,61 @@ -# 4.0.0-beta.2 +# Change Log + +## 4.0.0-beta.3 + +* Updated README + +## 4.0.0-beta.2 + * Resolved static analysis warnings -# 4.0.0-beta.1 +## 4.0.0-beta.1 + * Migrated to support Dart SDK 2.12.x NNBD -# 3.0.0 +## 3.0.0 + * Migrated to work with Dart SDK 2.12.x Non NNBD -# 2.0.0 +## 2.0.0 + * Bump to `2.0.0`. -# 2.0.0-beta.1 +## 2.0.0-beta.1 + * Make `reset` reverse migrations. -# 2.0.0-beta.0 +## 2.0.0-beta.0 + * Make `reset` reverse migrations. -# 2.0.0-alpha.5 +## 2.0.0-alpha.5 + * Support default values for columns. -# 2.0.0-alpha.4 +## 2.0.0-alpha.4 + * Include the names of migration classes when running. -# 2.0.0-alpha.3 +## 2.0.0-alpha.3 + * Run migrations in reverse on `rollback`. -# 2.0.0-alpha.2 +## 2.0.0-alpha.2 + * Run migrations in reverse on `reset`. -# 2.0.0-alpha.1 +## 2.0.0-alpha.1 + * Cast Iterables via `.cast()`, rather than `as`. -# 2.0.0-alpha +## 2.0.0-alpha + * Dart 2 update. -# 1.0.0-alpha+5 -`Schema#drop` now has a named `cascade` parameter, of type `bool`. +## 1.0.0-alpha+5 -# 1.0.0-alpha+1 -* You can now pass a `connected` parameter. \ No newline at end of file +`Schema##drop` now has a named `cascade` parameter, of type `bool`. + +## 1.0.0-alpha+1 + +* You can now pass a `connected` parameter. diff --git a/packages/orm/angel_migration_runner/README.md b/packages/orm/angel_migration_runner/README.md index a0f70281..9852a099 100755 --- a/packages/orm/angel_migration_runner/README.md +++ b/packages/orm/angel_migration_runner/README.md @@ -1,8 +1,13 @@ -# angel3_migration_runner -[![version](https://img.shields.io/badge/pub-v4.0.0-brightgreen)](https://pub.dartlang.org/packages/angel3_migration_runner) +# Angel3 Migration Runner + +[![version](https://img.shields.io/badge/pub-v4.0.1-brightgreen)](https://pub.dartlang.org/packages/angel3_migration_runner) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Gitter](https://img.shields.io/gitter/room/angel_dart/discussion)](https://gitter.im/angel_dart/discussion) [![License](https://img.shields.io/github/license/dukefirehawk/angel)](https://github.com/dukefirehawk/angel/tree/angel3/packages/orm/angel_migration_runner/LICENSE) -A PostgreSQL database migration framework built on Angel's ORM. +Command-line based database migration runner for Angel3 ORM. + +Supported database: + +* postgresql version 9, 10, 11 and 12 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 c786f854..c31c2c9b 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 { diff --git a/packages/orm/angel_migration_runner/lib/src/util.dart b/packages/orm/angel_migration_runner/lib/src/util.dart index ebfdd3b4..e54f499d 100755 --- a/packages/orm/angel_migration_runner/lib/src/util.dart +++ b/packages/orm/angel_migration_runner/lib/src/util.dart @@ -4,10 +4,18 @@ import 'dart:mirrors'; Future absoluteSourcePath(Type type) async { var mirror = reflectType(type); + + if (mirror.location == null) { + throw ArgumentError('Invalid location'); + } + var uri = mirror.location!.sourceUri; if (uri.scheme == 'package') { - uri = await (Isolate.resolvePackageUri(uri) as FutureOr); + var packageUrl = await Isolate.resolvePackageUri(uri); + if (packageUrl != null) { + uri = packageUrl; + } } 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 47e8705e..3db9db08 100755 --- a/packages/orm/angel_migration_runner/pubspec.yaml +++ b/packages/orm/angel_migration_runner/pubspec.yaml @@ -1,7 +1,8 @@ name: angel3_migration_runner -version: 4.0.0-beta.2 -description: Command-line based database migration runner for Angel's ORM. -homepage: https://github.com/dukefirehawk/angel/tree/angel3/packages/orm/angel_migration_runner +version: 4.0.0-beta.3 +description: Command-line based database migration runner for Angel3's ORM. +homepage: https://angel3-framework.web.app/ +repository: https://github.com/dukefirehawk/angel/tree/angel3/packages/orm/angel_migration_runner environment: sdk: '>=2.12.0 <3.0.0' dependencies: @@ -10,4 +11,5 @@ dependencies: args: ^2.1.0 charcode: ^1.2.0 postgres: ^2.3.2 +dev_dependencies: pedantic: ^1.11.0