Code Duplication    Length = 31-32 lines in 2 locations

src/Traits/DatabaseSchemaMigrationTrait.php 2 locations

@@ 230-260 (lines=31) @@
227
     *
228
     * @throws DBALException
229
     */
230
    protected function createClientsScopesTable(Connection $connection, DatabaseSchemaInterface $schema): void
231
    {
232
        $manager = $connection->getSchemaManager();
233
234
        $table = new Table($schema->getClientsScopesTable());
235
        $table->addColumn($schema->getClientsScopesIdentityColumn(), Type::INTEGER)
236
            ->setNotnull(true)->setAutoincrement(true)->setUnsigned(true);
237
        $table->addColumn($schema->getClientsScopesClientIdentityColumn(), Type::STRING)->setNotnull(true);
238
        $table->addColumn($schema->getClientsScopesScopeIdentityColumn(), Type::STRING)->setNotnull(true);
239
        $table->setPrimaryKey([$schema->getClientsScopesIdentityColumn()]);
240
        $table->addUniqueIndex([
241
            $schema->getClientsScopesClientIdentityColumn(),
242
            $schema->getClientsScopesScopeIdentityColumn()
243
        ]);
244
245
        $table->addForeignKeyConstraint(
246
            $schema->getClientsTable(),
247
            [$schema->getClientsScopesClientIdentityColumn()],
248
            [$schema->getClientsIdentityColumn()],
249
            $this->getOnDeleteCascadeConstraint()
250
        );
251
252
        $table->addForeignKeyConstraint(
253
            $schema->getScopesTable(),
254
            [$schema->getClientsScopesScopeIdentityColumn()],
255
            [$schema->getScopesIdentityColumn()],
256
            $this->getOnDeleteCascadeConstraint()
257
        );
258
259
        $manager->dropAndCreateTable($table);
260
    }
261
262
    /**
263
     * @param Connection              $connection
@@ 270-301 (lines=32) @@
267
     *
268
     * @throws DBALException
269
     */
270
    protected function createTokensScopesTable(Connection $connection, DatabaseSchemaInterface $schema): void
271
    {
272
        $manager = $connection->getSchemaManager();
273
274
        $table = new Table($schema->getTokensScopesTable());
275
        $table->addColumn($schema->getTokensScopesIdentityColumn(), Type::INTEGER)
276
            ->setNotnull(true)->setAutoincrement(true)->setUnsigned(true);
277
        $table->addColumn($schema->getTokensScopesTokenIdentityColumn(), Type::INTEGER)->setNotnull(true)
278
            ->setUnsigned(true);
279
        $table->addColumn($schema->getTokensScopesScopeIdentityColumn(), Type::STRING)->setNotnull(true);
280
        $table->setPrimaryKey([$schema->getTokensScopesIdentityColumn()]);
281
        $table->addUniqueIndex([
282
            $schema->getTokensScopesTokenIdentityColumn(),
283
            $schema->getTokensScopesScopeIdentityColumn()
284
        ]);
285
286
        $table->addForeignKeyConstraint(
287
            $schema->getTokensTable(),
288
            [$schema->getTokensScopesTokenIdentityColumn()],
289
            [$schema->getTokensIdentityColumn()],
290
            $this->getOnDeleteCascadeConstraint()
291
        );
292
293
        $table->addForeignKeyConstraint(
294
            $schema->getScopesTable(),
295
            [$schema->getTokensScopesScopeIdentityColumn()],
296
            [$schema->getScopesIdentityColumn()],
297
            $this->getOnDeleteCascadeConstraint()
298
        );
299
300
        $manager->dropAndCreateTable($table);
301
    }
302
303
    /**
304
     * @return array