Covivo/mobicoop

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

Summary

Maintainability
A
1 hr
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 Version20230322112649 extends AbstractMigration
{
    public function up(Schema $schema): void
    {
        // this up() migration is auto-generated, please modify it to your needs
        $this->abortIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.');

        $this->addSql('UPDATE ask SET ask.type = 2 WHERE ask.ask_linked_id IS NOT NULL AND ask.type=3 AND ask.id < ask.ask_linked_id');
        $this->addSql('UPDATE ask SET ask.type = 3 WHERE ask.ask_linked_id IS NOT NULL AND ask.type=2 AND ask.id > ask.ask_linked_id');
    }

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