Migrated angel_migration_runner
This commit is contained in:
parent
af36c3b339
commit
ad4558cd0f
6 changed files with 21 additions and 27 deletions
|
@ -34,8 +34,8 @@
|
||||||
* Migrated angel_orm to 3.0.0 (0/0 tests passed)
|
* Migrated angel_orm to 3.0.0 (0/0 tests passed)
|
||||||
* Migrated angel_migration 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)
|
* Added inflection2 and migrated to 1.0.0 (28/32 tests passed)
|
||||||
* Updated angel_orm_generator 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 (in progress)
|
* 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_test to 1.0.0 (in progress)
|
||||||
* Updated angel_orm_postgres to 2.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
|
* 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_serialize_generator to 3.0.0 (33/33 tests passed)
|
||||||
* Updated angel_orm to 3.0.0 (0/0 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_migration to 3.0.0 (0/0 tests passed)
|
||||||
* Updated angel_orm_generator to 3.0.0 (use a fork of postgres)
|
* 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
|
* Updated angel_migration_runner to 3.0.0 (0/0 tests passed)
|
||||||
* Updated angel_orm_test to 1.0.0
|
* Updated angel_orm_test to 1.0.0
|
||||||
* Updated angel_orm_postgres to 2.0.0
|
* Updated angel_orm_postgres to 2.0.0
|
||||||
* Update orm-sdk-2.12.x boilerplate
|
* Update orm-sdk-2.12.x boilerplate
|
||||||
|
|
|
@ -14,7 +14,7 @@ class PostgresMigrationRunner implements MigrationRunner {
|
||||||
|
|
||||||
PostgresMigrationRunner(this.connection,
|
PostgresMigrationRunner(this.connection,
|
||||||
{Iterable<Migration> migrations = const [], bool connected: false}) {
|
{Iterable<Migration> migrations = const [], bool connected: false}) {
|
||||||
if (migrations?.isNotEmpty == true) migrations.forEach(addMigration);
|
if (migrations.isNotEmpty == true) migrations.forEach(addMigration);
|
||||||
_connected = connected == true;
|
_connected = connected == true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ class PostgresMigrationRunner implements MigrationRunner {
|
||||||
int batch = curBatch + 1;
|
int batch = curBatch + 1;
|
||||||
|
|
||||||
for (var k in toRun) {
|
for (var k in toRun) {
|
||||||
var migration = migrations[k];
|
var migration = migrations[k]!;
|
||||||
var schema = new PostgresSchema();
|
var schema = new PostgresSchema();
|
||||||
migration.up(schema);
|
migration.up(schema);
|
||||||
print('Bringing up "$k"...');
|
print('Bringing up "$k"...');
|
||||||
|
@ -93,7 +93,7 @@ class PostgresMigrationRunner implements MigrationRunner {
|
||||||
|
|
||||||
if (toRun.isNotEmpty) {
|
if (toRun.isNotEmpty) {
|
||||||
for (var k in toRun.reversed) {
|
for (var k in toRun.reversed) {
|
||||||
var migration = migrations[k];
|
var migration = migrations[k]!;
|
||||||
var schema = new PostgresSchema();
|
var schema = new PostgresSchema();
|
||||||
migration.down(schema);
|
migration.down(schema);
|
||||||
print('Bringing down "$k"...');
|
print('Bringing down "$k"...');
|
||||||
|
@ -117,7 +117,7 @@ class PostgresMigrationRunner implements MigrationRunner {
|
||||||
|
|
||||||
if (toRun.isNotEmpty) {
|
if (toRun.isNotEmpty) {
|
||||||
for (var k in toRun.reversed) {
|
for (var k in toRun.reversed) {
|
||||||
var migration = migrations[k];
|
var migration = migrations[k]!;
|
||||||
var schema = new PostgresSchema();
|
var schema = new PostgresSchema();
|
||||||
migration.down(schema);
|
migration.down(schema);
|
||||||
print('Bringing down "$k"...');
|
print('Bringing down "$k"...');
|
||||||
|
|
|
@ -5,7 +5,7 @@ import 'package:charcode/ascii.dart';
|
||||||
|
|
||||||
abstract class PostgresGenerator {
|
abstract class PostgresGenerator {
|
||||||
static String columnType(MigrationColumn column) {
|
static String columnType(MigrationColumn column) {
|
||||||
var str = column.type.name;
|
var str = column.type!.name;
|
||||||
if (column.length != null)
|
if (column.length != null)
|
||||||
return '$str(${column.length})';
|
return '$str(${column.length})';
|
||||||
else
|
else
|
||||||
|
@ -53,7 +53,7 @@ abstract class PostgresGenerator {
|
||||||
static String compileReference(MigrationColumnReference ref) {
|
static String compileReference(MigrationColumnReference ref) {
|
||||||
var buf = new StringBuffer(
|
var buf = new StringBuffer(
|
||||||
'REFERENCES "${ref.foreignTable}"("${ref.foreignKey}")');
|
'REFERENCES "${ref.foreignTable}"("${ref.foreignKey}")');
|
||||||
if (ref.behavior != null) buf.write(' ' + ref.behavior);
|
if (ref.behavior != null) buf.write(' ' + ref.behavior!);
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -143,7 +143,7 @@ class PostgresAlterTable extends Table implements MutableTable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void changeColumnType(String name, ColumnType type, {int length}) {
|
void changeColumnType(String name, ColumnType type, {int? length}) {
|
||||||
_stack.add('ALTER COLUMN "$name" TYPE ' +
|
_stack.add('ALTER COLUMN "$name" TYPE ' +
|
||||||
PostgresGenerator.columnType(
|
PostgresGenerator.columnType(
|
||||||
new MigrationColumn(type, length: length)));
|
new MigrationColumn(type, length: length)));
|
||||||
|
|
|
@ -4,10 +4,10 @@ import 'dart:mirrors';
|
||||||
|
|
||||||
Future<String> absoluteSourcePath(Type type) async {
|
Future<String> absoluteSourcePath(Type type) async {
|
||||||
var mirror = reflectType(type);
|
var mirror = reflectType(type);
|
||||||
var uri = mirror.location.sourceUri;
|
var uri = mirror.location!.sourceUri;
|
||||||
|
|
||||||
if (uri.scheme == 'package') {
|
if (uri.scheme == 'package') {
|
||||||
uri = await Isolate.resolvePackageUri(uri);
|
uri = await (Isolate.resolvePackageUri(uri) as FutureOr<Uri>);
|
||||||
}
|
}
|
||||||
|
|
||||||
return uri.toFilePath() + '#' + MirrorSystem.getName(mirror.simpleName);
|
return uri.toFilePath() + '#' + MirrorSystem.getName(mirror.simpleName);
|
||||||
|
|
|
@ -1,24 +1,21 @@
|
||||||
name: angel_migration_runner
|
name: angel_migration_runner
|
||||||
version: 3.0.0
|
version: 4.0.0
|
||||||
description: Command-line based database migration runner for Angel's ORM.
|
description: Command-line based database migration runner for Angel's ORM.
|
||||||
author: Tobe O <thosakwe@gmail.com>
|
homepage: https://github.com/dukefirehawk/angel
|
||||||
homepage: https://github.com/angel-dart/migration
|
|
||||||
publish_to: none
|
publish_to: none
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.10.0 <3.0.0'
|
sdk: '>=2.12.0 <3.0.0'
|
||||||
dependencies:
|
dependencies:
|
||||||
angel_migration:
|
angel_migration:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/dukefirehawk/angel.git
|
url: https://github.com/dukefirehawk/angel.git
|
||||||
ref: sdk-2.12.x
|
ref: sdk-2.12.x_nnbd
|
||||||
path: packages/orm/angel_migration
|
path: packages/orm/angel_migration
|
||||||
angel_orm:
|
angel_orm:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/dukefirehawk/angel.git
|
url: https://github.com/dukefirehawk/angel.git
|
||||||
ref: sdk-2.12.x
|
ref: sdk-2.12.x_nnbd
|
||||||
path: packages/orm/angel_orm
|
path: packages/orm/angel_orm
|
||||||
args: ^2.0.0
|
args: ^2.1.0
|
||||||
charcode: ^1.2.0
|
charcode: ^1.2.0
|
||||||
postgres:
|
postgres: ^2.3.2
|
||||||
git:
|
|
||||||
url: https://github.com/dukefirehawk/postgresql-dart
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ dependencies:
|
||||||
path: ^1.8.0
|
path: ^1.8.0
|
||||||
recase: ^4.0.0
|
recase: ^4.0.0
|
||||||
source_gen: ^1.0.0
|
source_gen: ^1.0.0
|
||||||
collection: ^1.15.0-nullsafety.4
|
collection: ^1.15.0
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
angel_framework:
|
angel_framework:
|
||||||
git:
|
git:
|
||||||
|
@ -54,9 +54,6 @@ dev_dependencies:
|
||||||
path: packages/orm/angel_migration
|
path: packages/orm/angel_migration
|
||||||
#angel_test: ^1.0.0
|
#angel_test: ^1.0.0
|
||||||
build_runner: ^2.0.1
|
build_runner: ^2.0.1
|
||||||
collection: ^1.15.0
|
|
||||||
pedantic: ^1.11.0
|
pedantic: ^1.11.0
|
||||||
postgres: ^2.3.2
|
postgres: ^2.3.2
|
||||||
# git:
|
|
||||||
# url: https://github.com/dukefirehawk/postgresql-dart
|
|
||||||
test: ^1.17.3
|
test: ^1.17.3
|
||||||
|
|
Loading…
Reference in a new issue