Skip to content
This repository has been archived by the owner on Feb 4, 2021. It is now read-only.

Include Phinx migrations from extensions #318

Closed
stevenrombauts opened this issue Apr 20, 2017 · 5 comments
Closed

Include Phinx migrations from extensions #318

stevenrombauts opened this issue Apr 20, 2017 · 5 comments
Assignees
Labels
Milestone

Comments

@stevenrombauts
Copy link
Member

Right now we expect all migrations to be in the install/mysql/migrations directory. This does not yet include extension migrations.

It should be possible to include multiple paths and look for a common directory in every extension, so we can also create migrations files per release. We could read these from the vendor directory.

@stevenrombauts stevenrombauts added this to the Backlog milestone Apr 20, 2017
@johanjanssens
Copy link
Member

@stevenrombauts What about symlinking? Could we symlink the paths for extensions into this path to Phinx can find them there?

@johanjanssens johanjanssens modified the milestones: 1.1, Backlog Apr 20, 2017
@stevenrombauts
Copy link
Member Author

@johanjanssens Phinx has built-in support for multiple paths, so something like this should work:

paths:
    migrations:
      - %%PHINX_CONFIG_DIR%%/install/mysql/migrations
      - %%PHINX_CONFIG_DIR%%/app/administrator/components/com_*/resources/install/migrations

That will expand to all component directories that have the migrations directory in it. Tested this real quick locally and it works great. No need for any manual setup then.

@johanjanssens
Copy link
Member

@stevenrombauts The above code where should this go? I'm happy to add it so we can get this out the door for 2.0.

@stevenrombauts
Copy link
Member Author

@johanjanssens I've updated the code and opened PR #323 for a review.

To test this:

  1. Make sure Phinx is up to date (composer install)
  2. List all migrations: vendor/bin/phinx status
  3. To test the new extension migrations, create a test directory inside one of the extensions. Example: mkdir -p app/administrator/components/com_users/resources/install/mysql/migrations/
  4. When creating a new migration, Phinx will ask you where to put it: vendor/bin/phinx create TestMigration.

@johanjanssens
Copy link
Member

@allanpilarca Assigning this to you for testing.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants