Skip to content

Commit

Permalink
Revert "Multiple migration directories"
Browse files Browse the repository at this point in the history
This reverts commit 2821ca6.
  • Loading branch information
f3l1x committed Jan 10, 2025
1 parent 2821ca6 commit 41331ae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
6 changes: 3 additions & 3 deletions .docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ extensions:
nettrine.migrations:
table: <string>
column: <string>
directories: <array>
directory: <path>
namespace: <string>
versionsOrganization: <null|year|year_and_month>
customTemplate: <null|path>
```
Expand All @@ -81,8 +82,7 @@ Minimal configuration:

```yaml
nettrine.migrations:
directories:
App\Migrations: %appDir%/migrations
directory: %appDir%/migrations
```


Expand Down
8 changes: 3 additions & 5 deletions src/DI/MigrationsExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ public function getConfigSchema(): Schema
return Expect::structure([
'table' => Expect::string('doctrine_migrations'),
'column' => Expect::string('version'),
'directories' => Expect::array()->required(),
'directory' => Expect::string()->required(),
'namespace' => Expect::string('Migrations'),
'versionsOrganization' => Expect::anyOf(
null,
Configuration::VERSIONS_ORGANIZATION_BY_YEAR,
Expand Down Expand Up @@ -62,12 +63,9 @@ public function loadConfiguration(): void
->setFactory(Configuration::class)
->addSetup('setCustomTemplate', [$config->customTemplate])
->addSetup('setMetadataStorageConfiguration', [$storage])
->addSetup('addMigrationsDirectory', [$config->namespace, $config->directory])
->addSetup('setAllOrNothing', [$config->allOrNothing]);

foreach ($config->directories as $namespace => $directory) {
$configuration->addSetup('addMigrationsDirectory', [$namespace, $directory]);
}

if ($config->versionsOrganization === Configuration::VERSIONS_ORGANIZATION_BY_YEAR) {
$configuration->addSetup('setMigrationsAreOrganizedByYear');
} elseif ($config->versionsOrganization === Configuration::VERSIONS_ORGANIZATION_BY_YEAR_AND_MONTH) {
Expand Down

0 comments on commit 41331ae

Please sign in to comment.