Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add attributes to commands #1330

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Doctrine\Migrations\Tools\Console\Command;

use Doctrine\Migrations\Exception\MigrationClassNotFound;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

Expand All @@ -13,6 +14,7 @@
/**
* The CurrentCommand class is responsible for outputting what your current version is.
*/
#[AsCommand(name: 'migrations:current', description: 'Outputs the current version')]
final class CurrentCommand extends DoctrineCommand
{
/** @var string|null */
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/Migrations/Tools/Console/Command/DiffCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Doctrine\Migrations\Tools\Console\Exception\InvalidOptionUsage;
use Doctrine\SqlFormatter\SqlFormatter;
use OutOfBoundsException;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
Expand All @@ -29,6 +30,7 @@
* The DiffCommand class is responsible for generating a migration by comparing your current database schema to
* your mapping information.
*/
#[AsCommand(name: 'migrations:diff', description: 'Generate a migration by comparing your current database to your mapping information.')]
final class DiffCommand extends DoctrineCommand
{
/** @var string|null */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Doctrine\Migrations\Tools\Console\Exception\InvalidOptionUsage;
use Doctrine\Migrations\Tools\Console\Exception\SchemaDumpRequiresNoMigrations;
use Doctrine\SqlFormatter\SqlFormatter;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
Expand All @@ -25,6 +26,7 @@
*
* @see Doctrine\Migrations\Tools\Console\Command\RollupCommand
*/
#[AsCommand(name: 'migrations:dump-schema', description: 'Dump the schema for your database to a migration.')]
final class DumpSchemaCommand extends DoctrineCommand
{
/** @var string|null */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Doctrine\Migrations\Version\Direction;
use Doctrine\Migrations\Version\Version;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
Expand All @@ -24,6 +25,7 @@
/**
* The ExecuteCommand class is responsible for executing migration versions up or down manually.
*/
#[AsCommand(name: 'migrations:execute', description: 'Execute one or more migration versions up or down manually.')]
final class ExecuteCommand extends DoctrineCommand
{
/** @var string|null */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Doctrine\Migrations\Tools\Console\Command;

use Exception;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
Expand All @@ -17,6 +18,7 @@
/**
* The GenerateCommand class is responsible for generating a blank migration class for you to modify to your needs.
*/
#[AsCommand(name: 'migrations:generate', description: 'Generate a blank migration class.')]
final class GenerateCommand extends DoctrineCommand
{
/** @var string|null */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Doctrine\Migrations\Tools\Console\Command;

use Doctrine\Migrations\Exception\NoMigrationsToExecute;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

Expand All @@ -13,6 +14,7 @@
/**
* The LatestCommand class is responsible for outputting what your latest version is.
*/
#[AsCommand(name: 'migrations:latest', description: 'Outputs the latest version')]
final class LatestCommand extends DoctrineCommand
{
/** @var string|null */
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/Migrations/Tools/Console/Command/ListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Doctrine\Migrations\Metadata\ExecutedMigration;
use Doctrine\Migrations\Metadata\ExecutedMigrationsList;
use Doctrine\Migrations\Version\Version;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

Expand All @@ -20,6 +21,7 @@
/**
* The ListCommand class is responsible for outputting a list of all available migrations and their status.
*/
#[AsCommand(name: 'migrations:list', description: 'Display a list of all available migrations and their status.')]
final class ListCommand extends DoctrineCommand
{
/** @var string|null */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Doctrine\Migrations\Exception\NoMigrationsToExecute;
use Doctrine\Migrations\Exception\UnknownMigrationVersion;
use Doctrine\Migrations\Metadata\ExecutedMigrationsList;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
Expand All @@ -28,6 +29,7 @@
* The MigrateCommand class is responsible for executing a migration from the current version to another
* version up or down. It will calculate all the migration versions that need to be executed and execute them.
*/
#[AsCommand(name: 'migrations:migrate', description: 'Execute a migration to a specified version or the latest available version.')]
final class MigrateCommand extends DoctrineCommand
{
/** @var string|null */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Doctrine\Migrations\Tools\Console\Command;

use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

Expand All @@ -13,6 +14,7 @@
* The RollupCommand class is responsible for deleting all previously executed migrations from the versions table
* and marking the freshly dumped schema migration (that was created with DumpSchemaCommand) as migrated.
*/
#[AsCommand(name: 'migrations:rollup', description: 'Rollup migrations by deleting all tracked versions and insert the one version that exists.')]
final class RollupCommand extends DoctrineCommand
{
/** @var string|null */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@

namespace Doctrine\Migrations\Tools\Console\Command;

use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

/**
* The StatusCommand class is responsible for outputting what the current state is of all your migrations. It shows
* what your current version is, how many new versions you have to execute, etc. and details about each of your migrations.
*/
#[AsCommand(name: 'migrations:status', description: 'View the status of a set of migrations.')]
final class StatusCommand extends DoctrineCommand
{
/** @var string|null */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@

namespace Doctrine\Migrations\Tools\Console\Command;

use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(name: 'migrations:sync-metadata-storage', description: 'Ensures that the metadata storage is at the latest version.')]
final class SyncMetadataCommand extends DoctrineCommand
{
/** @var string|null */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Doctrine\Migrations\Metadata\ExecutedMigration;
use Doctrine\Migrations\Metadata\ExecutedMigrationsList;
use Doctrine\Migrations\Version\Version;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
Expand All @@ -24,6 +25,7 @@
* The UpToDateCommand class outputs if your database is up to date or if there are new migrations
* that need to be executed.
*/
#[AsCommand(name: 'migrations:up-to-date', description: 'Tells you if your schema is up-to-date.')]
final class UpToDateCommand extends DoctrineCommand
{
/** @var string|null */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Doctrine\Migrations\Version\Direction;
use Doctrine\Migrations\Version\ExecutionResult;
use Doctrine\Migrations\Version\Version;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
Expand All @@ -23,6 +24,7 @@
/**
* The VersionCommand class is responsible for manually adding and deleting migration versions from the tracking table.
*/
#[AsCommand(name: 'migrations:version', description: 'Manually add and delete migration versions from the version table.')]
final class VersionCommand extends DoctrineCommand
{
/** @var string|null */
Expand Down