Skip to content

Commit 0ca5255

Browse files
authored
Merge pull request #46 from guidesmiths/zero-based-migrations
Support zero based migrations
2 parents c2c2ef4 + 8128a12 commit 0ca5255

File tree

8 files changed

+48
-3138
lines changed

8 files changed

+48
-3138
lines changed

.github/workflows/node-js-ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ jobs:
1313
- uses: actions/setup-node@v2
1414
with:
1515
node-version: ${{ matrix.node-version }}
16-
- run: npm ci
17-
- run: npm ci
16+
- run: npm i
17+
- run: npm i
1818
working-directory: ./examples/async
19-
- run: npm ci
19+
- run: npm i
2020
working-directory: ./examples/callback
2121
- run: npm run lint
2222
- run: npm run prettier
@@ -30,7 +30,7 @@ jobs:
3030
- uses: actions/setup-node@v2
3131
with:
3232
node-version: '16.x'
33-
- run: npm ci
33+
- run: npm i
3434
- run: curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
3535
- run: chmod +x ./cc-test-reporter
3636
- run: ./cc-test-reporter before-build

.github/workflows/node-js-publish.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ jobs:
1212
- uses: actions/setup-node@v2
1313
with:
1414
node-version: '16.x'
15-
- run: npm ci
16-
- run: npm ci
15+
- run: npm i
16+
- run: npm i
1717
working-directory: ./examples/async
18-
- run: npm ci
18+
- run: npm i
1919
working-directory: ./examples/callback
2020
- run: npm run lint
2121
- run: npm run prettier
@@ -30,7 +30,7 @@ jobs:
3030
with:
3131
node-version: '16.x'
3232
registry-url: https://registry.npmjs.org/
33-
- run: npm ci
33+
- run: npm i
3434
- run: npm publish
3535
env:
3636
NODE_AUTH_TOKEN: ${{ secrets.NPM_GUIDESMITHS }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ coverage
33
*.log
44
.codeclimate
55
.nyc_output
6+
package-lock.json

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)