From 626a82323326fa994c4fcf3cc9a3de221292170e Mon Sep 17 00:00:00 2001 From: Alexey Skobkin Date: Thu, 24 Mar 2016 00:29:57 +0300 Subject: [PATCH] User updatedAt migration. --- .../Version20160324002719.php | 34 +++++++++++++++++++ .../Bundle/PointToolsBundle/Entity/User.php | 2 +- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 app/DoctrineMigrations/Version20160324002719.php diff --git a/app/DoctrineMigrations/Version20160324002719.php b/app/DoctrineMigrations/Version20160324002719.php new file mode 100644 index 0000000..f0c638a --- /dev/null +++ b/app/DoctrineMigrations/Version20160324002719.php @@ -0,0 +1,34 @@ +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'); + } +} diff --git a/src/Skobkin/Bundle/PointToolsBundle/Entity/User.php b/src/Skobkin/Bundle/PointToolsBundle/Entity/User.php index cee5ed5..0860cd6 100644 --- a/src/Skobkin/Bundle/PointToolsBundle/Entity/User.php +++ b/src/Skobkin/Bundle/PointToolsBundle/Entity/User.php @@ -46,7 +46,7 @@ class User /** * @var \DateTime * - * @ORM\Column(name="updated_at", type="datetime") + * @ORM\Column(name="updated_at", type="datetime", nullable=true) */ private $updatedAt;