| @@ 181-198 (lines=18) @@ | ||
| 178 | ||
| 179 | // Add the default primary key | |
| 180 | $columns = $table->getPendingColumns(); | |
| 181 |         if (!isset($options['id']) || (isset($options['id']) && $options['id'] === true)) { | |
| 182 | $column = new Column(); | |
| 183 |             $column->setName('id') | |
| 184 |                    ->setType('integer') | |
| 185 | ->setIdentity(true); | |
| 186 | ||
| 187 | array_unshift($columns, $column); | |
| 188 | $options['primary_key'] = 'id'; | |
| 189 |         } elseif (isset($options['id']) && is_string($options['id'])) { | |
| 190 | // Handle id => "field_name" to support AUTO_INCREMENT | |
| 191 | $column = new Column(); | |
| 192 | $column->setName($options['id']) | |
| 193 |                    ->setType('integer') | |
| 194 | ->setIdentity(true); | |
| 195 | ||
| 196 | array_unshift($columns, $column); | |
| 197 | $options['primary_key'] = $options['id']; | |
| 198 | } | |
| 199 | ||
| 200 | // TODO - process table options like collation etc | |
| 201 | $sql = 'CREATE TABLE '; | |
| @@ 212-229 (lines=18) @@ | ||
| 209 | ||
| 210 | // Add the default primary key | |
| 211 | $columns = $table->getPendingColumns(); | |
| 212 |         if (!isset($options['id']) || (isset($options['id']) && $options['id'] === true)) { | |
| 213 | $column = new Column(); | |
| 214 |             $column->setName('id') | |
| 215 |                    ->setType('integer') | |
| 216 | ->setIdentity(true); | |
| 217 | ||
| 218 | array_unshift($columns, $column); | |
| 219 | $options['primary_key'] = 'id'; | |
| 220 |         } elseif (isset($options['id']) && is_string($options['id'])) { | |
| 221 | // Handle id => "field_name" to support AUTO_INCREMENT | |
| 222 | $column = new Column(); | |
| 223 | $column->setName($options['id']) | |
| 224 |                    ->setType('integer') | |
| 225 | ->setIdentity(true); | |
| 226 | ||
| 227 | array_unshift($columns, $column); | |
| 228 | $options['primary_key'] = $options['id']; | |
| 229 | } | |
| 230 | ||
| 231 | $sql = 'CREATE TABLE '; | |
| 232 |         $sql .= $this->quoteTableName($table->getName()) . ' ('; | |