/** * Gets the create table SQL queries. * The $flags parameters can contain: * - primary_key: TRUE if queries include primary key else FALSE (default: TRUE). * - index: TRUE if queries include indexes else FALSE (default: TRUE). * - foreign_key: TRUE if queries include foreingn keys else FALSE (default: TRUE). * - check: TRUE if queries include checks else FALSE (default: TRUE). * @param \UniversalDb\Common\Schema\Table $table The table. * @param array $flags The create table flags. * @return array The create table SQL queries. */ public function getCreateTableSQLQueries(Table $table, array $flags = []) : array { $queries = parent::getCreateTableSQLQueries($table, $flags); $queries[0] .= ' ENGINE = InnoDB'; return $queries; }
/** * Gets the create table SQL queries. * The $flags parameters can contain: * - primary_key: TRUE if queries include primary key else FALSE (default: TRUE). * - index: TRUE if queries include indexes else FALSE (default: TRUE). * - foreign_key: TRUE if queries include foreingn keys else FALSE (default: TRUE). * - check: TRUE if queries include checks else FALSE (default: TRUE). * @param \UniversalDb\Common\Schema\Table $table The table. * @param array $flags The create table flags. * @return array The create table SQL queries. */ public function getCreateTableSQLQueries(Table $table, array $flags = []) : array { $originalFlags = $flags; $flags['index'] = false; $queries = parent::getCreateTableSQLQueries($table, $flags); if (!isset($originalFlags['index']) || $originalFlags['index']) { foreach ($table->getFilteredIndexes() as $index) { $queries = array_merge($queries, $this->getCreateIndexSQLQueries($index, $table->getName())); } } return $queries; }