-
-
Notifications
You must be signed in to change notification settings - Fork 389
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add commands to migrate table structure
- Loading branch information
Showing
17 changed files
with
448 additions
and
46 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
lib/Doctrine/Migrations/Exception/MetadataStorageError.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Migrations\Exception; | ||
|
||
use RuntimeException; | ||
|
||
final class MetadataStorageError extends RuntimeException implements MigrationException | ||
{ | ||
public static function notUpToDate() : self | ||
{ | ||
return new self('The metadata storage is not up to date, please run the sync-metadata-storage command to fix this issue.'); | ||
} | ||
|
||
public static function notInitialized() : self | ||
{ | ||
return new self('The metadata storage is not initialized, please run the sync-metadata-storage command to fix this issue.'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
lib/Doctrine/Migrations/Tools/Console/Command/SyncMetadataCommand.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Migrations\Tools\Console\Command; | ||
|
||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
class SyncMetadataCommand extends DoctrineCommand | ||
{ | ||
/** @var string */ | ||
protected static $defaultName = 'migrations:sync-metadata-storage'; | ||
|
||
protected function configure() : void | ||
{ | ||
parent::configure(); | ||
|
||
$this | ||
->setAliases(['sync-metadata-storage']) | ||
->setDescription('Ensures that the metadata storage is at the latest version.') | ||
->setHelp(<<<EOT | ||
The <info>%command.name%</info> command updates metadata storage the latest version. | ||
<info>%command.full_name%</info> | ||
EOT | ||
); | ||
} | ||
|
||
public function execute( | ||
InputInterface $input, | ||
OutputInterface $output | ||
) : int { | ||
$this->getDependencyFactory()->getMetadataStorage()->ensureInitialized(); | ||
|
||
$output->writeln('Metadata storage synchronized'); | ||
|
||
return 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.