ilyakatz / data-migrate

Migrate and update data alongside your database structure.
MIT License
1.4k stars 192 forks source link

9.3.0 incompatible with Rails < 7 #302

Open toby-brilliant opened 6 months ago

toby-brilliant commented 6 months ago

It looks like db_configs_with_versions was only introduced in Rails 7 here but is in use by the recently released 9.3.0

Seeing:

NoMethodError undefined method `db_configs_with_versions' for module primary
at block (3 levels) in <top (required)>(/home/ruby/bundle/ruby/3.3.0/gems/data_migrate-9.3.0/tasks/databases.rake:14)
ngan commented 6 months ago

Thanks for reporting! We'll take a look

ngan commented 6 months ago

@toby-brilliant can you give https://github.com/ilyakatz/data-migrate/pull/303 a try?

toby-brilliant commented 6 months ago

I get:

NameError: uninitialized constant DataMigrate::ActiveRecordDatabaseTasks (NameError)

      schema_mapped_versions = DataMigrate::ActiveRecordDatabaseTasks.db_configs_with_versions

with

GIT
  remote: https://github.com/ilyakatz/data-migrate.git
  revision: 688316801f2f04eb53ed5165c9014f6370653a8c
  branch: fix-rails-6
  specs:
    data_migrate (9.3.0)
      activerecord (>= 6.1)
      railties (>= 6.1)

Maybe missing a

require File.join(File.dirname(__FILE__), "data_migrate", "active_record_database_tasks")
ngan commented 6 months ago

Yup. I’ll have more time to work on this tomorrow.

toby-brilliant commented 6 months ago

With the require added and the "repond" typo fixed I get:

NoMethodError: undefined method `with_temporary_pool_for_each' for module primary (NoMethodError)

        with_temporary_pool_for_each do |pool|
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Did you mean?  with_temporary_connection_for_each
<internal:kernel>:187:in `loop'
jeffbax commented 6 months ago

Also ran into this :) ty for catching

bruno-costanzo commented 3 weeks ago

Is this already fixed?

bruno-costanzo commented 3 weeks ago

I think this is fixed after 11.0.0rc3. I will close this issue in a few days.

Morozzzko commented 1 week ago

Fixed with 11.0.0 (I think). Let me know if not and we'll reopen

toby-brilliant commented 5 days ago

It does not appear to be fixed with 11. See https://github.com/ilyakatz/data-migrate/issues/295 and my own experience:

NoMethodError: undefined method `db_configs_with_versions' for module primary
migrate_with_data(/home/ruby/bundle/ruby/3.3.0/gems/data_migrate-11.0.0/lib/data_migrate/database_tasks.rb:187)
block (3 levels) in <top (required)>(/home/ruby/bundle/ruby/3.3.0/gems/data_migrate-11.0.0/tasks/databases.rake:9)
block in execute(/home/ruby/bundle/ruby/3.3.0/gems/rake-13.2.1/lib/rake/task.rb:281)
each(/home/ruby/bundle/ruby/3.3.0/gems/rake-13.2.1/lib/rake/task.rb:281)
...
Morozzzko commented 4 days ago

Reopened it is! Thank you!