I am upgrading my app from Rails 6.1 to Rails 7.0, and in the upgrading instructions they made an important note about:
ensure that the version of the schema is included in the schema dump.
Like in here:
ActiveRecord::Schema[6.1].define(version: 2022_01_28_123512) do
# ...
end
But in my schema.rb I don't have such a version of the schema:
ActiveRecord::Schema.define(version: 2024_05_05_142804) do
# ...
end
Even after running rails app:update
and rails db:schema:dump
.
I have tried to add the [6.1]
by hand and then run rails db:schema:dump
, but the result is that the version number is removed again.
Is this important? and how I can solve it?
This was added in v7.0.2
:
Dump the database schema containing the current Rails version...
https://github.com/rails/rails/releases/tag/v7.0.2
Before that you do not get a schema version:
ActiveRecord::Schema.define(#{define_params}) do
...
https://github.com/rails/rails/blob/v7.0.1/activerecord/lib/active_record/schema_dumper.rb#L90