예제 #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;
     }
 }
예제 #2
0
파일: index.php 프로젝트: rtakauti/Galileu
foreach ($schemasArray as $schemaNome) {
    $saida->gravar($schema->setSchema($schemaNome));
    $tabela = new TabelaBO($empresa, $schemaNome);
    $saida->gravar($tabela->dropTableHomolog());
    $saida->gravar($tabela->createTableHomolog());
    $saida->gravar($tabela->alterTableDropColumnHomolog());
    $saida->gravar($tabela->alterTableAddColumnHomolog());
    $saida->gravar($tabela->alterTableAlterColumnHomolog());
    $tabelasArray = $tabela->arrayTabelas();
    echo "<pre>";
    print_r($tabelasArray);
    // print_r($schema->arrayHomolog());
    echo "</pre>";
    if (isset($tabelasArray)) {
        foreach ($tabelasArray as $tabelaNome) {
            $constraint = new ConstraintBO($empresa, $tabelaNome);
            $saida->gravar($constraint->dropConstraintHomolog());
            echo "<pre>";
            echo "<H1>DIFF</H1>";
            print_r($constraint->dropConstraintHomolog());
            echo "<H1>HOMOLOG</H1>";
            print_r($constraint->arrayHomolog());
            echo "<H1>DEV</H1>";
            print_r($constraint->arrayDev());
            echo "</pre>";
        }
    }
    echo "<pre>";
    //print_r($tabela->alterTableAlterColumnHomolog ());
    // print_r($schema->arrayHomolog());
    echo "</pre>";
예제 #3
0
파일: index.php 프로젝트: rtakauti/Galileu
        $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());
*/
$saida->gravar($schema->drop());
$saida->gravar($sequence->drop());