<?php

namespace src\Migrations;

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

        $query = "CREATE TABLE calendario (
            id INT AUTO_INCREMENT PRIMARY KEY,
            data DATE NOT NULL,
            nome_cliente VARCHAR(255) NOT NULL,
            contato VARCHAR(255) NOT NULL,
            proposta VARCHAR(255) NOT NULL,
            local VARCHAR(255) NOT NULL,
            tempo_trabalho VARCHAR(255) NOT NULL,
            estilo_trabalho VARCHAR(255) NOT NULL,
            participantes VARCHAR(255) NOT NULL,
            looks VARCHAR(255) NOT NULL
        )";

        $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 = "DROP TABLE calendario";

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

        $stmt->execute();
    }
}
