| @@ 213-230 (lines=18) @@ | ||
| 210 | $options = $table->getOptions(); |
|
| 211 | ||
| 212 | // Add the default primary key |
|
| 213 | if (!isset($options['id']) || (isset($options['id']) && $options['id'] === true)) { |
|
| 214 | $column = new Column(); |
|
| 215 | $column->setName('id') |
|
| 216 | ->setType('integer') |
|
| 217 | ->setIdentity(true); |
|
| 218 | ||
| 219 | array_unshift($columns, $column); |
|
| 220 | $options['primary_key'] = 'id'; |
|
| 221 | } elseif (isset($options['id']) && is_string($options['id'])) { |
|
| 222 | // Handle id => "field_name" to support AUTO_INCREMENT |
|
| 223 | $column = new Column(); |
|
| 224 | $column->setName($options['id']) |
|
| 225 | ->setType('integer') |
|
| 226 | ->setIdentity(true); |
|
| 227 | ||
| 228 | array_unshift($columns, $column); |
|
| 229 | $options['primary_key'] = $options['id']; |
|
| 230 | } |
|
| 231 | ||
| 232 | $sql = 'CREATE TABLE '; |
|
| 233 | $sql .= $this->quoteTableName($table->getName()) . ' ('; |
|
| @@ 194-211 (lines=18) @@ | ||
| 191 | $parts = $this->getSchemaName($table->getName()); |
|
| 192 | ||
| 193 | // Add the default primary key |
|
| 194 | if (!isset($options['id']) || (isset($options['id']) && $options['id'] === true)) { |
|
| 195 | $column = new Column(); |
|
| 196 | $column->setName('id') |
|
| 197 | ->setType('integer') |
|
| 198 | ->setIdentity(true); |
|
| 199 | ||
| 200 | array_unshift($columns, $column); |
|
| 201 | $options['primary_key'] = 'id'; |
|
| 202 | } elseif (isset($options['id']) && is_string($options['id'])) { |
|
| 203 | // Handle id => "field_name" to support AUTO_INCREMENT |
|
| 204 | $column = new Column(); |
|
| 205 | $column->setName($options['id']) |
|
| 206 | ->setType('integer') |
|
| 207 | ->setIdentity(true); |
|
| 208 | ||
| 209 | array_unshift($columns, $column); |
|
| 210 | $options['primary_key'] = $options['id']; |
|
| 211 | } |
|
| 212 | ||
| 213 | // TODO - process table options like collation etc |
|
| 214 | $sql = 'CREATE TABLE '; |
|