db = $db; $this->logger = $logger; } public function create(string $tableName, Closure $callback): void { $builder = new SchemaBuilder($tableName); $callback($builder); $sql = $builder->getSql(); try { $this->db->execute($sql); $this->logger->info("Tabela {$tableName} criada com sucesso", ['table' => $tableName]); } catch (\Exception $e) { $this->logger->error("Erro ao criar tabela {$tableName}", ['error' => $e->getMessage(), 'sql' => $sql]); throw $e; } } public function dropIfExists(string $tableName): void { $sql = "DROP TABLE IF EXISTS `{$tableName}`;"; try { $this->db->execute($sql); $this->logger->info("Tabela {$tableName} eliminada com sucesso", ['table' => $tableName]); } catch (\Exception $e) { $this->logger->error("Erro ao eliminar tabela {$tableName}", ['error' => $e->getMessage()]); throw $e; } } }