<?php
declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class TaskInc67211 extends AbstractMigration
{
    public function up(): void
    {
        $row = $this->fetchRow('SELECT id FROM seguro.propostas WHERE id = 1103337');
        if ($row['id']) {
            $builder = $this->getQueryBuilder();
            $builder->update('seguro.propostas_docusign')
                    ->set('id_envelope', '5482cc7e-8bac-84ae-83da-010b7f7c7813')
                    ->where(['id_proposta' => 1103337, 'id' => 98585])
                    ->execute();
            $builder = $this->getQueryBuilder();
            $builder->update('seguro.propostas_docusign')
                    ->set('id_envelope', 'dcb1f776-952a-83c7-82cf-ac0a43f1cf4e')
                    ->where(['id_proposta' => 1103337, 'id' => 98583])
                    ->execute();
        }
    }

    public function down(): void
    {
        $row = $this->fetchRow('SELECT id FROM seguro.propostas WHERE id = 1103337');
        if ($row['id']) {
            $builder = $this->getQueryBuilder();
            $builder->update('seguro.propostas_docusign')
                    ->set('id_envelope', '5482cc7e-8bac-84ae-83da-010b7f7c7813')
                    ->where(['id_proposta' => 1103337, 'id' => 98583])
                    ->execute();
            $builder = $this->getQueryBuilder();
            $builder->update('seguro.propostas_docusign')
                    ->set('id_envelope', 'dcb1f776-952a-83c7-82cf-ac0a43f1cf4e')
                    ->where(['id_proposta' => 1103337, 'id' => 98585])
                    ->execute();
        }
    }
}
