<?php
declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class TaskSr48730 extends AbstractMigration
{
    public function up(): void
    {
        $row = $this->fetchRow('SELECT id FROM seguro.propostas WHERE id = 953737');
        if ($row['id']) {
            $this->execute("SELECT manutencao.atualizar_status (953737,  8, 953737, NULL, FALSE, 1000111252546, NULL)");
            $this->execute("UPDATE seguro.propostas_status SET dt_criacao = '2024-09-12 14:20:00' WHERE id_proposta = 953737 AND id_usuario_criacao = 2068 AND id_status = 8");
        }
        $row = $this->fetchRow('SELECT id FROM seguro.propostas WHERE id = 956849');
        if ($row['id']) {
            $this->execute("SELECT manutencao.atualizar_status (956849,  8, 956849, NULL, FALSE, 1000111253265, NULL)");
            $this->execute("UPDATE seguro.propostas_status SET dt_criacao = '2024-09-19 14:30:00' WHERE id_proposta = 956849 AND id_usuario_criacao = 2068 AND id_status = 8");
        }
    }

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