beta.1
This commit is contained in:
parent
8996f150e0
commit
0f9c4adfe0
3 changed files with 7 additions and 4 deletions
|
@ -1,3 +1,6 @@
|
||||||
|
# 2.0.0-beta.1
|
||||||
|
* Make `reset` reverse migrations.
|
||||||
|
|
||||||
# 2.0.0-beta.0
|
# 2.0.0-beta.0
|
||||||
* Make `reset` reverse migrations.
|
* Make `reset` reverse migrations.
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ class PostgresMigrationRunner implements MigrationRunner {
|
||||||
int curBatch = (r[0][0] ?? 0) as int;
|
int curBatch = (r[0][0] ?? 0) as int;
|
||||||
int batch = curBatch + 1;
|
int batch = curBatch + 1;
|
||||||
|
|
||||||
for (var k in toRun.reversed) {
|
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);
|
||||||
|
@ -113,10 +113,10 @@ class PostgresMigrationRunner implements MigrationRunner {
|
||||||
var r = await connection
|
var r = await connection
|
||||||
.query('SELECT path from migrations ORDER BY batch DESC;');
|
.query('SELECT path from migrations ORDER BY batch DESC;');
|
||||||
Iterable<String> existing = r.expand((x) => x).cast<String>();
|
Iterable<String> existing = r.expand((x) => x).cast<String>();
|
||||||
var toRun = existing.where(migrations.containsKey);
|
var toRun = existing.where(migrations.containsKey).toList();
|
||||||
|
|
||||||
if (toRun.isNotEmpty) {
|
if (toRun.isNotEmpty) {
|
||||||
for (var k in toRun) {
|
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);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
name: angel_migration_runner
|
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.
|
description: Command-line based database migration runner for Angel's ORM.
|
||||||
author: Tobe O <thosakwe@gmail.com>
|
author: Tobe O <thosakwe@gmail.com>
|
||||||
homepage: https://github.com/angel-dart/migration
|
homepage: https://github.com/angel-dart/migration
|
||||||
|
|
Loading…
Reference in a new issue