fix: allow db:schema:load to work for rails 6.0 and 6.1#343
fix: allow db:schema:load to work for rails 6.0 and 6.1#343vprigent merged 1 commit intoilyakatz:9-1-stablefrom
Conversation
lib/data_migrate/database_tasks.rb
Outdated
|
|
||
| def schema_dump_path(db_config, format = ActiveRecord.schema_format) | ||
| return ENV["DATA_SCHEMA"] if ENV["DATA_SCHEMA"] | ||
| unless Gem::Dependency.new("railties", "< 7.0").match?("railties", Gem.loaded_specs["railties"].version) |
There was a problem hiding this comment.
I've re-extracted this check to make it more intent that we only add these two methods for newer Rails versions that have more complex support for multiple databases. All the previous gem versions compatible with rails 6.0 specifically worked without these methods.
|
@jgmontoya would love your input on this once more. I might spend a bit more time tomorrow to validate my assumptions here with more complex rails apps. (I've just tested against the ruby and sql structure config on rails 6.0 and 6.1 but not with read-replica for example.) |
jgmontoya
left a comment
There was a problem hiding this comment.
This seems like a good idea, tbh I wouldn't invest too much more time/effort in extending support for rails 6.0 given it has been EOL for over a year (even 6.1 is becoming EOL next week afaik)
lib/data_migrate/database_tasks.rb
Outdated
|
|
||
| def schema_dump_path(db_config, format = ActiveRecord.schema_format) | ||
| return ENV["DATA_SCHEMA"] if ENV["DATA_SCHEMA"] | ||
| unless Gem::Dependency.new("railties", "< 7.0").match?("railties", Gem.loaded_specs["railties"].version) |
There was a problem hiding this comment.
I'd change the unless to an if and flip the condition, I think it makes it easier to read
f94afe6 to
c2d2992
Compare
c2d2992 to
bdc3359
Compare
Still planning to only release this for 9-1. I suspect a better fix for 6.1 that would also support multi-databases might be a bit more tricky.
For a bit of context:
schema_dump_path is introduced in rails 7 and our task relies on that to improve the support for multiple databases, however full multiple data support was only handled in subsequent gem versions, so I'm hoping this patch will solve rails 6.x issues for people still using older rails versions.