/** * {@inheritDoc} */ protected function _getCreateTableSQL($tableName, array $columns, array $options = array()) { $indexes = array(); if (isset($options['indexes'])) { $indexes = $options['indexes']; } $options['indexes'] = array(); $sqls = parent::_getCreateTableSQL($tableName, $columns, $options); foreach ($indexes as $definition) { $sqls[] = $this->getCreateIndexSQL($definition, $tableName); } return $sqls; }
/** * * @param string $table * @param array $columns * @param array $options * @return array */ protected function _getCreateTableSQL($table, array $columns, array $options = array()) { $indexes = isset($options['indexes']) ? $options['indexes'] : array(); $options['indexes'] = array(); $sql = parent::_getCreateTableSQL($table, $columns, $options); foreach ($columns as $name => $column) { if (isset($column['sequence'])) { $sql[] = $this->getCreateSequenceSQL($column['sequence'], 1); } if (isset($column['autoincrement']) && $column['autoincrement'] || isset($column['autoinc']) && $column['autoinc']) { $sql = array_merge($sql, $this->getCreateAutoincrementSql($name, $table)); } } if (isset($indexes) && !empty($indexes)) { foreach ($indexes as $indexName => $index) { $sql[] = $this->getCreateIndexSQL($index, $table); } } return $sql; }
/** * {@inheritDoc} */ protected function _getCreateTableSQL($tableName, array $columns, array $options = array()) { /* * Informix creates an automatic index in ascending order for the * unique, primary-key and referencial constraints. If you try to * create an specific index in the same column or columns that fits * with the automatic index the database server returns an error. When * the index exists before the creation of the constraint, if is * possible, it's shared and no error is return, so it's important * that the indexes are created before the foreign key constraints. */ $indexes = isset($options['indexes']) ? $options['indexes'] : array(); $options['indexes'] = array(); $foreignKeys = isset($options['foreignKeys']) ? $options['foreignKeys'] : array(); $options['foreignKeys'] = array(); $sqls = parent::_getCreateTableSQL($tableName, $columns, $options); foreach ($indexes as $definition) { $sqls[] = $this->getCreateIndexSQL($definition, $tableName); } foreach ($foreignKeys as $definition) { $sqls[] = $this->getCreateForeignKeySQL($definition, $tableName); } return $sqls; }