Improve command for creating new migrations

Use required parameter instead of optional option
[MAILPOET-5416]
This commit is contained in:
Rostislav Wolny
2023-07-24 15:08:37 +02:00
committed by Aschepikov
parent b4d0b35a1d
commit ec8b5260dd
4 changed files with 26 additions and 4 deletions

View File

@ -27,6 +27,9 @@ class Repository {
/** @return array{name: string, path: string} */
public function create(string $level): array {
if (!in_array($level, [self::MIGRATIONS_LEVEL_APP, self::MIGRATIONS_LEVEL_DB], true)) {
throw MigratorException::invalidMigrationLevel($level);
}
$templateFile = str_replace('{level}', $level, $this->templateFile);
$template = @file_get_contents($templateFile);
if (!$template) {