Skip to content

Instantly share code, notes, and snippets.

@melyouz
Last active May 26, 2021 09:08
Show Gist options
  • Save melyouz/588af15dd6171a5ef7f0d8d37c3c9e1a to your computer and use it in GitHub Desktop.
Save melyouz/588af15dd6171a5ef7f0d8d37c3c9e1a to your computer and use it in GitHub Desktop.
# Doctrine + PostgreSQL Migration
Doctrine + PostgreSQL Migration
Doctrine adds "CREATE SCHEMA public" SQL even if there are no changes.
<?php declare(strict_types=1);
namespace App\Infra\Migrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20181223212750 extends AbstractMigration
{
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('CREATE SCHEMA public');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment