Code Duplication    Length = 23-25 lines in 4 locations

core/Migrations/Version13000Date20170718121200.php 4 locations

@@ 652-676 (lines=25) @@
649
			$table->setPrimaryKey(['gid', 'systemtagid']);
650
		}
651
652
		if (!$schema->hasTable('file_locks')) {
653
			$table = $schema->createTable('file_locks');
654
			$table->addColumn('id', 'integer', [
655
				'autoincrement' => true,
656
				'notnull' => true,
657
				'length' => 4,
658
			]);
659
			$table->addColumn('lock', 'integer', [
660
				'notnull' => true,
661
				'length' => 4,
662
				'default' => 0,
663
			]);
664
			$table->addColumn('key', 'string', [
665
				'notnull' => true,
666
				'length' => 64,
667
			]);
668
			$table->addColumn('ttl', 'integer', [
669
				'notnull' => true,
670
				'length' => 4,
671
				'default' => -1,
672
			]);
673
			$table->setPrimaryKey(['id']);
674
			$table->addUniqueIndex(['key'], 'lock_key_index');
675
			$table->addIndex(['ttl'], 'lock_ttl_index');
676
		}
677
678
		if (!$schema->hasTable('comments')) {
679
			$table = $schema->createTable('comments');
@@ 740-762 (lines=23) @@
737
			$table->addIndex(['actor_type', 'actor_id'], 'comments_actor_index');
738
		}
739
740
		if (!$schema->hasTable('comments_read_markers')) {
741
			$table = $schema->createTable('comments_read_markers');
742
			$table->addColumn('user_id', 'string', [
743
				'notnull' => true,
744
				'length' => 64,
745
				'default' => '',
746
			]);
747
			$table->addColumn('marker_datetime', 'datetime', [
748
				'notnull' => false,
749
			]);
750
			$table->addColumn('object_type', 'string', [
751
				'notnull' => true,
752
				'length' => 64,
753
				'default' => '',
754
			]);
755
			$table->addColumn('object_id', 'string', [
756
				'notnull' => true,
757
				'length' => 64,
758
				'default' => '',
759
			]);
760
			$table->addIndex(['object_type', 'object_id'], 'comments_marker_object_index');
761
			$table->addUniqueIndex(['user_id', 'object_type', 'object_id'], 'comments_marker_index');
762
		}
763
764
		if (!$schema->hasTable('credentials')) {
765
			$table = $schema->createTable('credentials');
@@ 801-825 (lines=25) @@
798
			$table->addUniqueIndex(['class'], 'admin_sections_class');
799
		}
800
801
		if (!$schema->hasTable('admin_settings')) {
802
			$table = $schema->createTable('admin_settings');
803
			$table->addColumn('id', 'integer', [
804
				'autoincrement' => true,
805
				'notnull' => true,
806
				'length' => 4,
807
			]);
808
			$table->addColumn('class', 'string', [
809
				'notnull' => true,
810
				'length' => 255,
811
				'default' => '',
812
			]);
813
			$table->addColumn('section', 'string', [
814
				'notnull' => false,
815
				'length' => 64,
816
			]);
817
			$table->addColumn('priority', 'smallint', [
818
				'notnull' => true,
819
				'length' => 1,
820
				'default' => 0,
821
			]);
822
			$table->setPrimaryKey(['id']);
823
			$table->addUniqueIndex(['class'], 'admin_settings_class');
824
			$table->addIndex(['section'], 'admin_settings_section');
825
		}
826
827
		if (!$schema->hasTable('personal_sections')) {
828
			$table = $schema->createTable('personal_sections');
@@ 847-871 (lines=25) @@
844
			$table->addUniqueIndex(['class'], 'personal_sections_class');
845
		}
846
847
		if (!$schema->hasTable('personal_settings')) {
848
			$table = $schema->createTable('personal_settings');
849
			$table->addColumn('id', 'integer', [
850
				'autoincrement' => true,
851
				'notnull' => true,
852
				'length' => 4,
853
			]);
854
			$table->addColumn('class', 'string', [
855
				'notnull' => true,
856
				'length' => 255,
857
				'default' => '',
858
			]);
859
			$table->addColumn('section', 'string', [
860
				'notnull' => false,
861
				'length' => 64,
862
			]);
863
			$table->addColumn('priority', 'smallint', [
864
				'notnull' => true,
865
				'length' => 1,
866
				'default' => 0,
867
			]);
868
			$table->setPrimaryKey(['id']);
869
			$table->addUniqueIndex(['class'], 'personal_settings_class');
870
			$table->addIndex(['section'], 'personal_settings_section');
871
		}
872
873
		if (!$schema->hasTable('accounts')) {
874
			$table = $schema->createTable('accounts');