public function createColumn() { $sequence = $this->estrutura[EstruturaQuery::SEQUENCE]; $tabela = $this->estrutura[EstruturaQuery::TABELA]; $schema = $this->estrutura[EstruturaQuery::SCHEMA]; $empresa = $this->estrutura[EstruturaQuery::COMPANY]; $fase = FaseQuery::CREATE; $colunas = $this->diff_dev_homologQuery(); $string = ""; if (!empty($colunas)) { foreach ($colunas as $coluna) { $propriedade = new PropriedadeBO($empresa, $schema, $tabela, $coluna, $sequence, $fase); $string .= "\t" . $coluna . " " . $propriedade->createProperty() . ",\n"; } $string = substr($string, 0, -2); return $string; } return; }
public function alter() { $colunas = array_intersect(parent::$dev['colunas'], parent::$homolog['colunas']); $titulo = $valida = $string = $stringResult = ""; if (!empty($colunas)) { $propriedade = new PropriedadeBO(); foreach ($colunas as $colunaInput) { list(parent::$schema, parent::$tabela, parent::$coluna) = explode(".", $colunaInput); $path = parent::$schema . parent::$tabela; $propriedades = $propriedade->alter(); if ($propriedades != "") { if ($valida != $path) { $stringResult = "\n\n\n" . str_pad(" ALTER COLUMN ", 100, "-", STR_PAD_BOTH); $valida = $path; $titulo = "\n\n\n--TABELA: {$path}"; } } $string .= "{$titulo}{$propriedades}"; $titulo = ""; } } return $stringResult . $string; }
public function alterColumn() { $sequence = $this->estrutura[EstruturaQuery::SEQUENCE]; $tabela = $this->estrutura[EstruturaQuery::TABELA]; $schema = $this->estrutura[EstruturaQuery::SCHEMA]; $empresa = $this->estrutura[EstruturaQuery::COMPANY]; $fase = FaseQuery::ALTER; $devArray = $this->dao->propriedade(SchemaType::DEV); $homologArray = $this->dao->propriedade(SchemaType::HOMOLOG); $diffArray = array_intersect_key($devArray, $homologArray); $colunas = array(); foreach ($diffArray as $nomeColuna => $valor) { $colunas[$nomeColuna] = array_diff_assoc($devArray[$nomeColuna], $homologArray[$nomeColuna]); $input[$nomeColuna] = array_diff_assoc($homologArray[$nomeColuna], $devArray[$nomeColuna]); } $string = ""; if (!empty($colunas)) { foreach ($colunas as $nomeColuna => $coluna) { if (!empty($coluna)) { $string .= "\n\n---- CAMPO {$nomeColuna} TABELA {$tabela} ----"; $output = implode(', ', array_map(function ($v, $k) { return $k . " = " . (!isset($v) ? 'NULO' : $v); }, $input[$nomeColuna], array_keys($input[$nomeColuna]))); $string .= "\n---- ESTADO ANTERIOR {$output} ----"; $propriedade = new PropriedadeBO($empresa, $schema, $tabela, $nomeColuna, $sequence, $fase, $coluna); $string .= $propriedade->constructProperty() . "\n"; } } return $string; } }