User updatedAt migration.

This commit is contained in:
Alexey Skobkin 2016-03-24 00:29:57 +03:00
parent 892f24fb16
commit 626a823233
2 changed files with 35 additions and 1 deletions

View file

@ -0,0 +1,34 @@
<?php
namespace Application\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
/**
* Auto-generated Migration: Please modify to your needs!
*/
class Version20160324002719 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
// 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 users.users ADD updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
// 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('ALTER TABLE users.users DROP updated_at');
}
}

View file

@ -46,7 +46,7 @@ class User
/** /**
* @var \DateTime * @var \DateTime
* *
* @ORM\Column(name="updated_at", type="datetime") * @ORM\Column(name="updated_at", type="datetime", nullable=true)
*/ */
private $updatedAt; private $updatedAt;