Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails with preceeding/existing migrations #83

Closed
downzer0 opened this issue May 8, 2017 · 8 comments
Closed

Fails with preceeding/existing migrations #83

downzer0 opened this issue May 8, 2017 · 8 comments

Comments

@downzer0
Copy link

downzer0 commented May 8, 2017

When creating a second migration and attempting to migrate up to add it, the task fails because the first migration was already run. It seems to be running (and failing) rather than skipping previously successful/complete migrations.

I tried with the --no-check-order option, but got the same results.

I've got two migrations currently, one was created and run successfully a while ago. The second was created recently. When running the second, it sees the first and fails. Checking the pgmigrate database table does in fact show the first/initial migration there. Timestamps match.

I was hesitant to file an issue because this seems like user-error, but searching StackOverflow and the web doesn't turn up similar findings. Am I doing something wrong, or is this a legit bug?

> pg-migrate up

> Rolling back attempted migration ...
Error: Not run migration 1491784040558_create-table-users is preceding already run migration 1491784040558_create-table-users.js
@dolezel
Copy link
Contributor

dolezel commented May 10, 2017

Can you please provide output for ls -la in migrations folder and select * from pgmigrations;?
Thanks

@dolezel dolezel closed this as completed Jun 16, 2017
@jitendrapawar
Copy link

Hello @dolezel ,

I am also getting the same error, but I got to know why we are getting this issue.

Actually it was because of I dont have a migration file which is already executed on database. This scenario arises because we are using shared database for our local environment. We dont have a database locally. So one of team member created a migration & execcuted that on database but that migration file is not yet shared with the team(as merge request is not approved yet)

So can you please let us know if can use any other option in node-pg-migrate to avoid this error.

@dolezel
Copy link
Contributor

dolezel commented Oct 16, 2018

Using --no-check-order will disable check for migration order (see)
But I can only advise you to use different DB for each developer, or at least for each feature. You can't be even sure if something goes wrong (with almost anything), if it is bug in current branch or done by another developer working on some other feature...

@jitendrapawar
Copy link

Yes, I agree on that.
But I checked with -no-order-check, it didn't worked

@dolezel
Copy link
Contributor

dolezel commented Oct 16, 2018

It has to be run with double dashes for parameters to be passed through npm:
e.g. npm run migrate up -- --no-check-order

@downzer0
Copy link
Author

Woah sorry I lost track of this! Looks closed, and I haven't run into the issue again. Thanks for being attentive.

@titarenko
Copy link

npm run migrate up -- --no-check-order – worth mentioning in docs

@mieradi
Copy link

mieradi commented Nov 24, 2022

Thanks for all the info!

Are there any risks when running -- --no-check-order?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants