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