migrations/Version20180319141017.php line 1
<?php
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Added column description to table media and set category and filename to not null
*/
class Version20180319141017 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema) : void
{
// this up() 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('ALTER TABLE media ADD description VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE media ALTER category SET NOT NULL');
$this->addSql('ALTER TABLE media ALTER filename SET NOT NULL');
$this->addSql('COMMENT ON COLUMN media.description IS \'Description or credits\'');
}
/**
* @param Schema $schema
*/
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');
$this->addSql('ALTER TABLE media DROP description');
$this->addSql('ALTER TABLE media ALTER category DROP NOT NULL');
$this->addSql('ALTER TABLE media ALTER filename DROP NOT NULL');
}
}