<?php

namespace src\Migrations;

class _002_inserirUsuario
{
    public function up()
    {
        $conexao = new \src\Conexao\Conexao();
        $conn = $conexao->getConexao();

        $query = "INSERT INTO usuario (nome, email, senha) VALUES ('Leandro', 'contato@modernahost.com.br', 'senha1')";
    
        $stmt = $conn->prepare($query);
        if (!$stmt) {
            echo "Erro ao preparar a consulta: " . $conn->error;
            return null;
        }

        $stmt->execute();
    }

    public function down()
    {
        $conexao = new \src\Conexao\Conexao();
        $conn = $conexao->getConexao();

        $query = "DELETE FROM usuario WHERE email = 'contato@modernahost.com.br'";

        $stmt = $conn->prepare($query);

        if (!$stmt) {
            echo "Erro ao preparar a consulta: " . $conn->error;
            return null;
        }

        $stmt->execute();
    }
}