<?php

namespace Application\Migrations;

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

/**
 * Auto-generated Migration: Please modify to your needs!
 */
class Version20170808182934 extends AbstractMigration
{
    /**
     * @param Schema $schema
     */
    public function up(Schema $schema)
    {
        // this up() migration is auto-generated, please modify it to your needs
        $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');

        $this->addSql('ALTER TABLE operationpee ADD quote_author_id INT DEFAULT NULL');
        $this->addSql('ALTER TABLE operationpee ADD title TEXT DEFAULT NULL');
        $this->addSql('ALTER TABLE operationpee ADD presentation TEXT DEFAULT NULL');
        $this->addSql('ALTER TABLE operationpee ADD namely TEXT DEFAULT NULL');
        $this->addSql('ALTER TABLE operationpee ADD address TEXT DEFAULT NULL');
        $this->addSql('ALTER TABLE operationpee ADD zip_code TEXT DEFAULT NULL');
        $this->addSql('ALTER TABLE operationpee ADD quote_content TEXT DEFAULT NULL');
        $this->addSql('ALTER TABLE operationpee ADD CONSTRAINT FK_2299D2B671976A61 FOREIGN KEY (quote_author_id) REFERENCES fos_user (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
        $this->addSql('CREATE INDEX IDX_2299D2B671976A61 ON operationpee (quote_author_id)');
    }

    /**
     * @param Schema $schema
     */
    public function down(Schema $schema)
    {
        // this down() migration is auto-generated, please modify it to your needs
        $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');

        $this->addSql('ALTER TABLE OperationPEE DROP CONSTRAINT FK_2299D2B671976A61');
        $this->addSql('DROP INDEX IDX_2299D2B671976A61');
        $this->addSql('ALTER TABLE OperationPEE DROP quote_author_id');
        $this->addSql('ALTER TABLE OperationPEE DROP title');
        $this->addSql('ALTER TABLE OperationPEE DROP presentation');
        $this->addSql('ALTER TABLE OperationPEE DROP namely');
        $this->addSql('ALTER TABLE OperationPEE DROP address');
        $this->addSql('ALTER TABLE OperationPEE DROP zip_code');
        $this->addSql('ALTER TABLE OperationPEE DROP quote_content');
    }
}
