Code Duplication    Length = 15-19 lines in 6 locations

core/Migrations/Version13000Date20170718121200.php 6 locations

@@ 43-61 (lines=19) @@
40
		/** @var Schema $schema */
41
		$schema = $schemaClosure();
42
43
		if (!$schema->hasTable('appconfig')) {
44
			$table = $schema->createTable('appconfig');
45
			$table->addColumn('appid', 'string', [
46
				'notnull' => true,
47
				'length' => 32,
48
				'default' => '',
49
			]);
50
			$table->addColumn('configkey', 'string', [
51
				'notnull' => true,
52
				'length' => 64,
53
				'default' => '',
54
			]);
55
			$table->addColumn('configvalue', 'text', [
56
				'notnull' => false,
57
			]);
58
			$table->setPrimaryKey(['appid', 'configkey']);
59
			$table->addIndex(['configkey'], 'appconfig_config_key_index');
60
			$table->addIndex(['appid'], 'appconfig_appid_key');
61
		}
62
63
		if (!$schema->hasTable('storages')) {
64
			$table = $schema->createTable('storages');
@@ 219-233 (lines=15) @@
216
			$table->addIndex(['storage', 'size', 'fileid'], 'fs_storage_size');
217
		}
218
219
		if (!$schema->hasTable('group_user')) {
220
			$table = $schema->createTable('group_user');
221
			$table->addColumn('gid', 'string', [
222
				'notnull' => true,
223
				'length' => 64,
224
				'default' => '',
225
			]);
226
			$table->addColumn('uid', 'string', [
227
				'notnull' => true,
228
				'length' => 64,
229
				'default' => '',
230
			]);
231
			$table->setPrimaryKey(['gid', 'uid']);
232
			$table->addIndex(['uid'], 'gu_uid_index');
233
		}
234
235
		if (!$schema->hasTable('group_admin')) {
236
			$table = $schema->createTable('group_admin');
@@ 235-249 (lines=15) @@
232
			$table->addIndex(['uid'], 'gu_uid_index');
233
		}
234
235
		if (!$schema->hasTable('group_admin')) {
236
			$table = $schema->createTable('group_admin');
237
			$table->addColumn('gid', 'string', [
238
				'notnull' => true,
239
				'length' => 64,
240
				'default' => '',
241
			]);
242
			$table->addColumn('uid', 'string', [
243
				'notnull' => true,
244
				'length' => 64,
245
				'default' => '',
246
			]);
247
			$table->setPrimaryKey(['gid', 'uid']);
248
			$table->addIndex(['uid'], 'group_admin_uid');
249
		}
250
251
		if (!$schema->hasTable('groups')) {
252
			$table = $schema->createTable('groups');
@@ 442-459 (lines=18) @@
439
			$table->addIndex(['class'], 'job_class_index');
440
		}
441
442
		if (!$schema->hasTable('users')) {
443
			$table = $schema->createTable('users');
444
			$table->addColumn('uid', 'string', [
445
				'notnull' => true,
446
				'length' => 64,
447
				'default' => '',
448
			]);
449
			$table->addColumn('displayname', 'string', [
450
				'notnull' => false,
451
				'length' => 64,
452
			]);
453
			$table->addColumn('password', 'string', [
454
				'notnull' => true,
455
				'length' => 255,
456
				'default' => '',
457
			]);
458
			$table->setPrimaryKey(['uid']);
459
		}
460
461
		if (!$schema->hasTable('authtoken')) {
462
			$table = $schema->createTable('authtoken');
@@ 810-828 (lines=19) @@
807
			$table->addIndex(['user'], 'credentials_user');
808
		}
809
810
		if (!$schema->hasTable('admin_sections')) {
811
			$table = $schema->createTable('admin_sections');
812
			$table->addColumn('id', 'string', [
813
				'notnull' => true,
814
				'length' => 64,
815
			]);
816
			$table->addColumn('class', 'string', [
817
				'notnull' => true,
818
				'length' => 255,
819
				'default' => '',
820
			]);
821
			$table->addColumn('priority', 'smallint', [
822
				'notnull' => true,
823
				'length' => 1,
824
				'default' => 0,
825
			]);
826
			$table->setPrimaryKey(['id']);
827
			$table->addUniqueIndex(['class'], 'admin_sections_class');
828
		}
829
830
		if (!$schema->hasTable('admin_settings')) {
831
			$table = $schema->createTable('admin_settings');
@@ 856-874 (lines=19) @@
853
			$table->addIndex(['section'], 'admin_settings_section');
854
		}
855
856
		if (!$schema->hasTable('personal_sections')) {
857
			$table = $schema->createTable('personal_sections');
858
			$table->addColumn('id', 'string', [
859
				'notnull' => true,
860
				'length' => 64,
861
			]);
862
			$table->addColumn('class', 'string', [
863
				'notnull' => true,
864
				'length' => 255,
865
				'default' => '',
866
			]);
867
			$table->addColumn('priority', 'smallint', [
868
				'notnull' => true,
869
				'length' => 1,
870
				'default' => 0,
871
			]);
872
			$table->setPrimaryKey(['id']);
873
			$table->addUniqueIndex(['class'], 'personal_sections_class');
874
		}
875
876
		if (!$schema->hasTable('personal_settings')) {
877
			$table = $schema->createTable('personal_settings');