<?php

namespace Application\Migrations;

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

/**
 * Auto-generated Migration: Please modify to your need!
 */
class Version20121126184553 extends AbstractMigration
{
    public function up(Schema $schema)
    {
        // this up() migration is autogenerated, please modify it to your needs
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != "postgresql");
        
        $this->addSql("CREATE TABLE content_press_edition (id INT NOT NULL, title VARCHAR(255) NOT NULL, slug VARCHAR(255) NOT NULL, PRIMARY KEY(id))");
        $this->addSql("ALTER TABLE content_press_archive ADD edition_id INT DEFAULT NULL");
        $this->addSql("ALTER TABLE content_press_archive ADD CONSTRAINT FK_176E9B0574281A5E FOREIGN KEY (edition_id) REFERENCES content_press_edition (id) NOT DEFERRABLE INITIALLY IMMEDIATE");
        $this->addSql("CREATE INDEX IDX_176E9B0574281A5E ON content_press_archive (edition_id)");
    }

    public function down(Schema $schema)
    {
        // this down() migration is autogenerated, please modify it to your needs
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != "postgresql");
        
        $this->addSql("ALTER TABLE content_press_archive DROP CONSTRAINT FK_176E9B0574281A5E");
        $this->addSql("DROP TABLE content_press_edition");
        $this->addSql("ALTER TABLE content_press_archive DROP edition_id");
    }
}

Add migration for paper arhives
Add migration for paper arhives
