ilyakatz / data-migrate

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

feat: Allow multiple data_migrations_path values #331

Open jordanbyron opened 2 weeks ago

jordanbyron commented 2 weeks ago

This PR adds the ability for multiple data_migration_paths to be set. This is useful for Rails applications leveraging tools like Packwerk / Packs to split up their codebase into multiple packages.

Multiple paths can be specified in the data_migration_paths configuration option, however the default of one path is still valid.

# config/initializers/data_migrate.rb

DataMigrate.configure do |config|
  config.data_migrations_path = ['db/data/'] + Dir['packs/**/db/data']
end

The first path in the array is the default path which is used when generating new data migration files.

Much of this code was borrowed from #244, but I had to make some changes to get it working with the latest version.