# HG changeset patch # User ymh # Date 1323409429 -3600 # Node ID b36a42d260d8ccf19ce90e7699636e9daefe98e2 # Parent 84ce711288cab185a7226c2e68625079367040bf add creation timestamp on document tag and document tag diff -r 84ce711288ca -r b36a42d260d8 .hgsubstate --- a/.hgsubstate Fri Dec 09 04:53:56 2011 +0100 +++ b/.hgsubstate Fri Dec 09 06:43:49 2011 +0100 @@ -1,1 +1,1 @@ -1bc0ec8ed05b5c1d72ef15eac1fc08044db7679c vendor/bundles/IRI/Bundle/WikiTagBundle +10be6b9e55e760b9f2dc4179990a098169612002 vendor/bundles/IRI/Bundle/WikiTagBundle diff -r 84ce711288ca -r b36a42d260d8 app/DoctrineMigrations/Version20111209060357.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/DoctrineMigrations/Version20111209060357.php Fri Dec 09 06:43:49 2011 +0100 @@ -0,0 +1,41 @@ +abortIf($this->connection->getDatabasePlatform()->getName() != "mysql"); + + $this->addSql("ALTER TABLE wikitag_document ADD createdAt DATETIME NULL"); + $this->addSql("ALTER TABLE wikitag_document_tag ADD createdAt DATETIME NULL"); + $this->addSql("ALTER TABLE wikitag_tag ADD createdAt DATETIME NULL"); + + $this->addSql("UPDATE wikitag_document SET createdAt = UTC_TIMESTAMP()"); + $this->addSql("UPDATE wikitag_document_tag SET createdAt = UTC_TIMESTAMP()"); + $this->addSql("UPDATE wikitag_tag SET createdAt = UTC_TIMESTAMP()"); + + $this->addSql("ALTER TABLE wikitag_document MODIFY createdAt DATETIME NOT NULL"); + $this->addSql("ALTER TABLE wikitag_document_tag MODIFY createdAt DATETIME NOT NULL"); + $this->addSql("ALTER TABLE wikitag_tag MODIFY createdAt DATETIME NOT NULL"); + + } + + public function down(Schema $schema) + { + // this down() migration is autogenerated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql"); + + $this->addSql("ALTER TABLE wikitag_document DROP createdAt"); + $this->addSql("ALTER TABLE wikitag_document_tag DROP createdAt"); + $this->addSql("ALTER TABLE wikitag_tag DROP createdAt"); + } +}