migrations/Version20180102131934.php line 1
<?php
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* set default value of columns created_at to now()
*/
class Version20180102131934 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 ALTER created_at SET DEFAULT CURRENT_TIMESTAMP ');
$this->addSql('ALTER TABLE node ALTER created_at SET DEFAULT CURRENT_TIMESTAMP');
$this->addSql('ALTER TABLE player_sessionhist ALTER created_at SET DEFAULT CURRENT_TIMESTAMP');
$this->addSql('ALTER TABLE users ALTER created_at SET DEFAULT CURRENT_TIMESTAMP');
$this->addSql('ALTER TABLE mcq ALTER created_at SET DEFAULT CURRENT_TIMESTAMP');
$this->addSql('ALTER TABLE link ALTER created_at SET DEFAULT CURRENT_TIMESTAMP');
$this->addSql('ALTER TABLE scenario ALTER created_at SET DEFAULT CURRENT_TIMESTAMP');
}
/**
* @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 mcq ALTER created_at DROP DEFAULT');
$this->addSql('ALTER TABLE users ALTER created_at DROP DEFAULT');
$this->addSql('ALTER TABLE scenario ALTER created_at DROP DEFAULT');
$this->addSql('ALTER TABLE player_sessionhist ALTER created_at DROP DEFAULT');
$this->addSql('ALTER TABLE node ALTER created_at DROP DEFAULT');
$this->addSql('ALTER TABLE link ALTER created_at DROP DEFAULT');
$this->addSql('ALTER TABLE media ALTER created_at DROP DEFAULT');
}
}