Example #1
0
 public function alterTable()
 {
     $empresa = $this->estrutura[EstruturaQuery::COMPANY];
     $schema = $this->estrutura[EstruturaQuery::SCHEMA];
     $sequence = $this->estrutura[EstruturaQuery::SEQUENCE];
     //$user = $this->estrutura[EstruturaQuery::USER];
     $fase = FaseQuery::ALTER;
     $tabelas = $this->intersect_homolog_devQuery();
     $colunas = array();
     $stringResult = "\n\n\n------------------------------ ALTER TABLE ------------------------------";
     $string = "";
     if (!empty($tabelas)) {
         foreach ($tabelas as $tabela) {
             $colunaBO = new ColunaBO($empresa, $schema, $tabela, $sequence, $fase);
             $string .= $colunaBO->dropColumn();
             $string .= $colunaBO->addColumn();
             $string .= $colunaBO->alterColumn();
             $indiceBO = new IndiceBO($empresa, $schema, $tabela);
             $string .= $indiceBO->dropIndice();
             $string .= $indiceBO->createIndex();
             $constraintBO = new ConstraintBO($empresa, $schema, $tabela, $fase);
             $string .= $constraintBO->dropConstraint();
             $string .= $constraintBO->addConstraint();
             $triggerBO = new TriggerBO($empresa, $schema, $tabela);
             $string .= $triggerBO->dropTrigger();
             $string .= $triggerBO->createTrigger();
             $stringResult .= GerenciadorSequence::getQueryCriado() . $string . GerenciadorSequence::getQuerySetado();
             $string = "";
         }
         return $stringResult . $string;
     }
 }
Example #2
0
} elseif (isset($_GET['empresa'])) {
    $dbCompany = $_GET['empresa'];
    if (isset($_GET['connection'])) {
        $connection = $_GET['connection'];
    }
    $cmd = false;
} else {
    $dbCompany = "test";
    $cmd = false;
}
$saida = new Saida($dbCompany, $cmd, $connection);
$schema = new SchemaBO();
$sequence = new SequenceBO();
$funcao = new FuncaoBO();
$tabela = new TabelaBO();
$trigger = new TriggerBO();
$indice = new IndiceBO();
$coluna = new ColunaBO();
$constraint = new ConstraintBO();
/*
AssemblerBO::devTree();
AssemblerBO::homologTree();

$saida->gravar($schema->listar());
$saida->gravar($sequence->listar());
$saida->gravar($funcao->listar());
$saida->gravar($tabela->listar());
$saida->gravar($trigger->listar());
$saida->gravar($indice->listar());
$saida->gravar($coluna->listar());
$saida->gravar($constraint->listar());