tj / node-migrate

Abstract migration framework for node
MIT License
1.53k stars 221 forks source link

`migrate up foo` migrates all the way up #156

Open hdon opened 5 years ago

hdon commented 5 years ago

If you name the migration you want to migrate up to, but it doesn't exist, migrate up foo will migrate all the way up:

hdon@ubuntu-s-1vcpu-1gb-sfo2-01:~$ mkdir migrate-project
hdon@ubuntu-s-1vcpu-1gb-sfo2-01:~$ cd migrate-project/
hdon@ubuntu-s-1vcpu-1gb-sfo2-01:~/migrate-project$ npm i migrate
npm WARN saveError ENOENT: no such file or directory, open '/home/hdon/migrate-project/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/home/hdon/migrate-project/package.json'
npm WARN migrate-project No description
npm WARN migrate-project No repository field.
npm WARN migrate-project No README data
npm WARN migrate-project No license field.

+ migrate@1.6.2
added 20 packages from 13 contributors and audited 21 packages in 0.884s
found 0 vulnerabilities

hdon@ubuntu-s-1vcpu-1gb-sfo2-01:~/migrate-project$ ./node_modules/.bin/migrate init
  migrations dir : /home/hdon/migrate-project/migrations
hdon@ubuntu-s-1vcpu-1gb-sfo2-01:~/migrate-project$ ./node_modules/.bin/migrate create a
  create : /home/hdon/migrate-project/migrations/1558410539360-a.js
hdon@ubuntu-s-1vcpu-1gb-sfo2-01:~/migrate-project$ ./node_modules/.bin/migrate create a
  create : /home/hdon/migrate-project/migrations/1558410540833-a.js
hdon@ubuntu-s-1vcpu-1gb-sfo2-01:~/migrate-project$ ./node_modules/.bin/migrate create a
  create : /home/hdon/migrate-project/migrations/1558410546618-a.js
hdon@ubuntu-s-1vcpu-1gb-sfo2-01:~/migrate-project$ ./node_modules/.bin/migrate up b
  up : 1558410539360-a.js
  up : 1558410540833-a.js
  up : 1558410546618-a.js
  migration : complete
hdon@ubuntu-s-1vcpu-1gb-sfo2-01:~/migrate-project$ node --version
v12.0.0
hdon@ubuntu-s-1vcpu-1gb-sfo2-01:~/migrate-project$ npm --version
6.9.0
wesleytodd commented 5 years ago

Interesting, yes it would migrate all the way up. I am not sure what I would expect it to do, but probably not that. First off I feel like it should error an exit, but I would want to think on it a little before we make any decision. If you open a PR to change this behavior it would give a good start to the conversation.

LinusU commented 5 years ago

First off I feel like it should error an exit

My first thought as well :+1:

wesleytodd commented 5 years ago

@hdon, are you planning on opening PRs for these issues you opened?