Add check for duplicate migrations names when loading migrations

[MAILPOET-5416]
This commit is contained in:
Rostislav Wolny
2023-07-24 15:26:52 +02:00
committed by Aschepikov
parent ec8b5260dd
commit 725d81077f
5 changed files with 46 additions and 1 deletions

View File

@@ -18,6 +18,12 @@ class MigratorException extends InvalidStateException {
);
}
public static function duplicateMigrationNames(array $names): self {
return self::create()->withMessage(
sprintf('Duplicate migration names are not allowed. Duplicate names found: "%s".', join(', ', $names))
);
}
public static function migrationFileWriteFailed(string $path): self {
return self::create()->withMessage(
sprintf('Could not write migration file "%s".', $path)