| @@ 178-195 (lines=18) @@ | ||
| 175 | ||
| 176 | // Add the default primary key | |
| 177 | $columns = $table->getPendingColumns(); | |
| 178 |         if (!isset($options['id']) || (isset($options['id']) && $options['id'] === true)) { | |
| 179 | $column = new Column(); | |
| 180 |             $column->setName('id') | |
| 181 |                    ->setType('integer') | |
| 182 | ->setIdentity(true); | |
| 183 | ||
| 184 | array_unshift($columns, $column); | |
| 185 | $options['primary_key'] = 'id'; | |
| 186 |         } elseif (isset($options['id']) && is_string($options['id'])) { | |
| 187 | // Handle id => "field_name" to support AUTO_INCREMENT | |
| 188 | $column = new Column(); | |
| 189 | $column->setName($options['id']) | |
| 190 |                    ->setType('integer') | |
| 191 | ->setIdentity(true); | |
| 192 | ||
| 193 | array_unshift($columns, $column); | |
| 194 | $options['primary_key'] = $options['id']; | |
| 195 | } | |
| 196 | ||
| 197 | // TODO - process table options like collation etc | |
| 198 | $sql = 'CREATE TABLE '; | |
| @@ 213-230 (lines=18) @@ | ||
| 210 | ||
| 211 | // Add the default primary key | |
| 212 | $columns = $table->getPendingColumns(); | |
| 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()) . ' ('; | |