Skip to content

Commit

Permalink
Merge pull request #46 from guidesmiths/zero-based-migrations
Browse files Browse the repository at this point in the history
Support zero based migrations
  • Loading branch information
cressie176 authored Sep 23, 2024
2 parents c2c2ef4 + 8128a12 commit 0ca5255
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 3,138 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/node-js-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm ci
- run: npm i
- run: npm i
working-directory: ./examples/async
- run: npm ci
- run: npm i
working-directory: ./examples/callback
- run: npm run lint
- run: npm run prettier
Expand All @@ -30,7 +30,7 @@ jobs:
- uses: actions/setup-node@v2
with:
node-version: '16.x'
- run: npm ci
- run: npm i
- run: curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- run: chmod +x ./cc-test-reporter
- run: ./cc-test-reporter before-build
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/node-js-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
- uses: actions/setup-node@v2
with:
node-version: '16.x'
- run: npm ci
- run: npm ci
- run: npm i
- run: npm i
working-directory: ./examples/async
- run: npm ci
- run: npm i
working-directory: ./examples/callback
- run: npm run lint
- run: npm run prettier
Expand All @@ -30,7 +30,7 @@ jobs:
with:
node-version: '16.x'
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm i
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_GUIDESMITHS }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ coverage
*.log
.codeclimate
.nyc_output
package-lock.json
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 0ca5255

Please sign in to comment.