Code Duplication    Length = 36-38 lines in 4 locations

apps/dav/lib/Migration/Version1004Date20170825134824.php 2 locations

@@ 372-408 (lines=37) @@
369
			$table->setPrimaryKey(['id']);
370
		}
371
372
		if (!$schema->hasTable('cards_properties')) {
373
			$table = $schema->createTable('cards_properties');
374
			$table->addColumn('id', 'bigint', [
375
				'autoincrement' => true,
376
				'notnull' => true,
377
				'length' => 11,
378
				'unsigned' => true,
379
			]);
380
			$table->addColumn('addressbookid', 'bigint', [
381
				'notnull' => true,
382
				'length' => 11,
383
				'default' => 0,
384
			]);
385
			$table->addColumn('cardid', 'bigint', [
386
				'notnull' => true,
387
				'length' => 11,
388
				'default' => 0,
389
				'unsigned' => true,
390
			]);
391
			$table->addColumn('name', 'string', [
392
				'notnull' => false,
393
				'length' => 64,
394
			]);
395
			$table->addColumn('value', 'string', [
396
				'notnull' => false,
397
				'length' => 255,
398
			]);
399
			$table->addColumn('preferred', 'integer', [
400
				'notnull' => true,
401
				'length' => 4,
402
				'default' => 1,
403
			]);
404
			$table->setPrimaryKey(['id']);
405
			$table->addIndex(['cardid'], 'card_contactid_index');
406
			$table->addIndex(['name'], 'card_name_index');
407
			$table->addIndex(['value'], 'card_value_index');
408
		}
409
410
		if (!$schema->hasTable('calendarobjects_props')) {
411
			$table = $schema->createTable('calendarobjects_props');
@@ 410-445 (lines=36) @@
407
			$table->addIndex(['value'], 'card_value_index');
408
		}
409
410
		if (!$schema->hasTable('calendarobjects_props')) {
411
			$table = $schema->createTable('calendarobjects_props');
412
			$table->addColumn('id', 'bigint', [
413
				'autoincrement' => true,
414
				'notnull' => true,
415
				'length' => 11,
416
				'unsigned' => true,
417
			]);
418
			$table->addColumn('calendarid', 'bigint', [
419
				'notnull' => true,
420
				'length' => 11,
421
				'default' => 0,
422
			]);
423
			$table->addColumn('objectid', 'bigint', [
424
				'notnull' => true,
425
				'length' => 11,
426
				'default' => 0,
427
				'unsigned' => true,
428
			]);
429
			$table->addColumn('name', 'string', [
430
				'notnull' => false,
431
				'length' => 64,
432
			]);
433
			$table->addColumn('parameter', 'string', [
434
				'notnull' => false,
435
				'length' => 64,
436
			]);
437
			$table->addColumn('value', 'string', [
438
				'notnull' => false,
439
				'length' => 255,
440
			]);
441
			$table->setPrimaryKey(['id']);
442
			$table->addIndex(['objectid'], 'calendarobject_index');
443
			$table->addIndex(['name'], 'calendarobject_name_index');
444
			$table->addIndex(['value'], 'calendarobject_value_index');
445
		}
446
447
		if (!$schema->hasTable('dav_shares')) {
448
			$table = $schema->createTable('dav_shares');

core/Migrations/Version13000Date20170718121200.php 2 locations

@@ 404-440 (lines=37) @@
401
			$table->addIndex(['token'], 'token_index');
402
		}
403
404
		if (!$schema->hasTable('jobs')) {
405
			$table = $schema->createTable('jobs');
406
			$table->addColumn('id', 'integer', [
407
				'autoincrement' => true,
408
				'notnull' => true,
409
				'length' => 4,
410
				'unsigned' => true,
411
			]);
412
			$table->addColumn('class', 'string', [
413
				'notnull' => true,
414
				'length' => 255,
415
				'default' => '',
416
			]);
417
			$table->addColumn('argument', 'string', [
418
				'notnull' => true,
419
				'length' => 4000,
420
				'default' => '',
421
			]);
422
			$table->addColumn('last_run', 'integer', [
423
				'notnull' => false,
424
				'default' => 0,
425
			]);
426
			$table->addColumn('last_checked', 'integer', [
427
				'notnull' => false,
428
				'default' => 0,
429
			]);
430
			$table->addColumn('reserved_at', 'integer', [
431
				'notnull' => false,
432
				'default' => 0,
433
			]);
434
			$table->addColumn('execution_duration', 'integer', [
435
				'notnull' => true,
436
				'default' => 0,
437
			]);
438
			$table->setPrimaryKey(['id']);
439
			$table->addIndex(['class'], 'job_class_index');
440
		}
441
442
		if (!$schema->hasTable('users')) {
443
			$table = $schema->createTable('users');
@@ 523-560 (lines=38) @@
520
			$table->addIndex(['last_activity'], 'authtoken_last_activity_index');
521
		}
522
523
		if (!$schema->hasTable('bruteforce_attempts')) {
524
			$table = $schema->createTable('bruteforce_attempts');
525
			$table->addColumn('id', 'integer', [
526
				'autoincrement' => true,
527
				'notnull' => true,
528
				'length' => 4,
529
				'unsigned' => true,
530
			]);
531
			$table->addColumn('action', 'string', [
532
				'notnull' => true,
533
				'length' => 64,
534
				'default' => '',
535
			]);
536
			$table->addColumn('occurred', 'integer', [
537
				'notnull' => true,
538
				'length' => 4,
539
				'default' => 0,
540
				'unsigned' => true,
541
			]);
542
			$table->addColumn('ip', 'string', [
543
				'notnull' => true,
544
				'length' => 255,
545
				'default' => '',
546
			]);
547
			$table->addColumn('subnet', 'string', [
548
				'notnull' => true,
549
				'length' => 255,
550
				'default' => '',
551
			]);
552
			$table->addColumn('metadata', 'string', [
553
				'notnull' => true,
554
				'length' => 255,
555
				'default' => '',
556
			]);
557
			$table->setPrimaryKey(['id']);
558
			$table->addIndex(['ip'], 'bruteforce_attempts_ip');
559
			$table->addIndex(['subnet'], 'bruteforce_attempts_subnet');
560
		}
561
562
		if (!$schema->hasTable('vcategory')) {
563
			$table = $schema->createTable('vcategory');