Code Duplication    Length = 31-32 lines in 2 locations

src/Traits/DatabaseSchemaMigrationTrait.php 2 locations

@@ 218-248 (lines=31) @@
215
     *
216
     * @return void
217
     */
218
    protected function createClientsScopesTable(Connection $connection, DatabaseSchemaInterface $schema): void
219
    {
220
        $manager = $connection->getSchemaManager();
221
222
        $table = new Table($schema->getClientsScopesTable());
223
        $table->addColumn($schema->getClientsScopesIdentityColumn(), Type::INTEGER)
224
            ->setNotnull(true)->setAutoincrement(true)->setUnsigned(true);
225
        $table->addColumn($schema->getClientsScopesClientIdentityColumn(), Type::STRING)->setNotnull(true);
226
        $table->addColumn($schema->getClientsScopesScopeIdentityColumn(), Type::STRING)->setNotnull(true);
227
        $table->setPrimaryKey([$schema->getClientsScopesIdentityColumn()]);
228
        $table->addUniqueIndex([
229
            $schema->getClientsScopesClientIdentityColumn(),
230
            $schema->getClientsScopesScopeIdentityColumn()
231
        ]);
232
233
        $table->addForeignKeyConstraint(
234
            $schema->getClientsTable(),
235
            [$schema->getClientsScopesClientIdentityColumn()],
236
            [$schema->getClientsIdentityColumn()],
237
            $this->getOnDeleteCascadeConstraint()
238
        );
239
240
        $table->addForeignKeyConstraint(
241
            $schema->getScopesTable(),
242
            [$schema->getClientsScopesScopeIdentityColumn()],
243
            [$schema->getScopesIdentityColumn()],
244
            $this->getOnDeleteCascadeConstraint()
245
        );
246
247
        $manager->dropAndCreateTable($table);
248
    }
249
250
    /**
251
     * @param Connection              $connection
@@ 256-287 (lines=32) @@
253
     *
254
     * @return void
255
     */
256
    protected function createTokensScopesTable(Connection $connection, DatabaseSchemaInterface $schema): void
257
    {
258
        $manager = $connection->getSchemaManager();
259
260
        $table = new Table($schema->getTokensScopesTable());
261
        $table->addColumn($schema->getTokensScopesIdentityColumn(), Type::INTEGER)
262
            ->setNotnull(true)->setAutoincrement(true)->setUnsigned(true);
263
        $table->addColumn($schema->getTokensScopesTokenIdentityColumn(), Type::INTEGER)->setNotnull(true)
264
            ->setUnsigned(true);
265
        $table->addColumn($schema->getTokensScopesScopeIdentityColumn(), Type::STRING)->setNotnull(true);
266
        $table->setPrimaryKey([$schema->getTokensScopesIdentityColumn()]);
267
        $table->addUniqueIndex([
268
            $schema->getTokensScopesTokenIdentityColumn(),
269
            $schema->getTokensScopesScopeIdentityColumn()
270
        ]);
271
272
        $table->addForeignKeyConstraint(
273
            $schema->getTokensTable(),
274
            [$schema->getTokensScopesTokenIdentityColumn()],
275
            [$schema->getTokensIdentityColumn()],
276
            $this->getOnDeleteCascadeConstraint()
277
        );
278
279
        $table->addForeignKeyConstraint(
280
            $schema->getScopesTable(),
281
            [$schema->getTokensScopesScopeIdentityColumn()],
282
            [$schema->getScopesIdentityColumn()],
283
            $this->getOnDeleteCascadeConstraint()
284
        );
285
286
        $manager->dropAndCreateTable($table);
287
    }
288
289
    /**
290
     * @return array