[2.0] DDC-312 - Prepared View and Trigger support in DBAL\Schema
This commit is contained in:
parent
22edbcec33
commit
962ecab75e
@ -806,7 +806,7 @@ abstract class AbstractSchemaManager
|
|||||||
}
|
}
|
||||||
$tables = $this->listTables();
|
$tables = $this->listTables();
|
||||||
|
|
||||||
return new Schema($tables, $sequences, $this->createSchemaConfig());
|
return new Schema($tables, $sequences, array(), array(), $this->createSchemaConfig());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -54,9 +54,11 @@ class Schema extends AbstractAsset
|
|||||||
/**
|
/**
|
||||||
* @param array $tables
|
* @param array $tables
|
||||||
* @param array $sequences
|
* @param array $sequences
|
||||||
|
* @param array $views
|
||||||
|
* @param array $triggers
|
||||||
* @param SchemaConfig $schemaConfig
|
* @param SchemaConfig $schemaConfig
|
||||||
*/
|
*/
|
||||||
public function __construct(array $tables=array(), array $sequences=array(), SchemaConfig $schemaConfig=null)
|
public function __construct(array $tables=array(), array $sequences=array(), array $views = array(), array $triggers = array(), SchemaConfig $schemaConfig=null)
|
||||||
{
|
{
|
||||||
if ($schemaConfig == null) {
|
if ($schemaConfig == null) {
|
||||||
$schemaConfig = new SchemaConfig();
|
$schemaConfig = new SchemaConfig();
|
||||||
|
@ -114,7 +114,7 @@ class SchemaTool
|
|||||||
$metadataSchemaConfig->setMaxIdentifierLength(63);
|
$metadataSchemaConfig->setMaxIdentifierLength(63);
|
||||||
|
|
||||||
$sm = $this->_em->getConnection()->getSchemaManager();
|
$sm = $this->_em->getConnection()->getSchemaManager();
|
||||||
$schema = new \Doctrine\DBAL\Schema\Schema(array(), array(), $metadataSchemaConfig);
|
$schema = new \Doctrine\DBAL\Schema\Schema(array(), array(), array(), array(), $metadataSchemaConfig);
|
||||||
|
|
||||||
foreach ($classes as $class) {
|
foreach ($classes as $class) {
|
||||||
if (isset($processedClasses[$class->name]) || $class->isMappedSuperclass) {
|
if (isset($processedClasses[$class->name]) || $class->isMappedSuperclass) {
|
||||||
|
@ -47,16 +47,6 @@ class OracleSchemaManagerTest extends SchemaManagerFunctionalTestCase
|
|||||||
$this->assertEquals(true, $found);
|
$this->assertEquals(true, $found);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testListViews()
|
|
||||||
{
|
|
||||||
$this->_sm->dropAndCreateView('test_create_view', 'SELECT * FROM sys.user_tables');
|
|
||||||
|
|
||||||
$views = $this->_sm->listViews();
|
|
||||||
$view = end($views);
|
|
||||||
|
|
||||||
$this->assertEquals('TEST_CREATE_VIEW', $view['name']);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testRenameTable()
|
public function testRenameTable()
|
||||||
{
|
{
|
||||||
$this->_sm->tryMethod('DropTable', 'list_tables_test');
|
$this->_sm->tryMethod('DropTable', 'list_tables_test');
|
||||||
|
@ -91,8 +91,8 @@ class ComparatorTest extends \PHPUnit_Framework_TestCase
|
|||||||
$table = new Table('bugdb', array ('integerfield1' => new Column('integerfield1', Type::getType('integer'))));
|
$table = new Table('bugdb', array ('integerfield1' => new Column('integerfield1', Type::getType('integer'))));
|
||||||
$table->setSchemaConfig($schemaConfig);
|
$table->setSchemaConfig($schemaConfig);
|
||||||
|
|
||||||
$schema1 = new Schema( array($table), array(), $schemaConfig );
|
$schema1 = new Schema( array($table), array(), array(), array(), $schemaConfig );
|
||||||
$schema2 = new Schema( array(), array(), $schemaConfig );
|
$schema2 = new Schema( array(), array(), array(), array(), $schemaConfig );
|
||||||
|
|
||||||
$expected = new SchemaDiff( array(), array(), array('bugdb' => $table) );
|
$expected = new SchemaDiff( array(), array(), array('bugdb' => $table) );
|
||||||
|
|
||||||
@ -105,8 +105,8 @@ class ComparatorTest extends \PHPUnit_Framework_TestCase
|
|||||||
$table = new Table('bugdb', array ('integerfield1' => new Column('integerfield1', Type::getType('integer'))));
|
$table = new Table('bugdb', array ('integerfield1' => new Column('integerfield1', Type::getType('integer'))));
|
||||||
$table->setSchemaConfig($schemaConfig);
|
$table->setSchemaConfig($schemaConfig);
|
||||||
|
|
||||||
$schema1 = new Schema( array(), array(), $schemaConfig );
|
$schema1 = new Schema( array(), array(), array(), array(), $schemaConfig );
|
||||||
$schema2 = new Schema( array($table), array(), $schemaConfig );
|
$schema2 = new Schema( array($table), array(), array(), array(), $schemaConfig );
|
||||||
|
|
||||||
$expected = new SchemaDiff( array('bugdb' => $table), array(), array() );
|
$expected = new SchemaDiff( array('bugdb' => $table), array(), array() );
|
||||||
$this->assertEquals($expected, Comparator::compareSchemas( $schema1, $schema2 ) );
|
$this->assertEquals($expected, Comparator::compareSchemas( $schema1, $schema2 ) );
|
||||||
|
@ -193,7 +193,7 @@ class SchemaTest extends \PHPUnit_Framework_TestCase
|
|||||||
$schemaConfig = new \Doctrine\DBAL\Schema\SchemaConfig();
|
$schemaConfig = new \Doctrine\DBAL\Schema\SchemaConfig();
|
||||||
$schemaConfig->setExplicitForeignKeyIndexes(false);
|
$schemaConfig->setExplicitForeignKeyIndexes(false);
|
||||||
|
|
||||||
$schema = new Schema(array(), array(), $schemaConfig);
|
$schema = new Schema(array(), array(), array(), array(), $schemaConfig);
|
||||||
$this->assertFalse($schema->hasExplicitForeignKeyIndexes());
|
$this->assertFalse($schema->hasExplicitForeignKeyIndexes());
|
||||||
|
|
||||||
$schemaConfig->setExplicitForeignKeyIndexes(true);
|
$schemaConfig->setExplicitForeignKeyIndexes(true);
|
||||||
@ -205,7 +205,7 @@ class SchemaTest extends \PHPUnit_Framework_TestCase
|
|||||||
$schemaConfig = new \Doctrine\DBAL\Schema\SchemaConfig();
|
$schemaConfig = new \Doctrine\DBAL\Schema\SchemaConfig();
|
||||||
$schemaConfig->setMaxIdentifierLength(10);
|
$schemaConfig->setMaxIdentifierLength(10);
|
||||||
|
|
||||||
$schema = new Schema(array(), array(), $schemaConfig);
|
$schema = new Schema(array(), array(), array(), array(), $schemaConfig);
|
||||||
$table = $schema->createTable("smalltable");
|
$table = $schema->createTable("smalltable");
|
||||||
$table->createColumn('long_id', 'integer');
|
$table->createColumn('long_id', 'integer');
|
||||||
$table->addIndex(array('long_id'));
|
$table->addIndex(array('long_id'));
|
||||||
|
Loading…
Reference in New Issue
Block a user