<?php
declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class TaskSr59095 extends AbstractMigration
{
    public function up(): void
    {
        $row = $this->fetchRow('SELECT id FROM seguro.propostas WHERE id = 1029430');
        if ($row['id']) {
            $this->execute("SELECT manutencao.atualizar_status (1029430,  8, 1029430, NULL, NULL, 1001111016015, NULL)");
        }
        $row = $this->fetchRow('SELECT id FROM seguro.propostas WHERE id = 1033862');
        if ($row['id']) {
            $this->execute("SELECT manutencao.atualizar_status (1033862,  8, 1033862, NULL, NULL, 1001111016177, NULL)");
        }    
        $row = $this->fetchRow('SELECT id FROM seguro.propostas WHERE id = 1035189');
        if ($row['id']) {
            $this->execute("SELECT manutencao.atualizar_status (1035189,  8, 1035189, NULL, NULL, 1001111016694, NULL)");
        }
        $row = $this->fetchRow('SELECT id FROM seguro.propostas WHERE id = 1049035');
        if ($row['id']) {
            $this->execute("SELECT manutencao.atualizar_status (1049035,  8, 1049035, NULL, NULL, 1001111017039, NULL)");
        }
    }

    public function down(): void
    {
        $row = $this->fetchRow('SELECT id FROM seguro.propostas WHERE id = 1029430');
        if ($row['id']) {
            $this->execute("SELECT manutencao.atualizar_status (1029430, 62, 1029430, NULL, NULL, 1001111016015, NULL)");
            $this->execute("UPDATE seguro.propostas SET nr_apolice = NULL WHERE id = 1029430");
        }
        $row = $this->fetchRow('SELECT id FROM seguro.propostas WHERE id = 1033862');
        if ($row['id']) {
            $this->execute("SELECT manutencao.atualizar_status (1033862, 62, 1033862, NULL, NULL, 1001111016177, NULL)");
            $this->execute("UPDATE seguro.propostas SET nr_apolice = NULL WHERE id = 1033862");
        }    
        $row = $this->fetchRow('SELECT id FROM seguro.propostas WHERE id = 1035189');
        if ($row['id']) {
            $this->execute("SELECT manutencao.atualizar_status (1035189, 62, 1035189, NULL, NULL, 1001111016694, NULL)");
            $this->execute("UPDATE seguro.propostas SET nr_apolice = NULL WHERE id = 1035189");
        }
        $row = $this->fetchRow('SELECT id FROM seguro.propostas WHERE id = 1049035');
        if ($row['id']) {
            $this->execute("SELECT manutencao.atualizar_status (1049035, 62, 1049035, NULL, NULL, 1001111017039, NULL)");
            $this->execute("UPDATE seguro.propostas SET nr_apolice = NULL WHERE id = 1049035");
        }
    }
}
