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