app/DoctrineMigrations/Version20111209060357.php
author ymh <ymh.work@gmail.com>
Wed, 14 Dec 2011 23:28:58 +0100
changeset 58 624e5900f5a4
parent 57 b36a42d260d8
child 71 b01e36991488
permissions -rw-r--r--
add tests and fixtures

<?php

namespace Application\Migrations;

use Doctrine\DBAL\Migrations\AbstractMigration,
    Doctrine\DBAL\Schema\Schema;

/**
 * Auto-generated Migration: Please modify to your need!
 */
class Version20111209060357 extends AbstractMigration
{
    public function up(Schema $schema)
    {
        // this up() migration is autogenerated, please modify it to your needs
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");
        
        $this->addSql("ALTER TABLE wikitag_document ADD created_at DATETIME NULL");
        $this->addSql("ALTER TABLE wikitag_document_tag ADD created_at DATETIME NULL");
        $this->addSql("ALTER TABLE wikitag_tag ADD created_at DATETIME NULL");
        
        $this->addSql("UPDATE wikitag_document SET created_at = UTC_TIMESTAMP()");
        $this->addSql("UPDATE wikitag_document_tag SET created_at = UTC_TIMESTAMP()");
        $this->addSql("UPDATE wikitag_tag SET created_at = UTC_TIMESTAMP()");
        
        $this->addSql("ALTER TABLE wikitag_document MODIFY created_at DATETIME NOT NULL");
        $this->addSql("ALTER TABLE wikitag_document_tag MODIFY created_at DATETIME NOT NULL");
        $this->addSql("ALTER TABLE wikitag_tag MODIFY created_at 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 created_at");
        $this->addSql("ALTER TABLE wikitag_document_tag DROP created_at");
        $this->addSql("ALTER TABLE wikitag_tag DROP created_at");
    }
}