s2i-ruby-container
s2i-ruby-container copied to clipboard
Fedora environment variable VERSION=0 causes Rails db migration reverting
Container platform
OCP 4
Version
Fedora
OS version of the container image
Fedora
Bugzilla, Jira
No response
Description
In Rails, it support this ENV when running migrations: bin/rails db:migrate VERSION=20080906120000
In Fedora images, it has VERSION=0 in the dockerfile which makes the target version 0 and reverting all the db migrations
Reproducer
No response
Thanks for the report, please could you share what are the versions of your Rails and ActiveRecord gems you use in the application?
Ok, I did some testing with Rails 6.1.7.7.
For a workaround it looks to be necessary to specify the variable VERSION as empty in command like so: VERSION= bin/rails db:migrate
. Forcing VERSION to be empty either as showed or alternatively via export VERSION=
. Rails 5 up to Rails 7 seem to have the required bits for this workaround to work, I have not tested all of them though.
Alternative workaround for when executed via shell (e.g. bash), unset the version like so: unset VERSION; bin/rails db:migrate
.
We plan to incorporate a fix to ruby 3.3 Fedora image.