Skip to content

Commit

Permalink
Add namespaced class support for Phinx migrations
Browse files Browse the repository at this point in the history
This adds support for configuring `Phinx` migrations with namespaces.
To make use of this new feature, add the following block to the
`project.ini`:

```ini
[Migration]
NamespacedPaths[Namespace\Path]=extension/mysite/migrations
```

Multiple namespaced paths can be added if needed.
  • Loading branch information
StianTorjussen committed Aug 31, 2021
1 parent d2975ee commit 6721cac
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Aplia/Migration/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ public function makePhinxConfiguration() {
$projectIni = eZINI::instance('project.ini');
if ($projectIni->hasVariable('Migration', 'Path')) {
$migrationsPath = $projectIni->variable('Migration', 'Path');
} else if ($projectIni->hasVariable('Migration', 'NamespacedPaths')) {
$migrationsPath = $projectIni->variable('Migration', 'NamespacedPaths');
} else {
$migrationsPath = "extension/site/migrations";
}
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,13 @@ path must be configured in `project.ini`, add the following:
Path=extension/mysite/migrations
```

Or if you have migrated to using namespaces, add the following (multiple namespaced paths can be added if needed):

```ini
[Migration]
NamespacedPaths[Namespace\Path]=extension/mysite/migrations
```

Then use `vendor/bin/phinx` to handle migrations, remember to add `-c phinx.php` to
after all commands. For instance to see the current status.

Expand Down

0 comments on commit 6721cac

Please sign in to comment.