Skip to content

Commit

Permalink
pre-generate check classname
Browse files Browse the repository at this point in the history
  • Loading branch information
ftwbzhao committed May 20, 2015
1 parent f6346e5 commit 3ea8f75
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Phpmig/Console/Command/AbstractCommand.php
Expand Up @@ -218,6 +218,14 @@ protected function bootstrapMigrations(InputInterface $input, OutputInterface $o
}
$class = $this->migrationToClassName($migrationName);

if ($input->getArgument('command') == 'generate'
&& $class == $this->migrationToClassName($input->getArgument('name'))) {
throw new \InvalidArgumentException(sprintf(
'Migration Class "%s" is already exists',
$class
));
}

if (isset($names[$class])) {
throw new \InvalidArgumentException(sprintf(
'Migration "%s" has the same name as "%s"',
Expand Down

0 comments on commit 3ea8f75

Please sign in to comment.