Skip to content

feat: Allow multiple data_migrations_path values#331

Merged
vprigent merged 1 commit into
ilyakatz:mainfrom
jordanbyron:chore/support-multiple-migration-paths
Sep 17, 2024
Merged

feat: Allow multiple data_migrations_path values#331
vprigent merged 1 commit into
ilyakatz:mainfrom
jordanbyron:chore/support-multiple-migration-paths

Conversation

@jordanbyron

Copy link
Copy Markdown

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.

@vprigent

Copy link
Copy Markdown
Collaborator

Apologies for the delay and thanks for the PR @jordanbyron!

I think its a great addition and will certainly make modularized apps integration with data-migrate easier. 👍

@vprigent vprigent merged commit 2d29c02 into ilyakatz:main Sep 17, 2024
@jordanbyron jordanbyron deleted the chore/support-multiple-migration-paths branch September 17, 2024 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants