ilyakatz / data-migrate

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

Rails Engine configuration breaks generator or leads to unexpected generator location #314

Open braindeaf opened 2 months ago

braindeaf commented 2 months ago

When using the recommended solution for Rails Engines, this breaks the generator in the root application as the location of the generated migration ends up being in. I suspect the behaviour should be if the path is an array then it should use the first path in the list when generating a migration.

/db/data/engine/db/data/engine2/db/data/1212412412_migration.rb

module EngineName
  class Engine < ::Rails::Engine
    initializer :engine_name do |app|
      ::DataMigrate.configure do |data_migrate|
        default_path = ::DataMigrate::Config.new.data_migrations_path
        data_migrate.data_migrations_path = [default_path, root.join('db', 'data')]
      end
    end
  end
end
bruno-costanzo commented 3 weeks ago

I will see this tomorrow