Last active
November 28, 2023 07:13
-
-
Save KaiCMueller/c4f65206d541f0fca1fad89600b384ea to your computer and use it in GitHub Desktop.
Doctrine Migrations Template
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
doctrine_migrations: | |
dir_name: "%kernel.project_dir%/src/Migrations" | |
namespace: "App\\Migrations" | |
custom_template: "%kernel.project_dir%/src/Migrations/migration.tpl" |
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
<?php declare(strict_types = 1); | |
namespace <namespace>; | |
use Doctrine\DBAL\Schema\Schema; | |
use Doctrine\Migrations\AbstractMigration; | |
/** | |
* Auto-generated Migration: Please modify to your needs! | |
*/ | |
class Version<version> extends AbstractMigration | |
{ | |
/** | |
* @param \Doctrine\DBAL\Schema\Schema $schema | |
* | |
* @return void | |
*/ | |
public function up(Schema $schema): void | |
{ | |
// this up() migration is auto-generated, please modify it to your needs | |
<up> | |
} | |
/** | |
* @param \Doctrine\DBAL\Schema\Schema $schema | |
* | |
* @return void | |
*/ | |
public function down(Schema $schema) | |
{ | |
// this down() migration is auto-generated, please modify it to your needs | |
<down> | |
} | |
} |
As of Doctrine Migrations 3.1 <version> is no longer used. Now the whole class name is set with <className>.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is an example on how to create a custom template file for doctrine migrations.
"doctrine_migrations.yaml" is a symfony configuration file with the path pointing to the template file.
https://medium.com/@kcmueller/create-a-custom-template-for-doctrine-migrations-24d2b0314376