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