Covivo/mobicoop

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

Summary

Maintainability
C
7 hrs
Test Coverage
<?php declare(strict_types=1);

namespace DoctrineMigrations;

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

/**
 * Auto-generated Migration: Please modify to your needs!
 */
final class Version20230111152606 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 mobconnect__long_distance_subscription ADD initial_commitment_proof VARCHAR(255) NOT NULL COMMENT \'The autogenerated initial commintment proof\', ADD honour_certificate VARCHAR(255) NOT NULL COMMENT \'The autogenerated honour certificate\'');
        $this->addSql('ALTER TABLE mobconnect__short_distance_subscription ADD initial_commitment_proof VARCHAR(255) NOT NULL COMMENT \'The autogenerated initial commintment proof\', ADD honour_certificate VARCHAR(255) NOT NULL COMMENT \'The autogenerated honour certificate\'');
        $this->addSql('ALTER TABLE mobconnect__long_distance_journey ADD carpool_payment_id INT DEFAULT NULL, ADD bonus_status SMALLINT DEFAULT 1 NOT NULL COMMENT \'Bonus Status of the EEC form\'');
        $this->addSql('ALTER TABLE mobconnect__long_distance_journey ADD CONSTRAINT FK_894AD28F1212FDF6 FOREIGN KEY (carpool_payment_id) REFERENCES carpool_payment (id)');
        $this->addSql('CREATE UNIQUE INDEX UNIQ_894AD28F1212FDF6 ON mobconnect__long_distance_journey (carpool_payment_id)');
        $this->addSql('ALTER TABLE mobconnect__short_distance_journey ADD carpool_proof_id INT DEFAULT NULL, ADD bonus_status SMALLINT DEFAULT 1 NOT NULL COMMENT \'Bonus Status of the EEC form\'');
        $this->addSql('ALTER TABLE mobconnect__short_distance_journey ADD CONSTRAINT FK_68CFFDA6FBF2A5E5 FOREIGN KEY (carpool_proof_id) REFERENCES carpool_proof (id)');
        $this->addSql('CREATE UNIQUE INDEX UNIQ_68CFFDA6FBF2A5E5 ON mobconnect__short_distance_journey (carpool_proof_id)');
    }

    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 mobconnect__long_distance_journey DROP FOREIGN KEY FK_894AD28F1212FDF6');
        $this->addSql('DROP INDEX UNIQ_894AD28F1212FDF6 ON mobconnect__long_distance_journey');
        $this->addSql('ALTER TABLE mobconnect__long_distance_journey DROP carpool_payment_id, DROP bonus_status');
        $this->addSql('ALTER TABLE mobconnect__long_distance_subscription DROP initial_commitment_proof, DROP honour_certificate');
        $this->addSql('ALTER TABLE mobconnect__short_distance_journey DROP FOREIGN KEY FK_68CFFDA6FBF2A5E5');
        $this->addSql('DROP INDEX UNIQ_68CFFDA6FBF2A5E5 ON mobconnect__short_distance_journey');
        $this->addSql('ALTER TABLE mobconnect__short_distance_journey DROP carpool_proof_id, DROP bonus_status');
        $this->addSql('ALTER TABLE mobconnect__short_distance_subscription DROP initial_commitment_proof, DROP honour_certificate');
    }
}