Completed
Pull Request — master (#6097)
by Joas
16:36 queued 01:59
created
core/Migrations/Version13000Date20170814074715.php 1 patch
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -29,50 +29,50 @@
 block discarded – undo
29 29
 
30 30
 class Version13000Date20170814074715 extends SimpleMigrationStep {
31 31
 
32
-	/**
33
-	 * @param IOutput $output
34
-	 * @param \Closure $schemaClosure The `\Closure` returns a `Schema`
35
-	 * @param array $options
36
-	 * @since 13.0.0
37
-	 */
38
-	public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
39
-	}
32
+    /**
33
+     * @param IOutput $output
34
+     * @param \Closure $schemaClosure The `\Closure` returns a `Schema`
35
+     * @param array $options
36
+     * @since 13.0.0
37
+     */
38
+    public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
39
+    }
40 40
 
41
-	/**
42
-	 * @param IOutput $output
43
-	 * @param \Closure $schemaClosure The `\Closure` returns a `Schema`
44
-	 * @param array $options
45
-	 * @return null|Schema
46
-	 * @since 13.0.0
47
-	 */
48
-	public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
49
-		/** @var Schema $schema */
50
-		$schema = $schemaClosure();
41
+    /**
42
+     * @param IOutput $output
43
+     * @param \Closure $schemaClosure The `\Closure` returns a `Schema`
44
+     * @param array $options
45
+     * @return null|Schema
46
+     * @since 13.0.0
47
+     */
48
+    public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
49
+        /** @var Schema $schema */
50
+        $schema = $schemaClosure();
51 51
 
52 52
 
53
-		if (!$schema->hasTable('accounts')) {
54
-			$table = $schema->createTable('accounts');
55
-			$table->addColumn('uid', 'string', [
56
-				'notnull' => true,
57
-				'length' => 64,
58
-				'default' => '',
59
-			]);
60
-			$table->addColumn('data', 'text', [
61
-				'notnull' => true,
62
-				'default' => '',
63
-			]);
64
-			$table->setPrimaryKey(['uid']);
65
-		}
53
+        if (!$schema->hasTable('accounts')) {
54
+            $table = $schema->createTable('accounts');
55
+            $table->addColumn('uid', 'string', [
56
+                'notnull' => true,
57
+                'length' => 64,
58
+                'default' => '',
59
+            ]);
60
+            $table->addColumn('data', 'text', [
61
+                'notnull' => true,
62
+                'default' => '',
63
+            ]);
64
+            $table->setPrimaryKey(['uid']);
65
+        }
66 66
 
67
-		return $schema;
68
-	}
67
+        return $schema;
68
+    }
69 69
 
70
-	/**
71
-	 * @param IOutput $output
72
-	 * @param \Closure $schemaClosure The `\Closure` returns a `Schema`
73
-	 * @param array $options
74
-	 * @since 13.0.0
75
-	 */
76
-	public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
77
-	}
70
+    /**
71
+     * @param IOutput $output
72
+     * @param \Closure $schemaClosure The `\Closure` returns a `Schema`
73
+     * @param array $options
74
+     * @since 13.0.0
75
+     */
76
+    public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
77
+    }
78 78
 }
Please login to merge, or discard this patch.
core/Migrations/Version13000Date20170718121200.php 1 patch
Indentation   +884 added lines, -884 removed lines patch added patch discarded remove patch
@@ -29,888 +29,888 @@
 block discarded – undo
29 29
 
30 30
 class Version13000Date20170718121200 extends SimpleMigrationStep {
31 31
 
32
-	/**
33
-	 * @param IOutput $output
34
-	 * @param \Closure $schemaClosure The `\Closure` returns a `Schema`
35
-	 * @param array $options
36
-	 * @since 13.0.0
37
-	 */
38
-	public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
39
-	}
40
-
41
-	/**
42
-	 * @param IOutput $output
43
-	 * @param \Closure $schemaClosure The `\Closure` returns a `Schema`
44
-	 * @param array $options
45
-	 * @return null|Schema
46
-	 * @since 13.0.0
47
-	 */
48
-	public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
49
-		/** @var Schema $schema */
50
-		$schema = $schemaClosure();
51
-
52
-		if (!$schema->hasTable('appconfig')) {
53
-			$table = $schema->createTable('appconfig');
54
-			$table->addColumn('appid', 'string', [
55
-				'notnull' => true,
56
-				'length' => 32,
57
-				'default' => '',
58
-			]);
59
-			$table->addColumn('configkey', 'string', [
60
-				'notnull' => true,
61
-				'length' => 64,
62
-				'default' => '',
63
-			]);
64
-			$table->addColumn('configvalue', 'text', [
65
-				'notnull' => false,
66
-			]);
67
-			$table->setPrimaryKey(['appid', 'configkey']);
68
-			$table->addIndex(['configkey'], 'appconfig_config_key_index');
69
-			$table->addIndex(['appid'], 'appconfig_appid_key');
70
-		}
71
-
72
-		if (!$schema->hasTable('storages')) {
73
-			$table = $schema->createTable('storages');
74
-			$table->addColumn('id', 'string', [
75
-				'notnull' => false,
76
-				'length' => 64,
77
-			]);
78
-			$table->addColumn('numeric_id', 'integer', [
79
-				'autoincrement' => true,
80
-				'notnull' => true,
81
-				'length' => 4,
82
-			]);
83
-			$table->addColumn('available', 'integer', [
84
-				'notnull' => true,
85
-				'default' => 1,
86
-			]);
87
-			$table->addColumn('last_checked', 'integer', [
88
-				'notnull' => false,
89
-			]);
90
-			$table->setPrimaryKey(['numeric_id']);
91
-			$table->addUniqueIndex(['id'], 'storages_id_index');
92
-		}
93
-
94
-		if (!$schema->hasTable('mounts')) {
95
-			$table = $schema->createTable('mounts');
96
-			$table->addColumn('id', 'integer', [
97
-				'autoincrement' => true,
98
-				'notnull' => true,
99
-				'length' => 4,
100
-			]);
101
-			$table->addColumn('storage_id', 'integer', [
102
-				'notnull' => true,
103
-			]);
104
-			$table->addColumn('root_id', 'integer', [
105
-				'notnull' => true,
106
-			]);
107
-			$table->addColumn('user_id', 'string', [
108
-				'notnull' => true,
109
-				'length' => 64,
110
-			]);
111
-			$table->addColumn('mount_point', 'string', [
112
-				'notnull' => true,
113
-				'length' => 4000,
114
-			]);
115
-			$table->addColumn('mount_id', 'integer', [
116
-				'notnull' => false,
117
-			]);
118
-			$table->setPrimaryKey(['id']);
119
-			$table->addIndex(['user_id'], 'mounts_user_index');
120
-			$table->addIndex(['storage_id'], 'mounts_storage_index');
121
-			$table->addIndex(['root_id'], 'mounts_root_index');
122
-			$table->addIndex(['mount_id'], 'mounts_mount_id_index');
123
-			$table->addUniqueIndex(['user_id', 'root_id'], 'mounts_user_root_index');
124
-		}
125
-
126
-		if (!$schema->hasTable('mimetypes')) {
127
-			$table = $schema->createTable('mimetypes');
128
-			$table->addColumn('id', 'integer', [
129
-				'autoincrement' => true,
130
-				'notnull' => true,
131
-				'length' => 4,
132
-			]);
133
-			$table->addColumn('mimetype', 'string', [
134
-				'notnull' => true,
135
-				'length' => 255,
136
-				'default' => '',
137
-			]);
138
-			$table->setPrimaryKey(['id']);
139
-			$table->addUniqueIndex(['mimetype'], 'mimetype_id_index');
140
-		}
141
-
142
-		if (!$schema->hasTable('filecache')) {
143
-			$table = $schema->createTable('filecache');
144
-			$table->addColumn('fileid', 'integer', [
145
-				'autoincrement' => true,
146
-				'notnull' => true,
147
-				'length' => 4,
148
-			]);
149
-			$table->addColumn('storage', 'integer', [
150
-				'notnull' => true,
151
-				'length' => 4,
152
-				'default' => 0,
153
-			]);
154
-			$table->addColumn('path', 'string', [
155
-				'notnull' => false,
156
-				'length' => 4000,
157
-			]);
158
-			$table->addColumn('path_hash', 'string', [
159
-				'notnull' => true,
160
-				'length' => 32,
161
-				'default' => '',
162
-			]);
163
-			$table->addColumn('parent', 'integer', [
164
-				'notnull' => true,
165
-				'length' => 4,
166
-				'default' => 0,
167
-			]);
168
-			$table->addColumn('name', 'string', [
169
-				'notnull' => false,
170
-				'length' => 250,
171
-			]);
172
-			$table->addColumn('mimetype', 'integer', [
173
-				'notnull' => true,
174
-				'length' => 4,
175
-				'default' => 0,
176
-			]);
177
-			$table->addColumn('mimepart', 'integer', [
178
-				'notnull' => true,
179
-				'length' => 4,
180
-				'default' => 0,
181
-			]);
182
-			$table->addColumn('size', 'bigint', [
183
-				'notnull' => true,
184
-				'length' => 8,
185
-				'default' => 0,
186
-			]);
187
-			$table->addColumn('mtime', 'integer', [
188
-				'notnull' => true,
189
-				'length' => 4,
190
-				'default' => 0,
191
-			]);
192
-			$table->addColumn('storage_mtime', 'integer', [
193
-				'notnull' => true,
194
-				'length' => 4,
195
-				'default' => 0,
196
-			]);
197
-			$table->addColumn('encrypted', 'integer', [
198
-				'notnull' => true,
199
-				'length' => 4,
200
-				'default' => 0,
201
-			]);
202
-			$table->addColumn('unencrypted_size', 'bigint', [
203
-				'notnull' => true,
204
-				'length' => 8,
205
-				'default' => 0,
206
-			]);
207
-			$table->addColumn('etag', 'string', [
208
-				'notnull' => false,
209
-				'length' => 40,
210
-			]);
211
-			$table->addColumn('permissions', 'integer', [
212
-				'notnull' => false,
213
-				'length' => 4,
214
-				'default' => 0,
215
-			]);
216
-			$table->addColumn('checksum', 'string', [
217
-				'notnull' => false,
218
-				'length' => 255,
219
-			]);
220
-			$table->setPrimaryKey(['fileid']);
221
-			$table->addUniqueIndex(['storage', 'path_hash'], 'fs_storage_path_hash');
222
-			$table->addIndex(['parent', 'name'], 'fs_parent_name_hash');
223
-			$table->addIndex(['storage', 'mimetype'], 'fs_storage_mimetype');
224
-			$table->addIndex(['storage', 'mimepart'], 'fs_storage_mimepart');
225
-			$table->addIndex(['storage', 'size', 'fileid'], 'fs_storage_size');
226
-		}
227
-
228
-		if (!$schema->hasTable('group_user')) {
229
-			$table = $schema->createTable('group_user');
230
-			$table->addColumn('gid', 'string', [
231
-				'notnull' => true,
232
-				'length' => 64,
233
-				'default' => '',
234
-			]);
235
-			$table->addColumn('uid', 'string', [
236
-				'notnull' => true,
237
-				'length' => 64,
238
-				'default' => '',
239
-			]);
240
-			$table->setPrimaryKey(['gid', 'uid']);
241
-			$table->addIndex(['uid'], 'gu_uid_index');
242
-		}
243
-
244
-		if (!$schema->hasTable('group_admin')) {
245
-			$table = $schema->createTable('group_admin');
246
-			$table->addColumn('gid', 'string', [
247
-				'notnull' => true,
248
-				'length' => 64,
249
-				'default' => '',
250
-			]);
251
-			$table->addColumn('uid', 'string', [
252
-				'notnull' => true,
253
-				'length' => 64,
254
-				'default' => '',
255
-			]);
256
-			$table->setPrimaryKey(['gid', 'uid']);
257
-			$table->addIndex(['uid'], 'group_admin_uid');
258
-		}
259
-
260
-		if (!$schema->hasTable('groups')) {
261
-			$table = $schema->createTable('groups');
262
-			$table->addColumn('gid', 'string', [
263
-				'notnull' => true,
264
-				'length' => 64,
265
-				'default' => '',
266
-			]);
267
-			$table->setPrimaryKey(['gid']);
268
-		}
269
-
270
-		if (!$schema->hasTable('preferences')) {
271
-			$table = $schema->createTable('preferences');
272
-			$table->addColumn('userid', 'string', [
273
-				'notnull' => true,
274
-				'length' => 64,
275
-				'default' => '',
276
-			]);
277
-			$table->addColumn('appid', 'string', [
278
-				'notnull' => true,
279
-				'length' => 32,
280
-				'default' => '',
281
-			]);
282
-			$table->addColumn('configkey', 'string', [
283
-				'notnull' => true,
284
-				'length' => 64,
285
-				'default' => '',
286
-			]);
287
-			$table->addColumn('configvalue', 'text', [
288
-				'notnull' => false,
289
-			]);
290
-			$table->setPrimaryKey(['userid', 'appid', 'configkey']);
291
-		}
292
-
293
-		if (!$schema->hasTable('properties')) {
294
-			$table = $schema->createTable('properties');
295
-			$table->addColumn('id', 'integer', [
296
-				'autoincrement' => true,
297
-				'notnull' => true,
298
-				'length' => 4,
299
-			]);
300
-			$table->addColumn('userid', 'string', [
301
-				'notnull' => true,
302
-				'length' => 64,
303
-				'default' => '',
304
-			]);
305
-			$table->addColumn('propertypath', 'string', [
306
-				'notnull' => true,
307
-				'length' => 255,
308
-				'default' => '',
309
-			]);
310
-			$table->addColumn('propertyname', 'string', [
311
-				'notnull' => true,
312
-				'length' => 255,
313
-				'default' => '',
314
-			]);
315
-			$table->addColumn('propertyvalue', 'text', [
316
-				'notnull' => true,
317
-			]);
318
-			$table->setPrimaryKey(['id']);
319
-			$table->addIndex(['userid'], 'property_index');
320
-		}
321
-
322
-		if (!$schema->hasTable('share')) {
323
-			$table = $schema->createTable('share');
324
-			$table->addColumn('id', 'integer', [
325
-				'autoincrement' => true,
326
-				'notnull' => true,
327
-				'length' => 4,
328
-			]);
329
-			$table->addColumn('share_type', 'smallint', [
330
-				'notnull' => true,
331
-				'length' => 1,
332
-				'default' => 0,
333
-			]);
334
-			$table->addColumn('share_with', 'string', [
335
-				'notnull' => false,
336
-				'length' => 255,
337
-			]);
338
-			$table->addColumn('password', 'string', [
339
-				'notnull' => false,
340
-				'length' => 255,
341
-			]);
342
-			$table->addColumn('uid_owner', 'string', [
343
-				'notnull' => true,
344
-				'length' => 64,
345
-				'default' => '',
346
-			]);
347
-			$table->addColumn('uid_initiator', 'string', [
348
-				'notnull' => false,
349
-				'length' => 64,
350
-			]);
351
-			$table->addColumn('parent', 'integer', [
352
-				'notnull' => false,
353
-				'length' => 4,
354
-			]);
355
-			$table->addColumn('item_type', 'string', [
356
-				'notnull' => true,
357
-				'length' => 64,
358
-				'default' => '',
359
-			]);
360
-			$table->addColumn('item_source', 'string', [
361
-				'notnull' => false,
362
-				'length' => 255,
363
-			]);
364
-			$table->addColumn('item_target', 'string', [
365
-				'notnull' => false,
366
-				'length' => 255,
367
-			]);
368
-			$table->addColumn('file_source', 'integer', [
369
-				'notnull' => false,
370
-				'length' => 4,
371
-			]);
372
-			$table->addColumn('file_target', 'string', [
373
-				'notnull' => false,
374
-				'length' => 512,
375
-			]);
376
-			$table->addColumn('permissions', 'smallint', [
377
-				'notnull' => true,
378
-				'length' => 1,
379
-				'default' => 0,
380
-			]);
381
-			$table->addColumn('stime', 'bigint', [
382
-				'notnull' => true,
383
-				'length' => 8,
384
-				'default' => 0,
385
-			]);
386
-			$table->addColumn('accepted', 'smallint', [
387
-				'notnull' => true,
388
-				'length' => 1,
389
-				'default' => 0,
390
-			]);
391
-			$table->addColumn('expiration', 'datetime', [
392
-				'notnull' => false,
393
-			]);
394
-			$table->addColumn('token', 'string', [
395
-				'notnull' => false,
396
-				'length' => 32,
397
-			]);
398
-			$table->addColumn('mail_send', 'smallint', [
399
-				'notnull' => true,
400
-				'length' => 1,
401
-				'default' => 0,
402
-			]);
403
-			$table->addColumn('share_name', 'string', [
404
-				'notnull' => false,
405
-				'length' => 64,
406
-			]);
407
-			$table->setPrimaryKey(['id']);
408
-			$table->addIndex(['item_type', 'share_type'], 'item_share_type_index');
409
-			$table->addIndex(['file_source'], 'file_source_index');
410
-			$table->addIndex(['token'], 'token_index');
411
-		}
412
-
413
-		if (!$schema->hasTable('jobs')) {
414
-			$table = $schema->createTable('jobs');
415
-			$table->addColumn('id', 'integer', [
416
-				'autoincrement' => true,
417
-				'notnull' => true,
418
-				'length' => 4,
419
-			]);
420
-			$table->addColumn('class', 'string', [
421
-				'notnull' => true,
422
-				'length' => 255,
423
-				'default' => '',
424
-			]);
425
-			$table->addColumn('argument', 'string', [
426
-				'notnull' => true,
427
-				'length' => 4000,
428
-				'default' => '',
429
-			]);
430
-			$table->addColumn('last_run', 'integer', [
431
-				'notnull' => false,
432
-				'default' => 0,
433
-			]);
434
-			$table->addColumn('last_checked', 'integer', [
435
-				'notnull' => false,
436
-				'default' => 0,
437
-			]);
438
-			$table->addColumn('reserved_at', 'integer', [
439
-				'notnull' => false,
440
-				'default' => 0,
441
-			]);
442
-			$table->addColumn('execution_duration', 'integer', [
443
-				'notnull' => true,
444
-				'default' => 0,
445
-			]);
446
-			$table->setPrimaryKey(['id']);
447
-			$table->addIndex(['class'], 'job_class_index');
448
-		}
449
-
450
-		if (!$schema->hasTable('users')) {
451
-			$table = $schema->createTable('users');
452
-			$table->addColumn('uid', 'string', [
453
-				'notnull' => true,
454
-				'length' => 64,
455
-				'default' => '',
456
-			]);
457
-			$table->addColumn('displayname', 'string', [
458
-				'notnull' => false,
459
-				'length' => 64,
460
-			]);
461
-			$table->addColumn('password', 'string', [
462
-				'notnull' => true,
463
-				'length' => 255,
464
-				'default' => '',
465
-			]);
466
-			$table->setPrimaryKey(['uid']);
467
-		}
468
-
469
-		if (!$schema->hasTable('authtoken')) {
470
-			$table = $schema->createTable('authtoken');
471
-			$table->addColumn('id', 'integer', [
472
-				'autoincrement' => true,
473
-				'notnull' => true,
474
-				'length' => 4,
475
-			]);
476
-			$table->addColumn('uid', 'string', [
477
-				'notnull' => true,
478
-				'length' => 64,
479
-				'default' => '',
480
-			]);
481
-			$table->addColumn('login_name', 'string', [
482
-				'notnull' => true,
483
-				'length' => 64,
484
-				'default' => '',
485
-			]);
486
-			$table->addColumn('password', 'text', [
487
-				'notnull' => false,
488
-			]);
489
-			$table->addColumn('name', 'text', [
490
-				'notnull' => true,
491
-				'default' => '',
492
-			]);
493
-			$table->addColumn('token', 'string', [
494
-				'notnull' => true,
495
-				'length' => 200,
496
-				'default' => '',
497
-			]);
498
-			$table->addColumn('type', 'smallint', [
499
-				'notnull' => true,
500
-				'length' => 2,
501
-				'default' => 0,
502
-			]);
503
-			$table->addColumn('remember', 'smallint', [
504
-				'notnull' => true,
505
-				'length' => 1,
506
-				'default' => 0,
507
-			]);
508
-			$table->addColumn('last_activity', 'integer', [
509
-				'notnull' => true,
510
-				'length' => 4,
511
-				'default' => 0,
512
-			]);
513
-			$table->addColumn('last_check', 'integer', [
514
-				'notnull' => true,
515
-				'length' => 4,
516
-				'default' => 0,
517
-			]);
518
-			$table->addColumn('scope', 'text', [
519
-				'notnull' => false,
520
-			]);
521
-			$table->setPrimaryKey(['id']);
522
-			$table->addUniqueIndex(['token'], 'authtoken_token_index');
523
-			$table->addIndex(['last_activity'], 'authtoken_last_activity_index');
524
-		}
525
-
526
-		if (!$schema->hasTable('bruteforce_attempts')) {
527
-			$table = $schema->createTable('bruteforce_attempts');
528
-			$table->addColumn('id', 'integer', [
529
-				'autoincrement' => true,
530
-				'notnull' => true,
531
-				'length' => 4,
532
-			]);
533
-			$table->addColumn('action', 'string', [
534
-				'notnull' => true,
535
-				'length' => 64,
536
-				'default' => '',
537
-			]);
538
-			$table->addColumn('occurred', 'integer', [
539
-				'notnull' => true,
540
-				'length' => 4,
541
-				'default' => 0,
542
-			]);
543
-			$table->addColumn('ip', 'string', [
544
-				'notnull' => true,
545
-				'length' => 255,
546
-				'default' => '',
547
-			]);
548
-			$table->addColumn('subnet', 'string', [
549
-				'notnull' => true,
550
-				'length' => 255,
551
-				'default' => '',
552
-			]);
553
-			$table->addColumn('metadata', 'string', [
554
-				'notnull' => true,
555
-				'length' => 255,
556
-				'default' => '',
557
-			]);
558
-			$table->setPrimaryKey(['id']);
559
-			$table->addIndex(['ip'], 'bruteforce_attempts_ip');
560
-			$table->addIndex(['subnet'], 'bruteforce_attempts_subnet');
561
-		}
562
-
563
-		if (!$schema->hasTable('vcategory')) {
564
-			$table = $schema->createTable('vcategory');
565
-			$table->addColumn('id', 'integer', [
566
-				'autoincrement' => true,
567
-				'notnull' => true,
568
-				'length' => 4,
569
-			]);
570
-			$table->addColumn('uid', 'string', [
571
-				'notnull' => true,
572
-				'length' => 64,
573
-				'default' => '',
574
-			]);
575
-			$table->addColumn('type', 'string', [
576
-				'notnull' => true,
577
-				'length' => 64,
578
-				'default' => '',
579
-			]);
580
-			$table->addColumn('category', 'string', [
581
-				'notnull' => true,
582
-				'length' => 255,
583
-				'default' => '',
584
-			]);
585
-			$table->setPrimaryKey(['id']);
586
-			$table->addIndex(['uid'], 'uid_index');
587
-			$table->addIndex(['type'], 'type_index');
588
-			$table->addIndex(['category'], 'category_index');
589
-		}
590
-
591
-		if (!$schema->hasTable('vcategory_to_object')) {
592
-			$table = $schema->createTable('vcategory_to_object');
593
-			$table->addColumn('objid', 'integer', [
594
-				'notnull' => true,
595
-				'length' => 4,
596
-				'default' => 0,
597
-			]);
598
-			$table->addColumn('categoryid', 'integer', [
599
-				'notnull' => true,
600
-				'length' => 4,
601
-				'default' => 0,
602
-			]);
603
-			$table->addColumn('type', 'string', [
604
-				'notnull' => true,
605
-				'length' => 64,
606
-				'default' => '',
607
-			]);
608
-			$table->setPrimaryKey(['categoryid', 'objid', 'type']);
609
-			$table->addIndex(['objid', 'type'], 'vcategory_objectd_index');
610
-		}
611
-
612
-		if (!$schema->hasTable('systemtag')) {
613
-			$table = $schema->createTable('systemtag');
614
-			$table->addColumn('id', 'integer', [
615
-				'autoincrement' => true,
616
-				'notnull' => true,
617
-				'length' => 4,
618
-			]);
619
-			$table->addColumn('name', 'string', [
620
-				'notnull' => true,
621
-				'length' => 64,
622
-				'default' => '',
623
-			]);
624
-			$table->addColumn('visibility', 'smallint', [
625
-				'notnull' => true,
626
-				'length' => 1,
627
-				'default' => 1,
628
-			]);
629
-			$table->addColumn('editable', 'smallint', [
630
-				'notnull' => true,
631
-				'length' => 1,
632
-				'default' => 1,
633
-			]);
634
-			$table->setPrimaryKey(['id']);
635
-			$table->addUniqueIndex(['name', 'visibility', 'editable'], 'tag_ident');
636
-		}
637
-
638
-		if (!$schema->hasTable('systemtag_object_mapping')) {
639
-			$table = $schema->createTable('systemtag_object_mapping');
640
-			$table->addColumn('objectid', 'string', [
641
-				'notnull' => true,
642
-				'length' => 64,
643
-				'default' => '',
644
-			]);
645
-			$table->addColumn('objecttype', 'string', [
646
-				'notnull' => true,
647
-				'length' => 64,
648
-				'default' => '',
649
-			]);
650
-			$table->addColumn('systemtagid', 'integer', [
651
-				'notnull' => true,
652
-				'length' => 4,
653
-				'default' => 0,
654
-			]);
655
-			$table->addUniqueIndex(['objecttype', 'objectid', 'systemtagid'], 'mapping');
656
-		}
657
-
658
-		if (!$schema->hasTable('systemtag_group')) {
659
-			$table = $schema->createTable('systemtag_group');
660
-			$table->addColumn('systemtagid', 'integer', [
661
-				'notnull' => true,
662
-				'length' => 4,
663
-				'default' => 0,
664
-			]);
665
-			$table->addColumn('gid', 'string', [
666
-				'notnull' => true,
667
-			]);
668
-			$table->setPrimaryKey(['gid', 'systemtagid']);
669
-		}
670
-
671
-		if (!$schema->hasTable('file_locks')) {
672
-			$table = $schema->createTable('file_locks');
673
-			$table->addColumn('id', 'integer', [
674
-				'autoincrement' => true,
675
-				'notnull' => true,
676
-				'length' => 4,
677
-			]);
678
-			$table->addColumn('lock', 'integer', [
679
-				'notnull' => true,
680
-				'length' => 4,
681
-				'default' => 0,
682
-			]);
683
-			$table->addColumn('key', 'string', [
684
-				'notnull' => true,
685
-				'length' => 64,
686
-			]);
687
-			$table->addColumn('ttl', 'integer', [
688
-				'notnull' => true,
689
-				'length' => 4,
690
-				'default' => -1,
691
-			]);
692
-			$table->setPrimaryKey(['id']);
693
-			$table->addUniqueIndex(['key'], 'lock_key_index');
694
-			$table->addIndex(['ttl'], 'lock_ttl_index');
695
-		}
696
-
697
-		if (!$schema->hasTable('comments')) {
698
-			$table = $schema->createTable('comments');
699
-			$table->addColumn('id', 'integer', [
700
-				'autoincrement' => true,
701
-				'notnull' => true,
702
-				'length' => 4,
703
-			]);
704
-			$table->addColumn('parent_id', 'integer', [
705
-				'notnull' => true,
706
-				'length' => 4,
707
-				'default' => 0,
708
-			]);
709
-			$table->addColumn('topmost_parent_id', 'integer', [
710
-				'notnull' => true,
711
-				'length' => 4,
712
-				'default' => 0,
713
-			]);
714
-			$table->addColumn('children_count', 'integer', [
715
-				'notnull' => true,
716
-				'length' => 4,
717
-				'default' => 0,
718
-			]);
719
-			$table->addColumn('actor_type', 'string', [
720
-				'notnull' => true,
721
-				'length' => 64,
722
-				'default' => '',
723
-			]);
724
-			$table->addColumn('actor_id', 'string', [
725
-				'notnull' => true,
726
-				'length' => 64,
727
-				'default' => '',
728
-			]);
729
-			$table->addColumn('message', 'text', [
730
-				'notnull' => false,
731
-			]);
732
-			$table->addColumn('verb', 'string', [
733
-				'notnull' => false,
734
-				'length' => 64,
735
-			]);
736
-			$table->addColumn('creation_timestamp', 'datetime', [
737
-				'notnull' => false,
738
-			]);
739
-			$table->addColumn('latest_child_timestamp', 'datetime', [
740
-				'notnull' => false,
741
-			]);
742
-			$table->addColumn('object_type', 'string', [
743
-				'notnull' => true,
744
-				'length' => 64,
745
-				'default' => '',
746
-			]);
747
-			$table->addColumn('object_id', 'string', [
748
-				'notnull' => true,
749
-				'length' => 64,
750
-				'default' => '',
751
-			]);
752
-			$table->setPrimaryKey(['id']);
753
-			$table->addIndex(['parent_id'], 'comments_parent_id_index');
754
-			$table->addIndex(['topmost_parent_id'], 'comments_topmost_parent_id_idx');
755
-			$table->addIndex(['object_type', 'object_id', 'creation_timestamp'], 'comments_object_index');
756
-			$table->addIndex(['actor_type', 'actor_id'], 'comments_actor_index');
757
-		}
758
-
759
-		if (!$schema->hasTable('comments_read_markers')) {
760
-			$table = $schema->createTable('comments_read_markers');
761
-			$table->addColumn('user_id', 'string', [
762
-				'notnull' => true,
763
-				'length' => 64,
764
-				'default' => '',
765
-			]);
766
-			$table->addColumn('marker_datetime', 'datetime', [
767
-				'notnull' => false,
768
-			]);
769
-			$table->addColumn('object_type', 'string', [
770
-				'notnull' => true,
771
-				'length' => 64,
772
-				'default' => '',
773
-			]);
774
-			$table->addColumn('object_id', 'string', [
775
-				'notnull' => true,
776
-				'length' => 64,
777
-				'default' => '',
778
-			]);
779
-			$table->addIndex(['object_type', 'object_id'], 'comments_marker_object_index');
780
-			$table->addUniqueIndex(['user_id', 'object_type', 'object_id'], 'comments_marker_index');
781
-		}
782
-
783
-		if (!$schema->hasTable('credentials')) {
784
-			$table = $schema->createTable('credentials');
785
-			$table->addColumn('user', 'string', [
786
-				'notnull' => true,
787
-				'length' => 64,
788
-			]);
789
-			$table->addColumn('identifier', 'string', [
790
-				'notnull' => true,
791
-				'length' => 64,
792
-			]);
793
-			$table->addColumn('credentials', 'text', [
794
-				'notnull' => false,
795
-			]);
796
-			$table->setPrimaryKey(['user', 'identifier']);
797
-			$table->addIndex(['user'], 'credentials_user');
798
-		}
799
-
800
-		if (!$schema->hasTable('admin_sections')) {
801
-			$table = $schema->createTable('admin_sections');
802
-			$table->addColumn('id', 'string', [
803
-				'notnull' => true,
804
-				'length' => 64,
805
-			]);
806
-			$table->addColumn('class', 'string', [
807
-				'notnull' => true,
808
-				'length' => 255,
809
-				'default' => '',
810
-			]);
811
-			$table->addColumn('priority', 'smallint', [
812
-				'notnull' => true,
813
-				'length' => 1,
814
-				'default' => 0,
815
-			]);
816
-			$table->setPrimaryKey(['id']);
817
-			$table->addUniqueIndex(['class'], 'admin_sections_class');
818
-		}
819
-
820
-		if (!$schema->hasTable('admin_settings')) {
821
-			$table = $schema->createTable('admin_settings');
822
-			$table->addColumn('id', 'integer', [
823
-				'autoincrement' => true,
824
-				'notnull' => true,
825
-				'length' => 4,
826
-			]);
827
-			$table->addColumn('class', 'string', [
828
-				'notnull' => true,
829
-				'length' => 255,
830
-				'default' => '',
831
-			]);
832
-			$table->addColumn('section', 'string', [
833
-				'notnull' => false,
834
-				'length' => 64,
835
-			]);
836
-			$table->addColumn('priority', 'smallint', [
837
-				'notnull' => true,
838
-				'length' => 1,
839
-				'default' => 0,
840
-			]);
841
-			$table->setPrimaryKey(['id']);
842
-			$table->addUniqueIndex(['class'], 'admin_settings_class');
843
-			$table->addIndex(['section'], 'admin_settings_section');
844
-		}
845
-
846
-		if (!$schema->hasTable('personal_sections')) {
847
-			$table = $schema->createTable('personal_sections');
848
-			$table->addColumn('id', 'string', [
849
-				'notnull' => true,
850
-				'length' => 64,
851
-			]);
852
-			$table->addColumn('class', 'string', [
853
-				'notnull' => true,
854
-				'length' => 255,
855
-				'default' => '',
856
-			]);
857
-			$table->addColumn('priority', 'smallint', [
858
-				'notnull' => true,
859
-				'length' => 1,
860
-				'default' => 0,
861
-			]);
862
-			$table->setPrimaryKey(['id']);
863
-			$table->addUniqueIndex(['class'], 'personal_sections_class');
864
-		}
865
-
866
-		if (!$schema->hasTable('personal_settings')) {
867
-			$table = $schema->createTable('personal_settings');
868
-			$table->addColumn('id', 'integer', [
869
-				'autoincrement' => true,
870
-				'notnull' => true,
871
-				'length' => 4,
872
-			]);
873
-			$table->addColumn('class', 'string', [
874
-				'notnull' => true,
875
-				'length' => 255,
876
-				'default' => '',
877
-			]);
878
-			$table->addColumn('section', 'string', [
879
-				'notnull' => false,
880
-				'length' => 64,
881
-			]);
882
-			$table->addColumn('priority', 'smallint', [
883
-				'notnull' => true,
884
-				'length' => 1,
885
-				'default' => 0,
886
-			]);
887
-			$table->setPrimaryKey(['id']);
888
-			$table->addUniqueIndex(['class'], 'personal_settings_class');
889
-			$table->addIndex(['section'], 'personal_settings_section');
890
-		}
891
-
892
-		if (!$schema->hasTable('accounts')) {
893
-			$table = $schema->createTable('accounts');
894
-			$table->addColumn('uid', 'string', [
895
-				'notnull' => true,
896
-				'length' => 64,
897
-				'default' => '',
898
-			]);
899
-			$table->addColumn('data', 'text', [
900
-				'notnull' => true,
901
-				'default' => '',
902
-			]);
903
-			$table->setPrimaryKey(['uid']);
904
-		}
905
-		return $schema;
906
-	}
907
-
908
-	/**
909
-	 * @param IOutput $output
910
-	 * @param \Closure $schemaClosure The `\Closure` returns a `Schema`
911
-	 * @param array $options
912
-	 * @since 13.0.0
913
-	 */
914
-	public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
915
-	}
32
+    /**
33
+     * @param IOutput $output
34
+     * @param \Closure $schemaClosure The `\Closure` returns a `Schema`
35
+     * @param array $options
36
+     * @since 13.0.0
37
+     */
38
+    public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
39
+    }
40
+
41
+    /**
42
+     * @param IOutput $output
43
+     * @param \Closure $schemaClosure The `\Closure` returns a `Schema`
44
+     * @param array $options
45
+     * @return null|Schema
46
+     * @since 13.0.0
47
+     */
48
+    public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
49
+        /** @var Schema $schema */
50
+        $schema = $schemaClosure();
51
+
52
+        if (!$schema->hasTable('appconfig')) {
53
+            $table = $schema->createTable('appconfig');
54
+            $table->addColumn('appid', 'string', [
55
+                'notnull' => true,
56
+                'length' => 32,
57
+                'default' => '',
58
+            ]);
59
+            $table->addColumn('configkey', 'string', [
60
+                'notnull' => true,
61
+                'length' => 64,
62
+                'default' => '',
63
+            ]);
64
+            $table->addColumn('configvalue', 'text', [
65
+                'notnull' => false,
66
+            ]);
67
+            $table->setPrimaryKey(['appid', 'configkey']);
68
+            $table->addIndex(['configkey'], 'appconfig_config_key_index');
69
+            $table->addIndex(['appid'], 'appconfig_appid_key');
70
+        }
71
+
72
+        if (!$schema->hasTable('storages')) {
73
+            $table = $schema->createTable('storages');
74
+            $table->addColumn('id', 'string', [
75
+                'notnull' => false,
76
+                'length' => 64,
77
+            ]);
78
+            $table->addColumn('numeric_id', 'integer', [
79
+                'autoincrement' => true,
80
+                'notnull' => true,
81
+                'length' => 4,
82
+            ]);
83
+            $table->addColumn('available', 'integer', [
84
+                'notnull' => true,
85
+                'default' => 1,
86
+            ]);
87
+            $table->addColumn('last_checked', 'integer', [
88
+                'notnull' => false,
89
+            ]);
90
+            $table->setPrimaryKey(['numeric_id']);
91
+            $table->addUniqueIndex(['id'], 'storages_id_index');
92
+        }
93
+
94
+        if (!$schema->hasTable('mounts')) {
95
+            $table = $schema->createTable('mounts');
96
+            $table->addColumn('id', 'integer', [
97
+                'autoincrement' => true,
98
+                'notnull' => true,
99
+                'length' => 4,
100
+            ]);
101
+            $table->addColumn('storage_id', 'integer', [
102
+                'notnull' => true,
103
+            ]);
104
+            $table->addColumn('root_id', 'integer', [
105
+                'notnull' => true,
106
+            ]);
107
+            $table->addColumn('user_id', 'string', [
108
+                'notnull' => true,
109
+                'length' => 64,
110
+            ]);
111
+            $table->addColumn('mount_point', 'string', [
112
+                'notnull' => true,
113
+                'length' => 4000,
114
+            ]);
115
+            $table->addColumn('mount_id', 'integer', [
116
+                'notnull' => false,
117
+            ]);
118
+            $table->setPrimaryKey(['id']);
119
+            $table->addIndex(['user_id'], 'mounts_user_index');
120
+            $table->addIndex(['storage_id'], 'mounts_storage_index');
121
+            $table->addIndex(['root_id'], 'mounts_root_index');
122
+            $table->addIndex(['mount_id'], 'mounts_mount_id_index');
123
+            $table->addUniqueIndex(['user_id', 'root_id'], 'mounts_user_root_index');
124
+        }
125
+
126
+        if (!$schema->hasTable('mimetypes')) {
127
+            $table = $schema->createTable('mimetypes');
128
+            $table->addColumn('id', 'integer', [
129
+                'autoincrement' => true,
130
+                'notnull' => true,
131
+                'length' => 4,
132
+            ]);
133
+            $table->addColumn('mimetype', 'string', [
134
+                'notnull' => true,
135
+                'length' => 255,
136
+                'default' => '',
137
+            ]);
138
+            $table->setPrimaryKey(['id']);
139
+            $table->addUniqueIndex(['mimetype'], 'mimetype_id_index');
140
+        }
141
+
142
+        if (!$schema->hasTable('filecache')) {
143
+            $table = $schema->createTable('filecache');
144
+            $table->addColumn('fileid', 'integer', [
145
+                'autoincrement' => true,
146
+                'notnull' => true,
147
+                'length' => 4,
148
+            ]);
149
+            $table->addColumn('storage', 'integer', [
150
+                'notnull' => true,
151
+                'length' => 4,
152
+                'default' => 0,
153
+            ]);
154
+            $table->addColumn('path', 'string', [
155
+                'notnull' => false,
156
+                'length' => 4000,
157
+            ]);
158
+            $table->addColumn('path_hash', 'string', [
159
+                'notnull' => true,
160
+                'length' => 32,
161
+                'default' => '',
162
+            ]);
163
+            $table->addColumn('parent', 'integer', [
164
+                'notnull' => true,
165
+                'length' => 4,
166
+                'default' => 0,
167
+            ]);
168
+            $table->addColumn('name', 'string', [
169
+                'notnull' => false,
170
+                'length' => 250,
171
+            ]);
172
+            $table->addColumn('mimetype', 'integer', [
173
+                'notnull' => true,
174
+                'length' => 4,
175
+                'default' => 0,
176
+            ]);
177
+            $table->addColumn('mimepart', 'integer', [
178
+                'notnull' => true,
179
+                'length' => 4,
180
+                'default' => 0,
181
+            ]);
182
+            $table->addColumn('size', 'bigint', [
183
+                'notnull' => true,
184
+                'length' => 8,
185
+                'default' => 0,
186
+            ]);
187
+            $table->addColumn('mtime', 'integer', [
188
+                'notnull' => true,
189
+                'length' => 4,
190
+                'default' => 0,
191
+            ]);
192
+            $table->addColumn('storage_mtime', 'integer', [
193
+                'notnull' => true,
194
+                'length' => 4,
195
+                'default' => 0,
196
+            ]);
197
+            $table->addColumn('encrypted', 'integer', [
198
+                'notnull' => true,
199
+                'length' => 4,
200
+                'default' => 0,
201
+            ]);
202
+            $table->addColumn('unencrypted_size', 'bigint', [
203
+                'notnull' => true,
204
+                'length' => 8,
205
+                'default' => 0,
206
+            ]);
207
+            $table->addColumn('etag', 'string', [
208
+                'notnull' => false,
209
+                'length' => 40,
210
+            ]);
211
+            $table->addColumn('permissions', 'integer', [
212
+                'notnull' => false,
213
+                'length' => 4,
214
+                'default' => 0,
215
+            ]);
216
+            $table->addColumn('checksum', 'string', [
217
+                'notnull' => false,
218
+                'length' => 255,
219
+            ]);
220
+            $table->setPrimaryKey(['fileid']);
221
+            $table->addUniqueIndex(['storage', 'path_hash'], 'fs_storage_path_hash');
222
+            $table->addIndex(['parent', 'name'], 'fs_parent_name_hash');
223
+            $table->addIndex(['storage', 'mimetype'], 'fs_storage_mimetype');
224
+            $table->addIndex(['storage', 'mimepart'], 'fs_storage_mimepart');
225
+            $table->addIndex(['storage', 'size', 'fileid'], 'fs_storage_size');
226
+        }
227
+
228
+        if (!$schema->hasTable('group_user')) {
229
+            $table = $schema->createTable('group_user');
230
+            $table->addColumn('gid', 'string', [
231
+                'notnull' => true,
232
+                'length' => 64,
233
+                'default' => '',
234
+            ]);
235
+            $table->addColumn('uid', 'string', [
236
+                'notnull' => true,
237
+                'length' => 64,
238
+                'default' => '',
239
+            ]);
240
+            $table->setPrimaryKey(['gid', 'uid']);
241
+            $table->addIndex(['uid'], 'gu_uid_index');
242
+        }
243
+
244
+        if (!$schema->hasTable('group_admin')) {
245
+            $table = $schema->createTable('group_admin');
246
+            $table->addColumn('gid', 'string', [
247
+                'notnull' => true,
248
+                'length' => 64,
249
+                'default' => '',
250
+            ]);
251
+            $table->addColumn('uid', 'string', [
252
+                'notnull' => true,
253
+                'length' => 64,
254
+                'default' => '',
255
+            ]);
256
+            $table->setPrimaryKey(['gid', 'uid']);
257
+            $table->addIndex(['uid'], 'group_admin_uid');
258
+        }
259
+
260
+        if (!$schema->hasTable('groups')) {
261
+            $table = $schema->createTable('groups');
262
+            $table->addColumn('gid', 'string', [
263
+                'notnull' => true,
264
+                'length' => 64,
265
+                'default' => '',
266
+            ]);
267
+            $table->setPrimaryKey(['gid']);
268
+        }
269
+
270
+        if (!$schema->hasTable('preferences')) {
271
+            $table = $schema->createTable('preferences');
272
+            $table->addColumn('userid', 'string', [
273
+                'notnull' => true,
274
+                'length' => 64,
275
+                'default' => '',
276
+            ]);
277
+            $table->addColumn('appid', 'string', [
278
+                'notnull' => true,
279
+                'length' => 32,
280
+                'default' => '',
281
+            ]);
282
+            $table->addColumn('configkey', 'string', [
283
+                'notnull' => true,
284
+                'length' => 64,
285
+                'default' => '',
286
+            ]);
287
+            $table->addColumn('configvalue', 'text', [
288
+                'notnull' => false,
289
+            ]);
290
+            $table->setPrimaryKey(['userid', 'appid', 'configkey']);
291
+        }
292
+
293
+        if (!$schema->hasTable('properties')) {
294
+            $table = $schema->createTable('properties');
295
+            $table->addColumn('id', 'integer', [
296
+                'autoincrement' => true,
297
+                'notnull' => true,
298
+                'length' => 4,
299
+            ]);
300
+            $table->addColumn('userid', 'string', [
301
+                'notnull' => true,
302
+                'length' => 64,
303
+                'default' => '',
304
+            ]);
305
+            $table->addColumn('propertypath', 'string', [
306
+                'notnull' => true,
307
+                'length' => 255,
308
+                'default' => '',
309
+            ]);
310
+            $table->addColumn('propertyname', 'string', [
311
+                'notnull' => true,
312
+                'length' => 255,
313
+                'default' => '',
314
+            ]);
315
+            $table->addColumn('propertyvalue', 'text', [
316
+                'notnull' => true,
317
+            ]);
318
+            $table->setPrimaryKey(['id']);
319
+            $table->addIndex(['userid'], 'property_index');
320
+        }
321
+
322
+        if (!$schema->hasTable('share')) {
323
+            $table = $schema->createTable('share');
324
+            $table->addColumn('id', 'integer', [
325
+                'autoincrement' => true,
326
+                'notnull' => true,
327
+                'length' => 4,
328
+            ]);
329
+            $table->addColumn('share_type', 'smallint', [
330
+                'notnull' => true,
331
+                'length' => 1,
332
+                'default' => 0,
333
+            ]);
334
+            $table->addColumn('share_with', 'string', [
335
+                'notnull' => false,
336
+                'length' => 255,
337
+            ]);
338
+            $table->addColumn('password', 'string', [
339
+                'notnull' => false,
340
+                'length' => 255,
341
+            ]);
342
+            $table->addColumn('uid_owner', 'string', [
343
+                'notnull' => true,
344
+                'length' => 64,
345
+                'default' => '',
346
+            ]);
347
+            $table->addColumn('uid_initiator', 'string', [
348
+                'notnull' => false,
349
+                'length' => 64,
350
+            ]);
351
+            $table->addColumn('parent', 'integer', [
352
+                'notnull' => false,
353
+                'length' => 4,
354
+            ]);
355
+            $table->addColumn('item_type', 'string', [
356
+                'notnull' => true,
357
+                'length' => 64,
358
+                'default' => '',
359
+            ]);
360
+            $table->addColumn('item_source', 'string', [
361
+                'notnull' => false,
362
+                'length' => 255,
363
+            ]);
364
+            $table->addColumn('item_target', 'string', [
365
+                'notnull' => false,
366
+                'length' => 255,
367
+            ]);
368
+            $table->addColumn('file_source', 'integer', [
369
+                'notnull' => false,
370
+                'length' => 4,
371
+            ]);
372
+            $table->addColumn('file_target', 'string', [
373
+                'notnull' => false,
374
+                'length' => 512,
375
+            ]);
376
+            $table->addColumn('permissions', 'smallint', [
377
+                'notnull' => true,
378
+                'length' => 1,
379
+                'default' => 0,
380
+            ]);
381
+            $table->addColumn('stime', 'bigint', [
382
+                'notnull' => true,
383
+                'length' => 8,
384
+                'default' => 0,
385
+            ]);
386
+            $table->addColumn('accepted', 'smallint', [
387
+                'notnull' => true,
388
+                'length' => 1,
389
+                'default' => 0,
390
+            ]);
391
+            $table->addColumn('expiration', 'datetime', [
392
+                'notnull' => false,
393
+            ]);
394
+            $table->addColumn('token', 'string', [
395
+                'notnull' => false,
396
+                'length' => 32,
397
+            ]);
398
+            $table->addColumn('mail_send', 'smallint', [
399
+                'notnull' => true,
400
+                'length' => 1,
401
+                'default' => 0,
402
+            ]);
403
+            $table->addColumn('share_name', 'string', [
404
+                'notnull' => false,
405
+                'length' => 64,
406
+            ]);
407
+            $table->setPrimaryKey(['id']);
408
+            $table->addIndex(['item_type', 'share_type'], 'item_share_type_index');
409
+            $table->addIndex(['file_source'], 'file_source_index');
410
+            $table->addIndex(['token'], 'token_index');
411
+        }
412
+
413
+        if (!$schema->hasTable('jobs')) {
414
+            $table = $schema->createTable('jobs');
415
+            $table->addColumn('id', 'integer', [
416
+                'autoincrement' => true,
417
+                'notnull' => true,
418
+                'length' => 4,
419
+            ]);
420
+            $table->addColumn('class', 'string', [
421
+                'notnull' => true,
422
+                'length' => 255,
423
+                'default' => '',
424
+            ]);
425
+            $table->addColumn('argument', 'string', [
426
+                'notnull' => true,
427
+                'length' => 4000,
428
+                'default' => '',
429
+            ]);
430
+            $table->addColumn('last_run', 'integer', [
431
+                'notnull' => false,
432
+                'default' => 0,
433
+            ]);
434
+            $table->addColumn('last_checked', 'integer', [
435
+                'notnull' => false,
436
+                'default' => 0,
437
+            ]);
438
+            $table->addColumn('reserved_at', 'integer', [
439
+                'notnull' => false,
440
+                'default' => 0,
441
+            ]);
442
+            $table->addColumn('execution_duration', 'integer', [
443
+                'notnull' => true,
444
+                'default' => 0,
445
+            ]);
446
+            $table->setPrimaryKey(['id']);
447
+            $table->addIndex(['class'], 'job_class_index');
448
+        }
449
+
450
+        if (!$schema->hasTable('users')) {
451
+            $table = $schema->createTable('users');
452
+            $table->addColumn('uid', 'string', [
453
+                'notnull' => true,
454
+                'length' => 64,
455
+                'default' => '',
456
+            ]);
457
+            $table->addColumn('displayname', 'string', [
458
+                'notnull' => false,
459
+                'length' => 64,
460
+            ]);
461
+            $table->addColumn('password', 'string', [
462
+                'notnull' => true,
463
+                'length' => 255,
464
+                'default' => '',
465
+            ]);
466
+            $table->setPrimaryKey(['uid']);
467
+        }
468
+
469
+        if (!$schema->hasTable('authtoken')) {
470
+            $table = $schema->createTable('authtoken');
471
+            $table->addColumn('id', 'integer', [
472
+                'autoincrement' => true,
473
+                'notnull' => true,
474
+                'length' => 4,
475
+            ]);
476
+            $table->addColumn('uid', 'string', [
477
+                'notnull' => true,
478
+                'length' => 64,
479
+                'default' => '',
480
+            ]);
481
+            $table->addColumn('login_name', 'string', [
482
+                'notnull' => true,
483
+                'length' => 64,
484
+                'default' => '',
485
+            ]);
486
+            $table->addColumn('password', 'text', [
487
+                'notnull' => false,
488
+            ]);
489
+            $table->addColumn('name', 'text', [
490
+                'notnull' => true,
491
+                'default' => '',
492
+            ]);
493
+            $table->addColumn('token', 'string', [
494
+                'notnull' => true,
495
+                'length' => 200,
496
+                'default' => '',
497
+            ]);
498
+            $table->addColumn('type', 'smallint', [
499
+                'notnull' => true,
500
+                'length' => 2,
501
+                'default' => 0,
502
+            ]);
503
+            $table->addColumn('remember', 'smallint', [
504
+                'notnull' => true,
505
+                'length' => 1,
506
+                'default' => 0,
507
+            ]);
508
+            $table->addColumn('last_activity', 'integer', [
509
+                'notnull' => true,
510
+                'length' => 4,
511
+                'default' => 0,
512
+            ]);
513
+            $table->addColumn('last_check', 'integer', [
514
+                'notnull' => true,
515
+                'length' => 4,
516
+                'default' => 0,
517
+            ]);
518
+            $table->addColumn('scope', 'text', [
519
+                'notnull' => false,
520
+            ]);
521
+            $table->setPrimaryKey(['id']);
522
+            $table->addUniqueIndex(['token'], 'authtoken_token_index');
523
+            $table->addIndex(['last_activity'], 'authtoken_last_activity_index');
524
+        }
525
+
526
+        if (!$schema->hasTable('bruteforce_attempts')) {
527
+            $table = $schema->createTable('bruteforce_attempts');
528
+            $table->addColumn('id', 'integer', [
529
+                'autoincrement' => true,
530
+                'notnull' => true,
531
+                'length' => 4,
532
+            ]);
533
+            $table->addColumn('action', 'string', [
534
+                'notnull' => true,
535
+                'length' => 64,
536
+                'default' => '',
537
+            ]);
538
+            $table->addColumn('occurred', 'integer', [
539
+                'notnull' => true,
540
+                'length' => 4,
541
+                'default' => 0,
542
+            ]);
543
+            $table->addColumn('ip', 'string', [
544
+                'notnull' => true,
545
+                'length' => 255,
546
+                'default' => '',
547
+            ]);
548
+            $table->addColumn('subnet', 'string', [
549
+                'notnull' => true,
550
+                'length' => 255,
551
+                'default' => '',
552
+            ]);
553
+            $table->addColumn('metadata', 'string', [
554
+                'notnull' => true,
555
+                'length' => 255,
556
+                'default' => '',
557
+            ]);
558
+            $table->setPrimaryKey(['id']);
559
+            $table->addIndex(['ip'], 'bruteforce_attempts_ip');
560
+            $table->addIndex(['subnet'], 'bruteforce_attempts_subnet');
561
+        }
562
+
563
+        if (!$schema->hasTable('vcategory')) {
564
+            $table = $schema->createTable('vcategory');
565
+            $table->addColumn('id', 'integer', [
566
+                'autoincrement' => true,
567
+                'notnull' => true,
568
+                'length' => 4,
569
+            ]);
570
+            $table->addColumn('uid', 'string', [
571
+                'notnull' => true,
572
+                'length' => 64,
573
+                'default' => '',
574
+            ]);
575
+            $table->addColumn('type', 'string', [
576
+                'notnull' => true,
577
+                'length' => 64,
578
+                'default' => '',
579
+            ]);
580
+            $table->addColumn('category', 'string', [
581
+                'notnull' => true,
582
+                'length' => 255,
583
+                'default' => '',
584
+            ]);
585
+            $table->setPrimaryKey(['id']);
586
+            $table->addIndex(['uid'], 'uid_index');
587
+            $table->addIndex(['type'], 'type_index');
588
+            $table->addIndex(['category'], 'category_index');
589
+        }
590
+
591
+        if (!$schema->hasTable('vcategory_to_object')) {
592
+            $table = $schema->createTable('vcategory_to_object');
593
+            $table->addColumn('objid', 'integer', [
594
+                'notnull' => true,
595
+                'length' => 4,
596
+                'default' => 0,
597
+            ]);
598
+            $table->addColumn('categoryid', 'integer', [
599
+                'notnull' => true,
600
+                'length' => 4,
601
+                'default' => 0,
602
+            ]);
603
+            $table->addColumn('type', 'string', [
604
+                'notnull' => true,
605
+                'length' => 64,
606
+                'default' => '',
607
+            ]);
608
+            $table->setPrimaryKey(['categoryid', 'objid', 'type']);
609
+            $table->addIndex(['objid', 'type'], 'vcategory_objectd_index');
610
+        }
611
+
612
+        if (!$schema->hasTable('systemtag')) {
613
+            $table = $schema->createTable('systemtag');
614
+            $table->addColumn('id', 'integer', [
615
+                'autoincrement' => true,
616
+                'notnull' => true,
617
+                'length' => 4,
618
+            ]);
619
+            $table->addColumn('name', 'string', [
620
+                'notnull' => true,
621
+                'length' => 64,
622
+                'default' => '',
623
+            ]);
624
+            $table->addColumn('visibility', 'smallint', [
625
+                'notnull' => true,
626
+                'length' => 1,
627
+                'default' => 1,
628
+            ]);
629
+            $table->addColumn('editable', 'smallint', [
630
+                'notnull' => true,
631
+                'length' => 1,
632
+                'default' => 1,
633
+            ]);
634
+            $table->setPrimaryKey(['id']);
635
+            $table->addUniqueIndex(['name', 'visibility', 'editable'], 'tag_ident');
636
+        }
637
+
638
+        if (!$schema->hasTable('systemtag_object_mapping')) {
639
+            $table = $schema->createTable('systemtag_object_mapping');
640
+            $table->addColumn('objectid', 'string', [
641
+                'notnull' => true,
642
+                'length' => 64,
643
+                'default' => '',
644
+            ]);
645
+            $table->addColumn('objecttype', 'string', [
646
+                'notnull' => true,
647
+                'length' => 64,
648
+                'default' => '',
649
+            ]);
650
+            $table->addColumn('systemtagid', 'integer', [
651
+                'notnull' => true,
652
+                'length' => 4,
653
+                'default' => 0,
654
+            ]);
655
+            $table->addUniqueIndex(['objecttype', 'objectid', 'systemtagid'], 'mapping');
656
+        }
657
+
658
+        if (!$schema->hasTable('systemtag_group')) {
659
+            $table = $schema->createTable('systemtag_group');
660
+            $table->addColumn('systemtagid', 'integer', [
661
+                'notnull' => true,
662
+                'length' => 4,
663
+                'default' => 0,
664
+            ]);
665
+            $table->addColumn('gid', 'string', [
666
+                'notnull' => true,
667
+            ]);
668
+            $table->setPrimaryKey(['gid', 'systemtagid']);
669
+        }
670
+
671
+        if (!$schema->hasTable('file_locks')) {
672
+            $table = $schema->createTable('file_locks');
673
+            $table->addColumn('id', 'integer', [
674
+                'autoincrement' => true,
675
+                'notnull' => true,
676
+                'length' => 4,
677
+            ]);
678
+            $table->addColumn('lock', 'integer', [
679
+                'notnull' => true,
680
+                'length' => 4,
681
+                'default' => 0,
682
+            ]);
683
+            $table->addColumn('key', 'string', [
684
+                'notnull' => true,
685
+                'length' => 64,
686
+            ]);
687
+            $table->addColumn('ttl', 'integer', [
688
+                'notnull' => true,
689
+                'length' => 4,
690
+                'default' => -1,
691
+            ]);
692
+            $table->setPrimaryKey(['id']);
693
+            $table->addUniqueIndex(['key'], 'lock_key_index');
694
+            $table->addIndex(['ttl'], 'lock_ttl_index');
695
+        }
696
+
697
+        if (!$schema->hasTable('comments')) {
698
+            $table = $schema->createTable('comments');
699
+            $table->addColumn('id', 'integer', [
700
+                'autoincrement' => true,
701
+                'notnull' => true,
702
+                'length' => 4,
703
+            ]);
704
+            $table->addColumn('parent_id', 'integer', [
705
+                'notnull' => true,
706
+                'length' => 4,
707
+                'default' => 0,
708
+            ]);
709
+            $table->addColumn('topmost_parent_id', 'integer', [
710
+                'notnull' => true,
711
+                'length' => 4,
712
+                'default' => 0,
713
+            ]);
714
+            $table->addColumn('children_count', 'integer', [
715
+                'notnull' => true,
716
+                'length' => 4,
717
+                'default' => 0,
718
+            ]);
719
+            $table->addColumn('actor_type', 'string', [
720
+                'notnull' => true,
721
+                'length' => 64,
722
+                'default' => '',
723
+            ]);
724
+            $table->addColumn('actor_id', 'string', [
725
+                'notnull' => true,
726
+                'length' => 64,
727
+                'default' => '',
728
+            ]);
729
+            $table->addColumn('message', 'text', [
730
+                'notnull' => false,
731
+            ]);
732
+            $table->addColumn('verb', 'string', [
733
+                'notnull' => false,
734
+                'length' => 64,
735
+            ]);
736
+            $table->addColumn('creation_timestamp', 'datetime', [
737
+                'notnull' => false,
738
+            ]);
739
+            $table->addColumn('latest_child_timestamp', 'datetime', [
740
+                'notnull' => false,
741
+            ]);
742
+            $table->addColumn('object_type', 'string', [
743
+                'notnull' => true,
744
+                'length' => 64,
745
+                'default' => '',
746
+            ]);
747
+            $table->addColumn('object_id', 'string', [
748
+                'notnull' => true,
749
+                'length' => 64,
750
+                'default' => '',
751
+            ]);
752
+            $table->setPrimaryKey(['id']);
753
+            $table->addIndex(['parent_id'], 'comments_parent_id_index');
754
+            $table->addIndex(['topmost_parent_id'], 'comments_topmost_parent_id_idx');
755
+            $table->addIndex(['object_type', 'object_id', 'creation_timestamp'], 'comments_object_index');
756
+            $table->addIndex(['actor_type', 'actor_id'], 'comments_actor_index');
757
+        }
758
+
759
+        if (!$schema->hasTable('comments_read_markers')) {
760
+            $table = $schema->createTable('comments_read_markers');
761
+            $table->addColumn('user_id', 'string', [
762
+                'notnull' => true,
763
+                'length' => 64,
764
+                'default' => '',
765
+            ]);
766
+            $table->addColumn('marker_datetime', 'datetime', [
767
+                'notnull' => false,
768
+            ]);
769
+            $table->addColumn('object_type', 'string', [
770
+                'notnull' => true,
771
+                'length' => 64,
772
+                'default' => '',
773
+            ]);
774
+            $table->addColumn('object_id', 'string', [
775
+                'notnull' => true,
776
+                'length' => 64,
777
+                'default' => '',
778
+            ]);
779
+            $table->addIndex(['object_type', 'object_id'], 'comments_marker_object_index');
780
+            $table->addUniqueIndex(['user_id', 'object_type', 'object_id'], 'comments_marker_index');
781
+        }
782
+
783
+        if (!$schema->hasTable('credentials')) {
784
+            $table = $schema->createTable('credentials');
785
+            $table->addColumn('user', 'string', [
786
+                'notnull' => true,
787
+                'length' => 64,
788
+            ]);
789
+            $table->addColumn('identifier', 'string', [
790
+                'notnull' => true,
791
+                'length' => 64,
792
+            ]);
793
+            $table->addColumn('credentials', 'text', [
794
+                'notnull' => false,
795
+            ]);
796
+            $table->setPrimaryKey(['user', 'identifier']);
797
+            $table->addIndex(['user'], 'credentials_user');
798
+        }
799
+
800
+        if (!$schema->hasTable('admin_sections')) {
801
+            $table = $schema->createTable('admin_sections');
802
+            $table->addColumn('id', 'string', [
803
+                'notnull' => true,
804
+                'length' => 64,
805
+            ]);
806
+            $table->addColumn('class', 'string', [
807
+                'notnull' => true,
808
+                'length' => 255,
809
+                'default' => '',
810
+            ]);
811
+            $table->addColumn('priority', 'smallint', [
812
+                'notnull' => true,
813
+                'length' => 1,
814
+                'default' => 0,
815
+            ]);
816
+            $table->setPrimaryKey(['id']);
817
+            $table->addUniqueIndex(['class'], 'admin_sections_class');
818
+        }
819
+
820
+        if (!$schema->hasTable('admin_settings')) {
821
+            $table = $schema->createTable('admin_settings');
822
+            $table->addColumn('id', 'integer', [
823
+                'autoincrement' => true,
824
+                'notnull' => true,
825
+                'length' => 4,
826
+            ]);
827
+            $table->addColumn('class', 'string', [
828
+                'notnull' => true,
829
+                'length' => 255,
830
+                'default' => '',
831
+            ]);
832
+            $table->addColumn('section', 'string', [
833
+                'notnull' => false,
834
+                'length' => 64,
835
+            ]);
836
+            $table->addColumn('priority', 'smallint', [
837
+                'notnull' => true,
838
+                'length' => 1,
839
+                'default' => 0,
840
+            ]);
841
+            $table->setPrimaryKey(['id']);
842
+            $table->addUniqueIndex(['class'], 'admin_settings_class');
843
+            $table->addIndex(['section'], 'admin_settings_section');
844
+        }
845
+
846
+        if (!$schema->hasTable('personal_sections')) {
847
+            $table = $schema->createTable('personal_sections');
848
+            $table->addColumn('id', 'string', [
849
+                'notnull' => true,
850
+                'length' => 64,
851
+            ]);
852
+            $table->addColumn('class', 'string', [
853
+                'notnull' => true,
854
+                'length' => 255,
855
+                'default' => '',
856
+            ]);
857
+            $table->addColumn('priority', 'smallint', [
858
+                'notnull' => true,
859
+                'length' => 1,
860
+                'default' => 0,
861
+            ]);
862
+            $table->setPrimaryKey(['id']);
863
+            $table->addUniqueIndex(['class'], 'personal_sections_class');
864
+        }
865
+
866
+        if (!$schema->hasTable('personal_settings')) {
867
+            $table = $schema->createTable('personal_settings');
868
+            $table->addColumn('id', 'integer', [
869
+                'autoincrement' => true,
870
+                'notnull' => true,
871
+                'length' => 4,
872
+            ]);
873
+            $table->addColumn('class', 'string', [
874
+                'notnull' => true,
875
+                'length' => 255,
876
+                'default' => '',
877
+            ]);
878
+            $table->addColumn('section', 'string', [
879
+                'notnull' => false,
880
+                'length' => 64,
881
+            ]);
882
+            $table->addColumn('priority', 'smallint', [
883
+                'notnull' => true,
884
+                'length' => 1,
885
+                'default' => 0,
886
+            ]);
887
+            $table->setPrimaryKey(['id']);
888
+            $table->addUniqueIndex(['class'], 'personal_settings_class');
889
+            $table->addIndex(['section'], 'personal_settings_section');
890
+        }
891
+
892
+        if (!$schema->hasTable('accounts')) {
893
+            $table = $schema->createTable('accounts');
894
+            $table->addColumn('uid', 'string', [
895
+                'notnull' => true,
896
+                'length' => 64,
897
+                'default' => '',
898
+            ]);
899
+            $table->addColumn('data', 'text', [
900
+                'notnull' => true,
901
+                'default' => '',
902
+            ]);
903
+            $table->setPrimaryKey(['uid']);
904
+        }
905
+        return $schema;
906
+    }
907
+
908
+    /**
909
+     * @param IOutput $output
910
+     * @param \Closure $schemaClosure The `\Closure` returns a `Schema`
911
+     * @param array $options
912
+     * @since 13.0.0
913
+     */
914
+    public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
915
+    }
916 916
 }
Please login to merge, or discard this patch.