-
-
Notifications
You must be signed in to change notification settings - Fork 178
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
DB migration fails on fresh install with sqlite #521
Comments
My colleagues and I have been facing the same issue for some time. Strangely, it works on about half of our machines, and not on the other half, and we still haven't been able to identify what the difference is. All the versions appear to be the same. I'm afraid the fix for now is to just comment out those migrations that cause problems until we work out what the issue is. Just some notes for further investigation: https://www.sqlite.org/lang_altertable.html
|
Sorry, just seen you're trying to roll your own docker image. That's always very tricky for us to support, and I really don't recommend it, but I know there are often organisational constraints, so you've gotta do what you've gotta do. Secondly, just use postgres if you've got docker-compose. Sqlite is only ever for playing around with anyway - not a prod database. |
Appreciate your input! Indeed, we roll our own docker image because of organizational constraints. It is also the case, that we are using Postgres in production. SQLite is only being used for smoke testing our built docker image. We could however switch to Postgres of course. |
I'd love to be able to recreate the issue in a docker image for debugging. Because I can never recreate it on my own machine I've not been able to investigate it. I've just tried with the latest pact-foundation image, and it's working fine (unfortunately!). |
I'm closing this issue for now until the issue can be recreated reliably, but please re-open if anyone can provide the code for that. |
I was able to built a reproducer: https://gist.github.com/cybe/d882575509049fc218dd83b4cbbc39e7
|
Thanks! I'll have a look at it. Given that it's the same ruby code on both the work and non-working docker images, it does seem like it's something to do with an underlying part of the platform. |
…210702_drop_unused_columns_from_deployed_versions.rb Fixes: #521
I think something has changed between the minor versions of Sqlite.
I was able to recreate the issue, then manually run the statement on the generated database that was causing the error. It gave me a better error message than is shown in the migrations, luckily, and so I've been able to fix it. The fix was strange though - I had to fully qualify a column in an unrelated view that had become ambiguous because a column with the same name was added to one of the tables that made up the view. Dropping the column in the deployed_versions table seems to cause some re-calculation to happen, an issue I'd already run into in some migrations I wrote the other day. I don't know why SQLite waited for me to drop some columns before working it out was confused about the ambiguous column, instead of erroring when I added it in the first place 🤷🏽 I need to do some testing on some unrelated features early next week, but can put out the release after that. |
If you want a dirty hack to get you by until the next release, this does the trick - just don't run it on a production database.
|
Thank you for your thorough investigation! I'll try the hack next week, but otherwise just wait for the next release. |
I can confirm that your hack does indeed work. |
There is a new release out. Please update to 2.90.0. |
Thanks, 2.90.0 is working as expected! |
Pre issue-raising checklist
I have already (please mark the applicable with an
x
):Software versions
Expected behaviour
Start a fresh Pact-Broker installation without a database, using SQLite. The application should start successfully.
Actual behaviour
Migration
20210702_drop_unused_columns_from_deployed_versions.rb
fails. See Stacktrace.Note that our previous installed version 2.79.1 did run successfully.
20210702_drop_unused_columns_from_deployed_versions.rb
was added in version 2.80.0.Steps to reproduce
Starting pact broker with
bundle exec puma
.Let me know if you need a complete reproducible example with docker-compose and whatnot. This requires some work.
Relevant log files
See gist.
The text was updated successfully, but these errors were encountered: