app/DoctrineMigrations/Version20111209060357.php
changeset 58 624e5900f5a4
parent 57 b36a42d260d8
child 71 b01e36991488
equal deleted inserted replaced
57:b36a42d260d8 58:624e5900f5a4
    13     public function up(Schema $schema)
    13     public function up(Schema $schema)
    14     {
    14     {
    15         // this up() migration is autogenerated, please modify it to your needs
    15         // this up() migration is autogenerated, please modify it to your needs
    16         $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");
    16         $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");
    17         
    17         
    18         $this->addSql("ALTER TABLE wikitag_document ADD createdAt DATETIME NULL");
    18         $this->addSql("ALTER TABLE wikitag_document ADD created_at DATETIME NULL");
    19         $this->addSql("ALTER TABLE wikitag_document_tag ADD createdAt DATETIME NULL");
    19         $this->addSql("ALTER TABLE wikitag_document_tag ADD created_at DATETIME NULL");
    20         $this->addSql("ALTER TABLE wikitag_tag ADD createdAt DATETIME NULL");
    20         $this->addSql("ALTER TABLE wikitag_tag ADD created_at DATETIME NULL");
    21         
    21         
    22         $this->addSql("UPDATE wikitag_document SET createdAt = UTC_TIMESTAMP()");
    22         $this->addSql("UPDATE wikitag_document SET created_at = UTC_TIMESTAMP()");
    23         $this->addSql("UPDATE wikitag_document_tag SET createdAt = UTC_TIMESTAMP()");
    23         $this->addSql("UPDATE wikitag_document_tag SET created_at = UTC_TIMESTAMP()");
    24         $this->addSql("UPDATE wikitag_tag SET createdAt = UTC_TIMESTAMP()");
    24         $this->addSql("UPDATE wikitag_tag SET created_at = UTC_TIMESTAMP()");
    25         
    25         
    26         $this->addSql("ALTER TABLE wikitag_document MODIFY createdAt DATETIME NOT NULL");
    26         $this->addSql("ALTER TABLE wikitag_document MODIFY created_at DATETIME NOT NULL");
    27         $this->addSql("ALTER TABLE wikitag_document_tag MODIFY createdAt DATETIME NOT NULL");
    27         $this->addSql("ALTER TABLE wikitag_document_tag MODIFY created_at DATETIME NOT NULL");
    28         $this->addSql("ALTER TABLE wikitag_tag MODIFY createdAt DATETIME NOT NULL");
    28         $this->addSql("ALTER TABLE wikitag_tag MODIFY created_at DATETIME NOT NULL");
    29         
    29         
    30     }
    30     }
    31 
    31 
    32     public function down(Schema $schema)
    32     public function down(Schema $schema)
    33     {
    33     {
    34         // this down() migration is autogenerated, please modify it to your needs
    34         // this down() migration is autogenerated, please modify it to your needs
    35         $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");
    35         $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");
    36         
    36         
    37         $this->addSql("ALTER TABLE wikitag_document DROP createdAt");
    37         $this->addSql("ALTER TABLE wikitag_document DROP created_at");
    38         $this->addSql("ALTER TABLE wikitag_document_tag DROP createdAt");
    38         $this->addSql("ALTER TABLE wikitag_document_tag DROP created_at");
    39         $this->addSql("ALTER TABLE wikitag_tag DROP createdAt");
    39         $this->addSql("ALTER TABLE wikitag_tag DROP created_at");
    40     }
    40     }
    41 }
    41 }