<?php
declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

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

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

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

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

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

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