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