kekrozsak/app/DoctrineMigrations/Version20120901231931.php

31 lines
959 B
PHP
Raw Normal View History

<?php
namespace Application\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration,
Doctrine\DBAL\Schema\Schema;
/**
* Auto-generated Migration: Please modify to your need!
*/
class Version20120901231931 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 news ADD slug VARCHAR(100) NOT NULL");
$this->addSql("UPDATE news SET slug = title");
$this->addSql("CREATE UNIQUE INDEX UNIQ_1DD39950989D9B62 ON news (slug)");
}
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 news DROP slug");
}
}