dosfarma / migrations-bundle
Symfony framework integration bundle for phpmig
Installs: 279
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 4
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: ^7.4
- davedevelopment/phpmig: ^1.7
- symfony/console: ^4.4
- symfony/dependency-injection: ^4.4|^5.0
- symfony/http-kernel: ^4.4
Suggests
- ext-mongodb: To be able to create migrations for MongoDB using provided MongoDBDriverManager
This package is auto-updated.
Last update: 2021-03-22 15:56:46 UTC
README
Symfony framework integration for davedevelopment/phpmig
Setup
# config/bundles.php return [ DosFarma\MigrationsBundle\DosFarmaMigrationsBundle::class => ['dev' => true, 'test' => true], ];
# services.yaml parameters: dos_farma.migrations.migrations_directory: '%kernel.project_dir%/migrations/postgresql/' dos_farma.migrations.migration_template: '%kernel.project_dir%/vendor/dosfarma/migrations-bundle/src/Resources/templates/dbalSql.php.twig' dos_farma.migrations.control_table: 'serviceschema.migrations' services: DosFarma\MigrationsBundle\Infrastructure\Service\Phpmig\Adapter\Adapter: class: DosFarma\MigrationsBundle\Infrastructure\Service\Phpmig\Adapter\DbalAdapter public: false autoconfigure: true arguments: $connection: '@connection.dbal.myservice' # Doctrine DBAL Connection $tableName: '%dos_farma.migrations.control_table%' DosFarma\MigrationsBundle\Infrastructure\Service\Phpmig\ConfigurationContainer: public: true class: DosFarma\MigrationsBundle\Infrastructure\Service\Phpmig\ConfigurationContainer autoconfigure: true factory: DosFarma\MigrationsBundle\Infrastructure\Service\Phpmig\ConfigurationContainer::from arguments: $adapter: '@DosFarma\MigrationsBundle\Infrastructure\Service\Phpmig\Adapter\Adapter' $directory: '%dos_farma.migrations.migrations_directory%' $template: '%dos_farma.migrations.migration_template%'
Usage
- Initialize the control table (needed just once):
$ console migrations:init
- View current migrations status:
To use in batch scripts requiring non-zero return values on error, use:$ console migrations:status
$ console migrations:check
- Generate a new migration from template:
$ console migrations:generate ThisIsTheMigrationSubject
- Do pending migrations:
To do migrations up to (stop in) specified migration id:$ console migrations:migrate
$ console migrations:migrate --target 20201014114643
- Rollback the last migration:
To rollback down to specified migration id, use:$ console migrations:rollback
$ console migrations:rollback --target 20201014114643
- Up a migration id:
$ console migrations:up 20201014114643
- Down a migration id:
To Re-Do (down and up) an already migrated id, you may use a single command:$ console migrations:down 20201014114643
$ console migrations:redo 20201014114643