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

Change TRUNCATE to DELETE FROM in postgres database #36

Conversation

elliott-davis
Copy link

This actually isn't a problem for postgres but is a problem for cockroach.
Internally cockroach drops the table when running a truncate which causes the insert to fail inside of this transaction. I added repro steps to mattes/migrate#320 which this PR should close.

Closes: mattes/migrate#320

Signed-off-by: Elliott Davis elliott@excellent.io

This actually isn't a problem for postgres but is a problem for cockroach.
Internally cockroach drops the table when running a truncate which causes the insert to fail inside of this transaction. I added repro steps to mattes/migrate#320 which this PR should close.

Closes: mattes/migrate#320

Signed-off-by: Elliott Davis <elliott@excellent.io>
elliott-davis pushed a commit to chuckleheads/hurtlocker that referenced this pull request May 22, 2018
The long and the short of this is there were multiple errors with parsing configs and running migrations.

What you need to know:

There is a patched vendor file (shame on me, I know). However, being the nice netizen that I am, I made a PR upstream golang-migrate/migrate#36

The other stuff is mostly cleanup around how viper serializes config files and some bad quoting on my part in originsrv.

Signed-off-by: Elliott Davis <elliott@excellent.io>
elliott-davis pushed a commit to chuckleheads/hurtlocker that referenced this pull request May 22, 2018
The long and the short of this is there were multiple errors with parsing configs and running migrations.

What you need to know:

There is a patched vendor file (shame on me, I know). However, being the nice netizen that I am, I made a PR upstream golang-migrate/migrate#36

The other stuff is mostly cleanup around how viper serializes config files and some bad quoting on my part in originsrv.

Signed-off-by: Elliott Davis <elliott@excellent.io>
@elliott-davis
Copy link
Author

I'm closing this because I didn't realize I should be using:
driver, err := cockroachdb.WithInstance(db, &cockroachdb.Config{})
instead of:
driver, err := postgres.WithInstance(db, &postgres.Config{})

Apologies.

@elliott-davis elliott-davis deleted the elliott/delete_over_truncate branch May 22, 2018 12:53
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

Successfully merging this pull request may close these issues.

First migration issue cockroachdb
2 participants