<?php
declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class TaskInc59961 extends AbstractMigration
{
    public function up(): void
    {
        $row = $this->fetchRow('SELECT id FROM seguro.propostas WHERE id = 1047285');
        if ($row['id']) {
            $this->execute("SELECT manutencao.atualizar_status(1047285,  8, 1047285, NULl, NULL, 1001111019297, NULL)");
            $this->execute("UPDATE seguro.propostas_status SET dt_criacao = '2025-10-14 16:00:00' WHERE id_proposta = 1047285 AND id_usuario_criacao = 2068 AND id_status = 8");
        }

        $row = $this->fetchRow('SELECT id FROM seguro.propostas WHERE id = 1047425');
        if ($row['id']) {
            $this->execute("SELECT manutencao.atualizar_status(1047425,  8, 1047425, NULl, NULL, 1001111019321, NULL)");
            $this->execute("UPDATE seguro.propostas_status SET dt_criacao = '2025-10-14 16:00:00' WHERE id_proposta = 1047425 AND id_usuario_criacao = 2068 AND id_status = 8");
        }

        $row = $this->fetchRow('SELECT id FROM seguro.propostas WHERE id = 1047198');
        if ($row['id']) {
            $this->execute("SELECT manutencao.atualizar_status(1047198,  8, 1047198, NULl, NULL, 1001111019324, NULL)");
            $this->execute("UPDATE seguro.propostas_status SET dt_criacao = '2025-10-14 16:00:00' WHERE id_proposta = 1047198 AND id_usuario_criacao = 2068 AND id_status = 8");
        }

        $row = $this->fetchRow('SELECT id FROM seguro.propostas WHERE id = 1047487');
        if ($row['id']) {
            $this->execute("SELECT manutencao.atualizar_status(1047487,  8, 1047487, NULl, NULL, 1001111019325, NULL)");
            $this->execute("UPDATE seguro.propostas_status SET dt_criacao = '2025-10-14 16:00:00' WHERE id_proposta = 1047487 AND id_usuario_criacao = 2068 AND id_status = 8");
        }

        $row = $this->fetchRow('SELECT id FROM seguro.propostas WHERE id = 1047495');
        if ($row['id']) {
            $this->execute("SELECT manutencao.atualizar_status(1047495,  8, 1047495, NULl, NULL, 1001111019327, NULL)");
            $this->execute("UPDATE seguro.propostas_status SET dt_criacao = '2025-10-14 16:00:00' WHERE id_proposta = 1047495 AND id_usuario_criacao = 2068 AND id_status = 8");
        }
    }

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

        $row = $this->fetchRow('SELECT id FROM seguro.propostas WHERE id = 1047425');
        if ($row['id']) {
            $this->execute("SELECT manutencao.atualizar_status(1047425, 62, 1047425, NULL, NULL, NULL, NULL)");
            $this->execute("UPDATE seguro.propostas SET nr_apolice = NULL WHERE id = 1047425");
        }

        $row = $this->fetchRow('SELECT id FROM seguro.propostas WHERE id = 1047198');
        if ($row['id']) {
            $this->execute("SELECT manutencao.atualizar_status(1047198, 62, 1047198, NULL, NULL, NULL, NULL)");
            $this->execute("UPDATE seguro.propostas SET nr_apolice = NULL WHERE id = 1047198");
        }

        $row = $this->fetchRow('SELECT id FROM seguro.propostas WHERE id = 1047487');
        if ($row['id']) {
            $this->execute("SELECT manutencao.atualizar_status(1047487, 62, 1047487, NULL, NULL, NULL, NULL)");
            $this->execute("UPDATE seguro.propostas SET nr_apolice = NULL WHERE id = 1047487");
        }

        $row = $this->fetchRow('SELECT id FROM seguro.propostas WHERE id = 1047495');
        if ($row['id']) {
            $this->execute("SELECT manutencao.atualizar_status(1047495, 62, 1047495, NULL, NULL, NULL, NULL)");
            $this->execute("UPDATE seguro.propostas SET nr_apolice = NULL WHERE id = 1047495");
        }
    }
}
