@@ 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()) . ' ('; |
@@ 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 '; |