Covivo/mobicoop

View on GitHub
api/src/Migrations/Version20190429152547.php

Summary

Maintainability
A
2 hrs
Test Coverage
<?php declare(strict_types=1);

/**
 * Copyright (c) 2018, MOBICOOP. All rights reserved.
 * This project is dual licensed under AGPL and proprietary licence.
 ***************************
 *    This program is free software: you can redistribute it and/or modify
 *    it under the terms of the GNU Affero General Public License as
 *    published by the Free Software Foundation, either version 3 of the
 *    License, or (at your option) any later version.
 *
 *    This program is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU Affero General Public License for more details.
 *
 *    You should have received a copy of the GNU Affero General Public License
 *    along with this program.  If not, see <gnu.org/licenses>.
 ***************************
 *    Licence MOBICOOP described in the file
 *    LICENSE
 **************************/

namespace DoctrineMigrations;

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

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

        $this->addSql('ALTER TABLE mass_person ADD outward_time TIME DEFAULT NULL, ADD return_time TIME DEFAULT NULL');
        $this->addSql('ALTER TABLE address ADD house_number VARCHAR(45) DEFAULT NULL, ADD street VARCHAR(255) DEFAULT NULL, ADD sub_locality VARCHAR(100) DEFAULT NULL, ADD local_admin VARCHAR(100) DEFAULT NULL, ADD county VARCHAR(100) DEFAULT NULL, ADD macro_county VARCHAR(100) DEFAULT NULL, ADD region VARCHAR(100) DEFAULT NULL, ADD macro_region VARCHAR(100) DEFAULT NULL, ADD country_code VARCHAR(10) DEFAULT NULL');
    }

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

        $this->addSql('ALTER TABLE address DROP house_number, DROP street, DROP sub_locality, DROP local_admin, DROP county, DROP macro_county, DROP region, DROP macro_region, DROP country_code');
        $this->addSql('ALTER TABLE mass_person DROP outward_time, DROP return_time');
    }
}