Skip to content

Commit 6884e0f

Browse files
committed
Support zero based migrations
1 parent c2c2ef4 commit 6884e0f

File tree

5 files changed

+2230
-1192
lines changed

5 files changed

+2230
-1192
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ marv.scan(directory, (err, migrations) => {
6262

6363
Migration files are just SQL scripts. Filenames must be in the form `<level><separator><comment>.<extension>` where:
6464

65-
- level must be numeric and greater than 0
65+
- level must be numeric and greater or equal to 0
6666
- separator can be any non numeric
6767
- comment can contain any characters except '.'
6868
- extension is any file extension. See [here](https://github.com/guidesmiths/marv/#filtering-migration-files) for how to filter migration files.

lib/migrate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ function migrate(...args) {
7171

7272
function getWatermark(namespace, previousMigrations) {
7373
const migration = _.sortBy(previousMigrations, 'level').reverse()[0];
74-
return migration ? migration.level : 0;
74+
return migration ? migration.level : -1;
7575
}
7676

7777
function getEligibleMigrations(namespace, watermark, previousMigrations, allMigrations, cb) {

0 commit comments

Comments
 (0)