<?php
declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class Task2201281511 extends AbstractMigration
{
    public function up(): void
    {
        $row = $this->fetchRow('SELECT id FROM sinistro.avisos_final_replantio WHERE id_proposta = 721681;');
        if ($row['id']) {
            $this->execute("update sinistro.avisos_final_replantio set id_proposta = 721681 where id_proposta = 602428;");
        }
        $row = $this->fetchRow('SELECT id FROM sinistro.avisos_final_replantio WHERE id_proposta = 718867;');
        if ($row['id']) {
            $this->execute("update sinistro.avisos_final_replantio set id_proposta = 718867 where id_proposta = 611077;");
        }
        $row = $this->fetchRow('SELECT id FROM sinistro.avisos_final_replantio WHERE id_proposta = 723704;');
        if ($row['id']) {
            $this->execute("update sinistro.avisos_final_replantio set id_proposta = 723704 where id_proposta = 696131 and id = 809;");
        }
        $row = $this->fetchRow('SELECT id FROM sinistro.avisos_final_replantio WHERE id_proposta = 719590;');
        if ($row['id']) {
            $this->execute("update sinistro.avisos_final_replantio set id_proposta = 719590 where id_proposta = 557927 and id = 688;");
        }
        $row = $this->fetchRow('SELECT id FROM sinistro.avisos_final_replantio WHERE id_proposta = 719187;');
        if ($row['id']) {
            $this->execute("update sinistro.avisos_final_replantio set id_proposta = 719187 where id_proposta = 561200 and id = 684;");
        }
        $row = $this->fetchRow('SELECT id FROM sinistro.avisos_final_replantio WHERE id_proposta = 719834;');
        if ($row['id']) {
            $this->execute("update sinistro.avisos_final_replantio set id_proposta = 719834 where id_proposta = 648558 and id = 782;");
        }
        $row = $this->fetchRow('SELECT id FROM sinistro.avisos_final_replantio WHERE id_proposta = 718887;');
        if ($row['id']) {
            $this->execute("update sinistro.avisos_final_replantio set id_proposta = 718887 where id_proposta = 696259 and id = 795;");
        }
        $row = $this->fetchRow('SELECT id FROM sinistro.avisos_final_replantio WHERE id_proposta = 719466;');
        if ($row['id']) {
            $this->execute("update sinistro.avisos_final_replantio set id_proposta = 719466 where id_proposta = 549336 and id = 625;");
        }
        $row = $this->fetchRow('SELECT id FROM sinistro.avisos_final_replantio WHERE id_proposta = 723696;');
        if ($row['id']) {
            $this->execute("update sinistro.avisos_final_replantio set id_proposta = 723696 where id_proposta = 694831 and id = 794;");
        }
        $row = $this->fetchRow('SELECT id FROM sinistro.avisos_final_replantio WHERE id_proposta = 716833;');
        if ($row['id']) {
            $this->execute("update sinistro.avisos_final_replantio set id_proposta = 716833 where id_proposta = 667735 and id = 793;");
        }
    }

    public function down(): void
    {
        $row = $this->fetchRow('SELECT id FROM sinistro.avisos_final_replantio WHERE id_proposta = 721681;');
        if ($row['id']) {
            $this->execute("update sinistro.avisos_final_replantio set id_proposta = 602428 where id_proposta = 721681;");
        }
        $row = $this->fetchRow('SELECT id FROM sinistro.avisos_final_replantio WHERE id_proposta = 718867;');
        if ($row['id']) {
            $this->execute("update sinistro.avisos_final_replantio set id_proposta = 611077 where id_proposta = 718867;");
        }
        $row = $this->fetchRow('SELECT id FROM sinistro.avisos_final_replantio WHERE id_proposta = 723704;');
        if ($row['id']) {
            $this->execute("update sinistro.avisos_final_replantio set id_proposta = 696131 where id_proposta = 723704 and id = 809;");
        }
        $row = $this->fetchRow('SELECT id FROM sinistro.avisos_final_replantio WHERE id_proposta = 719590;');
        if ($row['id']) {
            $this->execute("update sinistro.avisos_final_replantio set id_proposta = 557927 where id_proposta = 719590 and id = 688;");
        }
        $row = $this->fetchRow('SELECT id FROM sinistro.avisos_final_replantio WHERE id_proposta = 719187;');
        if ($row['id']) {
            $this->execute("update sinistro.avisos_final_replantio set id_proposta = 561200 where id_proposta = 719187 and id = 684;");
        }
        $row = $this->fetchRow('SELECT id FROM sinistro.avisos_final_replantio WHERE id_proposta = 719834;');
        if ($row['id']) {
            $this->execute("update sinistro.avisos_final_replantio set id_proposta = 648558 where id_proposta = 719834 and id = 782;");
        }
        $row = $this->fetchRow('SELECT id FROM sinistro.avisos_final_replantio WHERE id_proposta = 718887;');
        if ($row['id']) {
            $this->execute("update sinistro.avisos_final_replantio set id_proposta = 696259 where id_proposta = 718887 and id = 795;");
        }
        $row = $this->fetchRow('SELECT id FROM sinistro.avisos_final_replantio WHERE id_proposta = 719466;');
        if ($row['id']) {
            $this->execute("update sinistro.avisos_final_replantio set id_proposta = 549336 where id_proposta = 719466 and id = 625");
        }
        $row = $this->fetchRow('SELECT id FROM sinistro.avisos_final_replantio WHERE id_proposta = 723696;');
        if ($row['id']) {
            $this->execute("update sinistro.avisos_final_replantio set id_proposta = 694831 where id_proposta = 723696 and id = 794");
        }
        $row = $this->fetchRow('SELECT id FROM sinistro.avisos_final_replantio WHERE id_proposta = 716833;');
        if ($row['id']) {
            $this->execute("update sinistro.avisos_final_replantio set id_proposta = 667735 where id_proposta = 716833 and id = 793");
        }
    }
}
