Code Duplication    Length = 18-18 lines in 2 locations

src/Phinx/Db/Adapter/SqlServerAdapter.php 1 location

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

src/Phinx/Db/Adapter/PostgresAdapter.php 1 location

@@ 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 ';