From ebdb634a950891c9f2de8e0fed03fd6163621a11 Mon Sep 17 00:00:00 2001 From: thomashii Date: Mon, 17 May 2021 23:34:19 +0800 Subject: [PATCH] Publish migration --- packages/orm/angel_migration/CHANGELOG.md | 2 +- packages/orm/angel_migration/README.md | 8 +++++++- .../orm/angel_migration/analysis_options.yaml | 1 + packages/orm/angel_migration/example/todo.dart | 4 ++-- ...angel_migration.dart => angel3_migration.dart} | 0 packages/orm/angel_migration/lib/src/column.dart | 12 ++++++------ packages/orm/angel_migration/lib/src/schema.dart | 10 +++++----- packages/orm/angel_migration/lib/src/table.dart | 8 ++++---- packages/orm/angel_migration/pubspec.yaml | 15 ++++++--------- 9 files changed, 32 insertions(+), 28 deletions(-) rename packages/orm/angel_migration/lib/{angel_migration.dart => angel3_migration.dart} (100%) mode change 100755 => 100644 diff --git a/packages/orm/angel_migration/CHANGELOG.md b/packages/orm/angel_migration/CHANGELOG.md index a18207b8..36eb805f 100755 --- a/packages/orm/angel_migration/CHANGELOG.md +++ b/packages/orm/angel_migration/CHANGELOG.md @@ -1,4 +1,4 @@ -# 4.0.0 +# 4.0.0-beta.1 * Migrated to support Dart SDK 2.12.x NNBD # 3.0.0 diff --git a/packages/orm/angel_migration/README.md b/packages/orm/angel_migration/README.md index b45dfed8..183e137b 100755 --- a/packages/orm/angel_migration/README.md +++ b/packages/orm/angel_migration/README.md @@ -1,2 +1,8 @@ -# migration +# angel3_migration +[![version](https://img.shields.io/badge/pub-v4.0.0-brightgreen)](https://pub.dartlang.org/packages/angel3_migration) +[![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/LICENSE) + A PostgreSQL database migration framework built on Angel's ORM. diff --git a/packages/orm/angel_migration/analysis_options.yaml b/packages/orm/angel_migration/analysis_options.yaml index eae1e42a..c230cee7 100755 --- a/packages/orm/angel_migration/analysis_options.yaml +++ b/packages/orm/angel_migration/analysis_options.yaml @@ -1,3 +1,4 @@ +include: package:pedantic/analysis_options.yaml analyzer: strong-mode: implicit-casts: false \ No newline at end of file diff --git a/packages/orm/angel_migration/example/todo.dart b/packages/orm/angel_migration/example/todo.dart index 812b8dfa..3ae5cb49 100755 --- a/packages/orm/angel_migration/example/todo.dart +++ b/packages/orm/angel_migration/example/todo.dart @@ -1,9 +1,9 @@ /// These are straightforward migrations. /// /// You will likely never have to actually write these yourself. -library angel_migration.example.todo; +library angel3_migration.example.todo; -import 'package:angel_migration/angel_migration.dart'; +import 'package:angel3_migration/angel3_migration.dart'; class UserMigration implements Migration { @override diff --git a/packages/orm/angel_migration/lib/angel_migration.dart b/packages/orm/angel_migration/lib/angel3_migration.dart old mode 100755 new mode 100644 similarity index 100% rename from packages/orm/angel_migration/lib/angel_migration.dart rename to packages/orm/angel_migration/lib/angel3_migration.dart diff --git a/packages/orm/angel_migration/lib/src/column.dart b/packages/orm/angel_migration/lib/src/column.dart index 4451ca5e..971f260a 100755 --- a/packages/orm/angel_migration/lib/src/column.dart +++ b/packages/orm/angel_migration/lib/src/column.dart @@ -1,4 +1,4 @@ -import 'package:angel_orm/angel_orm.dart'; +import 'package:angel3_orm/angel3_orm.dart'; class MigrationColumn extends Column { final List _references = []; @@ -12,10 +12,10 @@ class MigrationColumn extends Column { @override IndexType get indexType => _index!; - get defaultValue => _defaultValue; + dynamic get defaultValue => _defaultValue; List get externalReferences => - new List.unmodifiable(_references); + List.unmodifiable(_references); MigrationColumn(ColumnType? type, {bool isNullable: true, int? length, IndexType? indexType, defaultValue}) @@ -27,7 +27,7 @@ class MigrationColumn extends Column { factory MigrationColumn.from(Column column) => column is MigrationColumn ? column - : new MigrationColumn(column.type, + : MigrationColumn(column.type, isNullable: column.isNullable, length: column.length, indexType: column.indexType); @@ -41,7 +41,7 @@ class MigrationColumn extends Column { MigrationColumn primaryKey() => this.._index = IndexType.primaryKey; MigrationColumnReference references(String foreignTable, String foreignKey) { - var ref = new MigrationColumnReference._(foreignTable, foreignKey); + var ref = MigrationColumnReference._(foreignTable, foreignKey); _references.add(ref); return ref; } @@ -56,7 +56,7 @@ class MigrationColumnReference { String? get behavior => _behavior; StateError _locked() => - new StateError('Cannot override existing "$_behavior" behavior.'); + StateError('Cannot override existing "$_behavior" behavior.'); void onDeleteCascade() { if (_behavior != null) throw _locked(); diff --git a/packages/orm/angel_migration/lib/src/schema.dart b/packages/orm/angel_migration/lib/src/schema.dart index 155abb32..68a6234a 100755 --- a/packages/orm/angel_migration/lib/src/schema.dart +++ b/packages/orm/angel_migration/lib/src/schema.dart @@ -1,15 +1,15 @@ import 'table.dart'; abstract class Schema { - void drop(String tableName, {bool cascade: false}); + void drop(String tableName, {bool cascade = false}); - void dropAll(Iterable tableNames, {bool cascade: false}) { + void dropAll(Iterable tableNames, {bool cascade = false}) { tableNames.forEach((n) => drop(n, cascade: cascade)); } - void create(String tableName, void callback(Table table)); + void create(String tableName, void Function(Table table) callback); - void createIfNotExists(String tableName, void callback(Table table)); + void createIfNotExists(String tableName, void Function(Table table) callback); - void alter(String tableName, void callback(MutableTable table)); + void alter(String tableName, void Function(MutableTable table) callback); } diff --git a/packages/orm/angel_migration/lib/src/table.dart b/packages/orm/angel_migration/lib/src/table.dart index 28e7ffaa..084a9c62 100755 --- a/packages/orm/angel_migration/lib/src/table.dart +++ b/packages/orm/angel_migration/lib/src/table.dart @@ -1,11 +1,11 @@ -import 'package:angel_orm/angel_orm.dart'; +import 'package:angel3_orm/angel3_orm.dart'; import 'column.dart'; abstract class Table { MigrationColumn declareColumn(String name, Column column); MigrationColumn declare(String name, ColumnType type) => - declareColumn(name, new MigrationColumn(type)); + declareColumn(name, MigrationColumn(type)); MigrationColumn serial(String name) => declare(name, ColumnType.serial); @@ -22,7 +22,7 @@ abstract class Table { @deprecated MigrationColumn dateTime(String name) => timeStamp(name, timezone: true); - MigrationColumn timeStamp(String name, {bool timezone: false}) { + MigrationColumn timeStamp(String name, {bool timezone = false}) { if (timezone != true) return declare(name, ColumnType.timeStamp); return declare(name, ColumnType.timeStampWithTimeZone); } @@ -32,7 +32,7 @@ abstract class Table { MigrationColumn varChar(String name, {int? length}) { if (length == null) return declare(name, ColumnType.varChar); return declareColumn( - name, new Column(type: ColumnType.varChar, length: length)); + name, Column(type: ColumnType.varChar, length: length)); } } diff --git a/packages/orm/angel_migration/pubspec.yaml b/packages/orm/angel_migration/pubspec.yaml index 38194526..32dafe89 100755 --- a/packages/orm/angel_migration/pubspec.yaml +++ b/packages/orm/angel_migration/pubspec.yaml @@ -1,13 +1,10 @@ -name: angel_migration -version: 4.0.0 +name: angel3_migration +version: 4.0.0-beta.1 description: Database migration runtime for Angel's ORM. Use this package to define schemas. -homepage: https://github.com/dukefirehawk/angel -publish_to: none +homepage: https://github.com/dukefirehawk/angel/tree/angel3/packages/orm/angel_migration environment: sdk: '>=2.12.0 <3.0.0' dependencies: - angel_orm: - git: - url: https://github.com/dukefirehawk/angel.git - ref: sdk-2.12.x_nnbd - path: packages/orm/angel_orm \ No newline at end of file + angel3_orm: ^4.0.0-beta.1 +dev_dependencies: + pedantic: ^1.11.0