Skip to content

Commit

Permalink
Support zero based migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
cressie176 committed Aug 27, 2024
1 parent c2c2ef4 commit 6884e0f
Show file tree
Hide file tree
Showing 5 changed files with 2,230 additions and 1,192 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ marv.scan(directory, (err, migrations) => {

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

- level must be numeric and greater than 0
- level must be numeric and greater or equal to 0
- separator can be any non numeric
- comment can contain any characters except '.'
- extension is any file extension. See [here](https://github.com/guidesmiths/marv/#filtering-migration-files) for how to filter migration files.
Expand Down
2 changes: 1 addition & 1 deletion lib/migrate.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function migrate(...args) {

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

function getEligibleMigrations(namespace, watermark, previousMigrations, allMigrations, cb) {
Expand Down
Loading

0 comments on commit 6884e0f

Please sign in to comment.