From 0f9c4adfe0cde85670acea7bad90730399f9a6de Mon Sep 17 00:00:00 2001 From: Tobe O Date: Sat, 20 Apr 2019 00:42:11 -0400 Subject: [PATCH] beta.1 --- angel_migration_runner/CHANGELOG.md | 3 +++ angel_migration_runner/lib/src/postgres/runner.dart | 6 +++--- angel_migration_runner/pubspec.yaml | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/angel_migration_runner/CHANGELOG.md b/angel_migration_runner/CHANGELOG.md index 4aca2199..6f464ec8 100755 --- a/angel_migration_runner/CHANGELOG.md +++ b/angel_migration_runner/CHANGELOG.md @@ -1,3 +1,6 @@ +# 2.0.0-beta.1 +* Make `reset` reverse migrations. + # 2.0.0-beta.0 * Make `reset` reverse migrations. diff --git a/angel_migration_runner/lib/src/postgres/runner.dart b/angel_migration_runner/lib/src/postgres/runner.dart index ad8e33b9..076a40a3 100755 --- a/angel_migration_runner/lib/src/postgres/runner.dart +++ b/angel_migration_runner/lib/src/postgres/runner.dart @@ -61,7 +61,7 @@ class PostgresMigrationRunner implements MigrationRunner { int curBatch = (r[0][0] ?? 0) as int; int batch = curBatch + 1; - for (var k in toRun.reversed) { + for (var k in toRun) { var migration = migrations[k]; var schema = new PostgresSchema(); migration.up(schema); @@ -113,10 +113,10 @@ class PostgresMigrationRunner implements MigrationRunner { var r = await connection .query('SELECT path from migrations ORDER BY batch DESC;'); Iterable existing = r.expand((x) => x).cast(); - var toRun = existing.where(migrations.containsKey); + var toRun = existing.where(migrations.containsKey).toList(); if (toRun.isNotEmpty) { - for (var k in toRun) { + for (var k in toRun.reversed) { var migration = migrations[k]; var schema = new PostgresSchema(); migration.down(schema); diff --git a/angel_migration_runner/pubspec.yaml b/angel_migration_runner/pubspec.yaml index e339083b..562819b6 100755 --- a/angel_migration_runner/pubspec.yaml +++ b/angel_migration_runner/pubspec.yaml @@ -1,5 +1,5 @@ name: angel_migration_runner -version: 2.0.0-beta.0 +version: 2.0.0-beta.1 description: Command-line based database migration runner for Angel's ORM. author: Tobe O homepage: https://github.com/angel-dart/migration