<?php
declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class TaskInc63003 extends AbstractMigration
{
    public function up(): void
    {
        $row = $this->fetchRow('SELECT id FROM seguro.propostas WHERE id = 1065952');
        if ($row['id']) {
            $this->execute("SELECT manutencao.atualizar_status (1065952,   8, 1085967, NULL, FALSE)");
            $this->execute("UPDATE seguro.propostas_endosso SET fl_proposta_vigente =  TRUE WHERE id_proposta = 1085967;");
            $this->execute("UPDATE seguro.propostas_endosso SET fl_proposta_vigente = FALSE WHERE id_proposta = 1065952;");
        }
    }

    public function down(): void
    {
        $row = $this->fetchRow('SELECT id FROM seguro.propostas WHERE id = 1065952');
        if ($row['id']) {
            $this->execute("SELECT manutencao.atualizar_status (1065952, 213, 1085967, NULL, FALSE)");
        }
    }
}
