diff --git a/lib/data_migrate/database_tasks.rb b/lib/data_migrate/database_tasks.rb index 3f5a914..90f9a27 100644 --- a/lib/data_migrate/database_tasks.rb +++ b/lib/data_migrate/database_tasks.rb @@ -179,9 +179,14 @@ def self.migrate_with_data ActiveRecord::Migration.verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true - db_configs = ActiveRecord::Base.configurations.configs_for(env_name: ActiveRecord::Tasks::DatabaseTasks.env) + schema_mapped_versions = if DataMigrate::RailsHelper.rails_version_equal_to_or_higher_than_7_1 + ActiveRecord::Tasks::DatabaseTasks.db_configs_with_versions + else + db_configs = ActiveRecord::Base.configurations.configs_for(env_name: ActiveRecord::Tasks::DatabaseTasks.env) + + ActiveRecord::Tasks::DatabaseTasks.db_configs_with_versions(db_configs) + end - schema_mapped_versions = ActiveRecord::Tasks::DatabaseTasks.db_configs_with_versions(db_configs) data_mapped_versions = DataMigrate::DatabaseTasks.db_configs_with_versions mapped_versions = schema_mapped_versions.merge(data_mapped_versions) do |_key, schema_db_configs, data_db_configs|