63 $this->_platform = $this->_conn->getDatabasePlatform();
90 $args = func_get_args();
93 $args = array_values($args);
96 return call_user_func_array(array($this, $method), $args);
97 }
catch (\Exception $e) {
109 $sql = $this->_platform->getListDatabasesSQL();
111 $databases = $this->_conn->fetchAll($sql);
123 if (is_null($database)) {
124 $database = $this->_conn->getDatabase();
126 $sql = $this->_platform->getListSequencesSQL($database);
128 $sequences = $this->_conn->fetchAll($sql);
148 $sql = $this->_platform->getListTableColumnsSQL($table);
150 $tableColumns = $this->_conn->fetchAll($sql);
165 $sql = $this->_platform->getListTableIndexesSQL($table);
167 $tableIndexes = $this->_conn->fetchAll($sql);
180 $tableNames = array_map(
'strtolower', (array)$tableNames);
181 return count($tableNames) == count(\array_intersect($tableNames, array_map(
'strtolower', $this->
listTableNames())));
192 $sql = $this->_platform->getListTablesSQL();
194 $tables = $this->_conn->fetchAll($sql);
209 foreach ($tableNames AS $tableName) {
223 $foreignKeys = array();
224 if ($this->_platform->supportsForeignKeyConstraints()) {
229 return new Table($tableName, $columns, $indexes, $foreignKeys,
false, array());
239 $database = $this->_conn->getDatabase();
240 $sql = $this->_platform->getListViewsSQL($database);
241 $views = $this->_conn->fetchAll($sql);
254 if (is_null($database)) {
255 $database = $this->_conn->getDatabase();
257 $sql = $this->_platform->getListTableForeignKeysSQL($table, $database);
258 $tableForeignKeys = $this->_conn->fetchAll($sql);
274 $this->
_execSql($this->_platform->getDropDatabaseSQL($database));
284 $this->
_execSql($this->_platform->getDropTableSQL($table));
295 if($index instanceof
Index) {
296 $index = $index->getQuotedName($this->_platform);
299 $this->
_execSql($this->_platform->getDropIndexSQL($index, $table));
310 $this->
_execSql($this->_platform->getDropConstraintSQL($constraint, $table));
322 $this->
_execSql($this->_platform->getDropForeignKeySQL($foreignKey, $table));
332 $this->
_execSql($this->_platform->getDropSequenceSQL($name));
343 $this->
_execSql($this->_platform->getDropViewSQL($name));
355 $this->
_execSql($this->_platform->getCreateDatabaseSQL($database));
366 $createFlags = AbstractPlatform::CREATE_INDEXES|AbstractPlatform::CREATE_FOREIGNKEYS;
367 $this->
_execSql($this->_platform->getCreateTableSQL($table, $createFlags));
378 $this->
_execSql($this->_platform->getCreateSequenceSQL($sequence));
389 $this->
_execSql($this->_platform->getCreateConstraintSQL($constraint, $table));
400 $this->
_execSql($this->_platform->getCreateIndexSQL($index, $table));
411 $this->
_execSql($this->_platform->getCreateForeignKeySQL($foreignKey, $table));
436 $this->
tryMethod(
'dropConstraint', $constraint, $table);
460 $this->
tryMethod(
'dropForeignKey', $foreignKey, $table);
472 $this->
tryMethod(
'createSequence', $seqName, $start, $allocationSize);
494 $this->
tryMethod(
'dropDatabase', $database);
518 $queries = $this->_platform->getAlterTableSQL($tableDiff);
519 if (is_array($queries) && count($queries)) {
520 foreach ($queries AS $ddlQuery) {
535 $tableDiff->newName = $newName;
547 foreach ($databases as $key => $value) {
563 foreach ($functions as $key => $value) {
579 foreach ($triggers as $key => $value) {
595 foreach ($sequences as $key => $value) {
623 foreach ($tableColumns as $key => $column) {
625 $name = strtolower($column->getQuotedName($this->_platform));
626 $list[$name] = $column;
650 foreach($tableIndexRows AS $tableIndex) {
651 $indexName = $keyName = $tableIndex[
'key_name'];
652 if($tableIndex[
'primary']) {
653 $keyName =
'primary';
655 $keyName = strtolower($keyName);
657 if(!isset($result[$keyName])) {
658 $result[$keyName] = array(
659 'name' => $indexName,
660 'columns' => array($tableIndex[
'column_name']),
661 'unique' => $tableIndex[
'non_unique'] ?
false :
true,
662 'primary' => $tableIndex[
'primary'],
665 $result[$keyName][
'columns'][] = $tableIndex[
'column_name'];
670 foreach($result AS $indexKey => $data) {
671 $indexes[$indexKey] =
new Index($data[
'name'], $data[
'columns'], $data[
'unique'], $data[
'primary']);
680 foreach ($tables as $key => $value) {
696 foreach ($users as $key => $value) {
712 foreach ($views as $key => $value) {
714 $viewName = strtolower($view->getQuotedName($this->_platform));
715 $list[$viewName] = $view;
729 foreach ($tableForeignKeys as $key => $value) {
739 return $tableForeignKey;
744 foreach ((array) $sql as $query) {
745 $this->_conn->executeUpdate($query);
756 $sequences = array();
757 if($this->_platform->supportsSequences()) {
773 $schemaConfig->setMaxIdentifierLength($this->_platform->getMaxIdentifierLength());
775 return $schemaConfig;
static notSupported($method)
getQuotedName(AbstractPlatform $platform)
__construct(\Doctrine\DBAL\Connection $conn)
dropForeignKey($foreignKey, $table)
_getPortableUsersList($users)
createIndex(Index $index, $table)
_getPortableTableIndexesList($tableIndexRows, $tableName=null)
_getPortableTableDefinition($table)
dropAndCreateConstraint(Constraint $constraint, $table)
dropIndex($index, $table)
_getPortableFunctionsList($functions)
_getPortableUserDefinition($user)
dropAndCreateView(View $view)
createSequence($sequence)
dropAndCreateForeignKey(ForeignKeyConstraint $foreignKey, $table)
_getPortableViewDefinition($view)
createConstraint(Constraint $constraint, $table)
alterTable(TableDiff $tableDiff)
_getPortableTriggersList($triggers)
_getPortableTableForeignKeyDefinition($tableForeignKey)
renameTable($name, $newName)
_getPortableDatabasesList($databases)
listTableForeignKeys($table, $database=null)
createTable(Table $table)
dropAndCreateIndex(Index $index, $table)
dropConstraint(Constraint $constraint, $table)
createDatabase($database)
dropAndCreateTable(Table $table)
_getPortableTablesList($tables)
_getPortableDatabaseDefinition($database)
_getPortableFunctionDefinition($function)
dropAndCreateSequence(Sequence $sequence)
_getPortableSequenceDefinition($sequence)
_getPortableTableColumnList($tableColumns)
_getPortableSequencesList($sequences)
_getPortableViewsList($views)
listTableDetails($tableName)
dropAndCreateDatabase($database)
createForeignKey(ForeignKeyConstraint $foreignKey, $table)
_getPortableTableColumnDefinition($tableColumn)
listSequences($database=null)
_getPortableTriggerDefinition($trigger)
_getPortableTableForeignKeysList($tableForeignKeys)