@@ -37,850 +37,850 @@ discard block |
||
37 | 37 | |
38 | 38 | class Version13000Date20170718121200 extends SimpleMigrationStep { |
39 | 39 | |
40 | - /** @var IDBConnection */ |
|
41 | - private $connection; |
|
40 | + /** @var IDBConnection */ |
|
41 | + private $connection; |
|
42 | 42 | |
43 | - public function __construct(IDBConnection $connection) { |
|
44 | - $this->connection = $connection; |
|
45 | - } |
|
43 | + public function __construct(IDBConnection $connection) { |
|
44 | + $this->connection = $connection; |
|
45 | + } |
|
46 | 46 | |
47 | - public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { |
|
48 | - /** @var ISchemaWrapper $schema */ |
|
49 | - $schema = $schemaClosure(); |
|
47 | + public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { |
|
48 | + /** @var ISchemaWrapper $schema */ |
|
49 | + $schema = $schemaClosure(); |
|
50 | 50 | |
51 | - if (!$schema->hasTable('properties')) { |
|
52 | - return; |
|
53 | - } |
|
54 | - // in case we have a properties table from oc we drop it since we will only migrate |
|
55 | - // the dav_properties values in the postSchemaChange step |
|
56 | - $table = $schema->getTable('properties'); |
|
57 | - if ($table->hasColumn('fileid')) { |
|
58 | - $qb = $this->connection->getQueryBuilder(); |
|
59 | - $qb->delete('properties'); |
|
60 | - $qb->execute(); |
|
61 | - } |
|
62 | - } |
|
51 | + if (!$schema->hasTable('properties')) { |
|
52 | + return; |
|
53 | + } |
|
54 | + // in case we have a properties table from oc we drop it since we will only migrate |
|
55 | + // the dav_properties values in the postSchemaChange step |
|
56 | + $table = $schema->getTable('properties'); |
|
57 | + if ($table->hasColumn('fileid')) { |
|
58 | + $qb = $this->connection->getQueryBuilder(); |
|
59 | + $qb->delete('properties'); |
|
60 | + $qb->execute(); |
|
61 | + } |
|
62 | + } |
|
63 | 63 | |
64 | 64 | |
65 | - /** |
|
66 | - * @param IOutput $output |
|
67 | - * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
68 | - * @param array $options |
|
69 | - * @return null|ISchemaWrapper |
|
70 | - * @since 13.0.0 |
|
71 | - */ |
|
72 | - public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
|
73 | - /** @var ISchemaWrapper $schema */ |
|
74 | - $schema = $schemaClosure(); |
|
65 | + /** |
|
66 | + * @param IOutput $output |
|
67 | + * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
68 | + * @param array $options |
|
69 | + * @return null|ISchemaWrapper |
|
70 | + * @since 13.0.0 |
|
71 | + */ |
|
72 | + public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
|
73 | + /** @var ISchemaWrapper $schema */ |
|
74 | + $schema = $schemaClosure(); |
|
75 | 75 | |
76 | - if (!$schema->hasTable('appconfig')) { |
|
77 | - $table = $schema->createTable('appconfig'); |
|
78 | - $table->addColumn('appid', 'string', [ |
|
79 | - 'notnull' => true, |
|
80 | - 'length' => 32, |
|
81 | - 'default' => '', |
|
82 | - ]); |
|
83 | - $table->addColumn('configkey', 'string', [ |
|
84 | - 'notnull' => true, |
|
85 | - 'length' => 64, |
|
86 | - 'default' => '', |
|
87 | - ]); |
|
88 | - $table->addColumn('configvalue', 'text', [ |
|
89 | - 'notnull' => false, |
|
90 | - ]); |
|
91 | - $table->setPrimaryKey(['appid', 'configkey']); |
|
92 | - $table->addIndex(['configkey'], 'appconfig_config_key_index'); |
|
93 | - $table->addIndex(['appid'], 'appconfig_appid_key'); |
|
94 | - } |
|
76 | + if (!$schema->hasTable('appconfig')) { |
|
77 | + $table = $schema->createTable('appconfig'); |
|
78 | + $table->addColumn('appid', 'string', [ |
|
79 | + 'notnull' => true, |
|
80 | + 'length' => 32, |
|
81 | + 'default' => '', |
|
82 | + ]); |
|
83 | + $table->addColumn('configkey', 'string', [ |
|
84 | + 'notnull' => true, |
|
85 | + 'length' => 64, |
|
86 | + 'default' => '', |
|
87 | + ]); |
|
88 | + $table->addColumn('configvalue', 'text', [ |
|
89 | + 'notnull' => false, |
|
90 | + ]); |
|
91 | + $table->setPrimaryKey(['appid', 'configkey']); |
|
92 | + $table->addIndex(['configkey'], 'appconfig_config_key_index'); |
|
93 | + $table->addIndex(['appid'], 'appconfig_appid_key'); |
|
94 | + } |
|
95 | 95 | |
96 | - if (!$schema->hasTable('storages')) { |
|
97 | - $table = $schema->createTable('storages'); |
|
98 | - $table->addColumn('id', 'string', [ |
|
99 | - 'notnull' => false, |
|
100 | - 'length' => 64, |
|
101 | - ]); |
|
102 | - $table->addColumn('numeric_id', Types::BIGINT, [ |
|
103 | - 'autoincrement' => true, |
|
104 | - 'notnull' => true, |
|
105 | - 'length' => 20, |
|
106 | - ]); |
|
107 | - $table->addColumn('available', 'integer', [ |
|
108 | - 'notnull' => true, |
|
109 | - 'default' => 1, |
|
110 | - ]); |
|
111 | - $table->addColumn('last_checked', 'integer', [ |
|
112 | - 'notnull' => false, |
|
113 | - ]); |
|
114 | - $table->setPrimaryKey(['numeric_id']); |
|
115 | - $table->addUniqueIndex(['id'], 'storages_id_index'); |
|
116 | - } |
|
96 | + if (!$schema->hasTable('storages')) { |
|
97 | + $table = $schema->createTable('storages'); |
|
98 | + $table->addColumn('id', 'string', [ |
|
99 | + 'notnull' => false, |
|
100 | + 'length' => 64, |
|
101 | + ]); |
|
102 | + $table->addColumn('numeric_id', Types::BIGINT, [ |
|
103 | + 'autoincrement' => true, |
|
104 | + 'notnull' => true, |
|
105 | + 'length' => 20, |
|
106 | + ]); |
|
107 | + $table->addColumn('available', 'integer', [ |
|
108 | + 'notnull' => true, |
|
109 | + 'default' => 1, |
|
110 | + ]); |
|
111 | + $table->addColumn('last_checked', 'integer', [ |
|
112 | + 'notnull' => false, |
|
113 | + ]); |
|
114 | + $table->setPrimaryKey(['numeric_id']); |
|
115 | + $table->addUniqueIndex(['id'], 'storages_id_index'); |
|
116 | + } |
|
117 | 117 | |
118 | - if (!$schema->hasTable('mounts')) { |
|
119 | - $table = $schema->createTable('mounts'); |
|
120 | - $table->addColumn('id', 'integer', [ |
|
121 | - 'autoincrement' => true, |
|
122 | - 'notnull' => true, |
|
123 | - 'length' => 4, |
|
124 | - ]); |
|
125 | - $table->addColumn('storage_id', Types::BIGINT, [ |
|
126 | - 'notnull' => true, |
|
127 | - 'length' => 20, |
|
128 | - ]); |
|
129 | - $table->addColumn('root_id', Types::BIGINT, [ |
|
130 | - 'notnull' => true, |
|
131 | - 'length' => 20, |
|
132 | - ]); |
|
133 | - $table->addColumn('user_id', 'string', [ |
|
134 | - 'notnull' => true, |
|
135 | - 'length' => 64, |
|
136 | - ]); |
|
137 | - $table->addColumn('mount_point', 'string', [ |
|
138 | - 'notnull' => true, |
|
139 | - 'length' => 4000, |
|
140 | - ]); |
|
141 | - $table->addColumn('mount_id', Types::BIGINT, [ |
|
142 | - 'notnull' => false, |
|
143 | - 'length' => 20, |
|
144 | - ]); |
|
145 | - $table->setPrimaryKey(['id']); |
|
146 | - $table->addIndex(['user_id'], 'mounts_user_index'); |
|
147 | - $table->addIndex(['storage_id'], 'mounts_storage_index'); |
|
148 | - $table->addIndex(['root_id'], 'mounts_root_index'); |
|
149 | - $table->addIndex(['mount_id'], 'mounts_mount_id_index'); |
|
150 | - $table->addUniqueIndex(['user_id', 'root_id'], 'mounts_user_root_index'); |
|
151 | - } else { |
|
152 | - $table = $schema->getTable('mounts'); |
|
153 | - $table->addColumn('mount_id', Types::BIGINT, [ |
|
154 | - 'notnull' => false, |
|
155 | - 'length' => 20, |
|
156 | - ]); |
|
157 | - if (!$table->hasIndex('mounts_mount_id_index')) { |
|
158 | - $table->addIndex(['mount_id'], 'mounts_mount_id_index'); |
|
159 | - } |
|
160 | - } |
|
118 | + if (!$schema->hasTable('mounts')) { |
|
119 | + $table = $schema->createTable('mounts'); |
|
120 | + $table->addColumn('id', 'integer', [ |
|
121 | + 'autoincrement' => true, |
|
122 | + 'notnull' => true, |
|
123 | + 'length' => 4, |
|
124 | + ]); |
|
125 | + $table->addColumn('storage_id', Types::BIGINT, [ |
|
126 | + 'notnull' => true, |
|
127 | + 'length' => 20, |
|
128 | + ]); |
|
129 | + $table->addColumn('root_id', Types::BIGINT, [ |
|
130 | + 'notnull' => true, |
|
131 | + 'length' => 20, |
|
132 | + ]); |
|
133 | + $table->addColumn('user_id', 'string', [ |
|
134 | + 'notnull' => true, |
|
135 | + 'length' => 64, |
|
136 | + ]); |
|
137 | + $table->addColumn('mount_point', 'string', [ |
|
138 | + 'notnull' => true, |
|
139 | + 'length' => 4000, |
|
140 | + ]); |
|
141 | + $table->addColumn('mount_id', Types::BIGINT, [ |
|
142 | + 'notnull' => false, |
|
143 | + 'length' => 20, |
|
144 | + ]); |
|
145 | + $table->setPrimaryKey(['id']); |
|
146 | + $table->addIndex(['user_id'], 'mounts_user_index'); |
|
147 | + $table->addIndex(['storage_id'], 'mounts_storage_index'); |
|
148 | + $table->addIndex(['root_id'], 'mounts_root_index'); |
|
149 | + $table->addIndex(['mount_id'], 'mounts_mount_id_index'); |
|
150 | + $table->addUniqueIndex(['user_id', 'root_id'], 'mounts_user_root_index'); |
|
151 | + } else { |
|
152 | + $table = $schema->getTable('mounts'); |
|
153 | + $table->addColumn('mount_id', Types::BIGINT, [ |
|
154 | + 'notnull' => false, |
|
155 | + 'length' => 20, |
|
156 | + ]); |
|
157 | + if (!$table->hasIndex('mounts_mount_id_index')) { |
|
158 | + $table->addIndex(['mount_id'], 'mounts_mount_id_index'); |
|
159 | + } |
|
160 | + } |
|
161 | 161 | |
162 | - if (!$schema->hasTable('mimetypes')) { |
|
163 | - $table = $schema->createTable('mimetypes'); |
|
164 | - $table->addColumn('id', Types::BIGINT, [ |
|
165 | - 'autoincrement' => true, |
|
166 | - 'notnull' => true, |
|
167 | - 'length' => 20, |
|
168 | - ]); |
|
169 | - $table->addColumn('mimetype', 'string', [ |
|
170 | - 'notnull' => true, |
|
171 | - 'length' => 255, |
|
172 | - 'default' => '', |
|
173 | - ]); |
|
174 | - $table->setPrimaryKey(['id']); |
|
175 | - $table->addUniqueIndex(['mimetype'], 'mimetype_id_index'); |
|
176 | - } |
|
162 | + if (!$schema->hasTable('mimetypes')) { |
|
163 | + $table = $schema->createTable('mimetypes'); |
|
164 | + $table->addColumn('id', Types::BIGINT, [ |
|
165 | + 'autoincrement' => true, |
|
166 | + 'notnull' => true, |
|
167 | + 'length' => 20, |
|
168 | + ]); |
|
169 | + $table->addColumn('mimetype', 'string', [ |
|
170 | + 'notnull' => true, |
|
171 | + 'length' => 255, |
|
172 | + 'default' => '', |
|
173 | + ]); |
|
174 | + $table->setPrimaryKey(['id']); |
|
175 | + $table->addUniqueIndex(['mimetype'], 'mimetype_id_index'); |
|
176 | + } |
|
177 | 177 | |
178 | - if (!$schema->hasTable('filecache')) { |
|
179 | - $table = $schema->createTable('filecache'); |
|
180 | - $table->addColumn('fileid', Types::BIGINT, [ |
|
181 | - 'autoincrement' => true, |
|
182 | - 'notnull' => true, |
|
183 | - 'length' => 20, |
|
184 | - ]); |
|
185 | - $table->addColumn('storage', Types::BIGINT, [ |
|
186 | - 'notnull' => true, |
|
187 | - 'length' => 20, |
|
188 | - 'default' => 0, |
|
189 | - ]); |
|
190 | - $table->addColumn('path', 'string', [ |
|
191 | - 'notnull' => false, |
|
192 | - 'length' => 4000, |
|
193 | - ]); |
|
194 | - $table->addColumn('path_hash', 'string', [ |
|
195 | - 'notnull' => true, |
|
196 | - 'length' => 32, |
|
197 | - 'default' => '', |
|
198 | - ]); |
|
199 | - $table->addColumn('parent', Types::BIGINT, [ |
|
200 | - 'notnull' => true, |
|
201 | - 'length' => 20, |
|
202 | - 'default' => 0, |
|
203 | - ]); |
|
204 | - $table->addColumn('name', 'string', [ |
|
205 | - 'notnull' => false, |
|
206 | - 'length' => 250, |
|
207 | - ]); |
|
208 | - $table->addColumn('mimetype', Types::BIGINT, [ |
|
209 | - 'notnull' => true, |
|
210 | - 'length' => 20, |
|
211 | - 'default' => 0, |
|
212 | - ]); |
|
213 | - $table->addColumn('mimepart', Types::BIGINT, [ |
|
214 | - 'notnull' => true, |
|
215 | - 'length' => 20, |
|
216 | - 'default' => 0, |
|
217 | - ]); |
|
218 | - $table->addColumn('size', 'bigint', [ |
|
219 | - 'notnull' => true, |
|
220 | - 'length' => 8, |
|
221 | - 'default' => 0, |
|
222 | - ]); |
|
223 | - $table->addColumn('mtime', Types::BIGINT, [ |
|
224 | - 'notnull' => true, |
|
225 | - 'length' => 20, |
|
226 | - 'default' => 0, |
|
227 | - ]); |
|
228 | - $table->addColumn('storage_mtime', Types::BIGINT, [ |
|
229 | - 'notnull' => true, |
|
230 | - 'length' => 20, |
|
231 | - 'default' => 0, |
|
232 | - ]); |
|
233 | - $table->addColumn('encrypted', 'integer', [ |
|
234 | - 'notnull' => true, |
|
235 | - 'length' => 4, |
|
236 | - 'default' => 0, |
|
237 | - ]); |
|
238 | - $table->addColumn('unencrypted_size', 'bigint', [ |
|
239 | - 'notnull' => true, |
|
240 | - 'length' => 8, |
|
241 | - 'default' => 0, |
|
242 | - ]); |
|
243 | - $table->addColumn('etag', 'string', [ |
|
244 | - 'notnull' => false, |
|
245 | - 'length' => 40, |
|
246 | - ]); |
|
247 | - $table->addColumn('permissions', 'integer', [ |
|
248 | - 'notnull' => false, |
|
249 | - 'length' => 4, |
|
250 | - 'default' => 0, |
|
251 | - ]); |
|
252 | - $table->addColumn('checksum', 'string', [ |
|
253 | - 'notnull' => false, |
|
254 | - 'length' => 255, |
|
255 | - ]); |
|
256 | - $table->setPrimaryKey(['fileid']); |
|
257 | - $table->addUniqueIndex(['storage', 'path_hash'], 'fs_storage_path_hash'); |
|
258 | - $table->addIndex(['parent', 'name'], 'fs_parent_name_hash'); |
|
259 | - $table->addIndex(['storage', 'mimetype'], 'fs_storage_mimetype'); |
|
260 | - $table->addIndex(['storage', 'mimepart'], 'fs_storage_mimepart'); |
|
261 | - $table->addIndex(['storage', 'size', 'fileid'], 'fs_storage_size'); |
|
262 | - $table->addIndex(['mtime'], 'fs_mtime'); |
|
263 | - $table->addIndex(['size'], 'fs_size'); |
|
264 | - } |
|
178 | + if (!$schema->hasTable('filecache')) { |
|
179 | + $table = $schema->createTable('filecache'); |
|
180 | + $table->addColumn('fileid', Types::BIGINT, [ |
|
181 | + 'autoincrement' => true, |
|
182 | + 'notnull' => true, |
|
183 | + 'length' => 20, |
|
184 | + ]); |
|
185 | + $table->addColumn('storage', Types::BIGINT, [ |
|
186 | + 'notnull' => true, |
|
187 | + 'length' => 20, |
|
188 | + 'default' => 0, |
|
189 | + ]); |
|
190 | + $table->addColumn('path', 'string', [ |
|
191 | + 'notnull' => false, |
|
192 | + 'length' => 4000, |
|
193 | + ]); |
|
194 | + $table->addColumn('path_hash', 'string', [ |
|
195 | + 'notnull' => true, |
|
196 | + 'length' => 32, |
|
197 | + 'default' => '', |
|
198 | + ]); |
|
199 | + $table->addColumn('parent', Types::BIGINT, [ |
|
200 | + 'notnull' => true, |
|
201 | + 'length' => 20, |
|
202 | + 'default' => 0, |
|
203 | + ]); |
|
204 | + $table->addColumn('name', 'string', [ |
|
205 | + 'notnull' => false, |
|
206 | + 'length' => 250, |
|
207 | + ]); |
|
208 | + $table->addColumn('mimetype', Types::BIGINT, [ |
|
209 | + 'notnull' => true, |
|
210 | + 'length' => 20, |
|
211 | + 'default' => 0, |
|
212 | + ]); |
|
213 | + $table->addColumn('mimepart', Types::BIGINT, [ |
|
214 | + 'notnull' => true, |
|
215 | + 'length' => 20, |
|
216 | + 'default' => 0, |
|
217 | + ]); |
|
218 | + $table->addColumn('size', 'bigint', [ |
|
219 | + 'notnull' => true, |
|
220 | + 'length' => 8, |
|
221 | + 'default' => 0, |
|
222 | + ]); |
|
223 | + $table->addColumn('mtime', Types::BIGINT, [ |
|
224 | + 'notnull' => true, |
|
225 | + 'length' => 20, |
|
226 | + 'default' => 0, |
|
227 | + ]); |
|
228 | + $table->addColumn('storage_mtime', Types::BIGINT, [ |
|
229 | + 'notnull' => true, |
|
230 | + 'length' => 20, |
|
231 | + 'default' => 0, |
|
232 | + ]); |
|
233 | + $table->addColumn('encrypted', 'integer', [ |
|
234 | + 'notnull' => true, |
|
235 | + 'length' => 4, |
|
236 | + 'default' => 0, |
|
237 | + ]); |
|
238 | + $table->addColumn('unencrypted_size', 'bigint', [ |
|
239 | + 'notnull' => true, |
|
240 | + 'length' => 8, |
|
241 | + 'default' => 0, |
|
242 | + ]); |
|
243 | + $table->addColumn('etag', 'string', [ |
|
244 | + 'notnull' => false, |
|
245 | + 'length' => 40, |
|
246 | + ]); |
|
247 | + $table->addColumn('permissions', 'integer', [ |
|
248 | + 'notnull' => false, |
|
249 | + 'length' => 4, |
|
250 | + 'default' => 0, |
|
251 | + ]); |
|
252 | + $table->addColumn('checksum', 'string', [ |
|
253 | + 'notnull' => false, |
|
254 | + 'length' => 255, |
|
255 | + ]); |
|
256 | + $table->setPrimaryKey(['fileid']); |
|
257 | + $table->addUniqueIndex(['storage', 'path_hash'], 'fs_storage_path_hash'); |
|
258 | + $table->addIndex(['parent', 'name'], 'fs_parent_name_hash'); |
|
259 | + $table->addIndex(['storage', 'mimetype'], 'fs_storage_mimetype'); |
|
260 | + $table->addIndex(['storage', 'mimepart'], 'fs_storage_mimepart'); |
|
261 | + $table->addIndex(['storage', 'size', 'fileid'], 'fs_storage_size'); |
|
262 | + $table->addIndex(['mtime'], 'fs_mtime'); |
|
263 | + $table->addIndex(['size'], 'fs_size'); |
|
264 | + } |
|
265 | 265 | |
266 | - if (!$schema->hasTable('group_user')) { |
|
267 | - $table = $schema->createTable('group_user'); |
|
268 | - $table->addColumn('gid', 'string', [ |
|
269 | - 'notnull' => true, |
|
270 | - 'length' => 64, |
|
271 | - 'default' => '', |
|
272 | - ]); |
|
273 | - $table->addColumn('uid', 'string', [ |
|
274 | - 'notnull' => true, |
|
275 | - 'length' => 64, |
|
276 | - 'default' => '', |
|
277 | - ]); |
|
278 | - $table->setPrimaryKey(['gid', 'uid']); |
|
279 | - $table->addIndex(['uid'], 'gu_uid_index'); |
|
280 | - } |
|
266 | + if (!$schema->hasTable('group_user')) { |
|
267 | + $table = $schema->createTable('group_user'); |
|
268 | + $table->addColumn('gid', 'string', [ |
|
269 | + 'notnull' => true, |
|
270 | + 'length' => 64, |
|
271 | + 'default' => '', |
|
272 | + ]); |
|
273 | + $table->addColumn('uid', 'string', [ |
|
274 | + 'notnull' => true, |
|
275 | + 'length' => 64, |
|
276 | + 'default' => '', |
|
277 | + ]); |
|
278 | + $table->setPrimaryKey(['gid', 'uid']); |
|
279 | + $table->addIndex(['uid'], 'gu_uid_index'); |
|
280 | + } |
|
281 | 281 | |
282 | - if (!$schema->hasTable('group_admin')) { |
|
283 | - $table = $schema->createTable('group_admin'); |
|
284 | - $table->addColumn('gid', 'string', [ |
|
285 | - 'notnull' => true, |
|
286 | - 'length' => 64, |
|
287 | - 'default' => '', |
|
288 | - ]); |
|
289 | - $table->addColumn('uid', 'string', [ |
|
290 | - 'notnull' => true, |
|
291 | - 'length' => 64, |
|
292 | - 'default' => '', |
|
293 | - ]); |
|
294 | - $table->setPrimaryKey(['gid', 'uid']); |
|
295 | - $table->addIndex(['uid'], 'group_admin_uid'); |
|
296 | - } |
|
282 | + if (!$schema->hasTable('group_admin')) { |
|
283 | + $table = $schema->createTable('group_admin'); |
|
284 | + $table->addColumn('gid', 'string', [ |
|
285 | + 'notnull' => true, |
|
286 | + 'length' => 64, |
|
287 | + 'default' => '', |
|
288 | + ]); |
|
289 | + $table->addColumn('uid', 'string', [ |
|
290 | + 'notnull' => true, |
|
291 | + 'length' => 64, |
|
292 | + 'default' => '', |
|
293 | + ]); |
|
294 | + $table->setPrimaryKey(['gid', 'uid']); |
|
295 | + $table->addIndex(['uid'], 'group_admin_uid'); |
|
296 | + } |
|
297 | 297 | |
298 | - if (!$schema->hasTable('groups')) { |
|
299 | - $table = $schema->createTable('groups'); |
|
300 | - $table->addColumn('gid', 'string', [ |
|
301 | - 'notnull' => true, |
|
302 | - 'length' => 64, |
|
303 | - 'default' => '', |
|
304 | - ]); |
|
305 | - $table->setPrimaryKey(['gid']); |
|
306 | - } |
|
298 | + if (!$schema->hasTable('groups')) { |
|
299 | + $table = $schema->createTable('groups'); |
|
300 | + $table->addColumn('gid', 'string', [ |
|
301 | + 'notnull' => true, |
|
302 | + 'length' => 64, |
|
303 | + 'default' => '', |
|
304 | + ]); |
|
305 | + $table->setPrimaryKey(['gid']); |
|
306 | + } |
|
307 | 307 | |
308 | - if (!$schema->hasTable('preferences')) { |
|
309 | - $table = $schema->createTable('preferences'); |
|
310 | - $table->addColumn('userid', 'string', [ |
|
311 | - 'notnull' => true, |
|
312 | - 'length' => 64, |
|
313 | - 'default' => '', |
|
314 | - ]); |
|
315 | - $table->addColumn('appid', 'string', [ |
|
316 | - 'notnull' => true, |
|
317 | - 'length' => 32, |
|
318 | - 'default' => '', |
|
319 | - ]); |
|
320 | - $table->addColumn('configkey', 'string', [ |
|
321 | - 'notnull' => true, |
|
322 | - 'length' => 64, |
|
323 | - 'default' => '', |
|
324 | - ]); |
|
325 | - $table->addColumn('configvalue', 'text', [ |
|
326 | - 'notnull' => false, |
|
327 | - ]); |
|
328 | - $table->setPrimaryKey(['userid', 'appid', 'configkey']); |
|
329 | - } |
|
308 | + if (!$schema->hasTable('preferences')) { |
|
309 | + $table = $schema->createTable('preferences'); |
|
310 | + $table->addColumn('userid', 'string', [ |
|
311 | + 'notnull' => true, |
|
312 | + 'length' => 64, |
|
313 | + 'default' => '', |
|
314 | + ]); |
|
315 | + $table->addColumn('appid', 'string', [ |
|
316 | + 'notnull' => true, |
|
317 | + 'length' => 32, |
|
318 | + 'default' => '', |
|
319 | + ]); |
|
320 | + $table->addColumn('configkey', 'string', [ |
|
321 | + 'notnull' => true, |
|
322 | + 'length' => 64, |
|
323 | + 'default' => '', |
|
324 | + ]); |
|
325 | + $table->addColumn('configvalue', 'text', [ |
|
326 | + 'notnull' => false, |
|
327 | + ]); |
|
328 | + $table->setPrimaryKey(['userid', 'appid', 'configkey']); |
|
329 | + } |
|
330 | 330 | |
331 | - if (!$schema->hasTable('properties')) { |
|
332 | - $table = $schema->createTable('properties'); |
|
333 | - $table->addColumn('id', 'integer', [ |
|
334 | - 'autoincrement' => true, |
|
335 | - 'notnull' => true, |
|
336 | - 'length' => 4, |
|
337 | - ]); |
|
338 | - $table->addColumn('userid', 'string', [ |
|
339 | - 'notnull' => true, |
|
340 | - 'length' => 64, |
|
341 | - 'default' => '', |
|
342 | - ]); |
|
343 | - $table->addColumn('propertypath', 'string', [ |
|
344 | - 'notnull' => true, |
|
345 | - 'length' => 255, |
|
346 | - 'default' => '', |
|
347 | - ]); |
|
348 | - $table->addColumn('propertyname', 'string', [ |
|
349 | - 'notnull' => true, |
|
350 | - 'length' => 255, |
|
351 | - 'default' => '', |
|
352 | - ]); |
|
353 | - $table->addColumn('propertyvalue', 'text', [ |
|
354 | - 'notnull' => true, |
|
355 | - ]); |
|
356 | - $table->setPrimaryKey(['id']); |
|
357 | - $table->addIndex(['userid'], 'property_index'); |
|
358 | - $table->addIndex(['userid', 'propertypath'], 'properties_path_index'); |
|
359 | - } else { |
|
360 | - $table = $schema->getTable('properties'); |
|
361 | - if ($table->hasColumn('propertytype')) { |
|
362 | - $table->dropColumn('propertytype'); |
|
363 | - } |
|
364 | - if ($table->hasColumn('fileid')) { |
|
365 | - $table->dropColumn('fileid'); |
|
366 | - } |
|
367 | - if (!$table->hasColumn('propertypath')) { |
|
368 | - $table->addColumn('propertypath', 'string', [ |
|
369 | - 'notnull' => true, |
|
370 | - 'length' => 255, |
|
371 | - ]); |
|
372 | - } |
|
373 | - if (!$table->hasColumn('userid')) { |
|
374 | - $table->addColumn('userid', 'string', [ |
|
375 | - 'notnull' => false, |
|
376 | - 'length' => 64, |
|
377 | - 'default' => '', |
|
378 | - ]); |
|
379 | - } |
|
380 | - } |
|
331 | + if (!$schema->hasTable('properties')) { |
|
332 | + $table = $schema->createTable('properties'); |
|
333 | + $table->addColumn('id', 'integer', [ |
|
334 | + 'autoincrement' => true, |
|
335 | + 'notnull' => true, |
|
336 | + 'length' => 4, |
|
337 | + ]); |
|
338 | + $table->addColumn('userid', 'string', [ |
|
339 | + 'notnull' => true, |
|
340 | + 'length' => 64, |
|
341 | + 'default' => '', |
|
342 | + ]); |
|
343 | + $table->addColumn('propertypath', 'string', [ |
|
344 | + 'notnull' => true, |
|
345 | + 'length' => 255, |
|
346 | + 'default' => '', |
|
347 | + ]); |
|
348 | + $table->addColumn('propertyname', 'string', [ |
|
349 | + 'notnull' => true, |
|
350 | + 'length' => 255, |
|
351 | + 'default' => '', |
|
352 | + ]); |
|
353 | + $table->addColumn('propertyvalue', 'text', [ |
|
354 | + 'notnull' => true, |
|
355 | + ]); |
|
356 | + $table->setPrimaryKey(['id']); |
|
357 | + $table->addIndex(['userid'], 'property_index'); |
|
358 | + $table->addIndex(['userid', 'propertypath'], 'properties_path_index'); |
|
359 | + } else { |
|
360 | + $table = $schema->getTable('properties'); |
|
361 | + if ($table->hasColumn('propertytype')) { |
|
362 | + $table->dropColumn('propertytype'); |
|
363 | + } |
|
364 | + if ($table->hasColumn('fileid')) { |
|
365 | + $table->dropColumn('fileid'); |
|
366 | + } |
|
367 | + if (!$table->hasColumn('propertypath')) { |
|
368 | + $table->addColumn('propertypath', 'string', [ |
|
369 | + 'notnull' => true, |
|
370 | + 'length' => 255, |
|
371 | + ]); |
|
372 | + } |
|
373 | + if (!$table->hasColumn('userid')) { |
|
374 | + $table->addColumn('userid', 'string', [ |
|
375 | + 'notnull' => false, |
|
376 | + 'length' => 64, |
|
377 | + 'default' => '', |
|
378 | + ]); |
|
379 | + } |
|
380 | + } |
|
381 | 381 | |
382 | - if (!$schema->hasTable('share')) { |
|
383 | - $table = $schema->createTable('share'); |
|
384 | - $table->addColumn('id', 'integer', [ |
|
385 | - 'autoincrement' => true, |
|
386 | - 'notnull' => true, |
|
387 | - 'length' => 4, |
|
388 | - ]); |
|
389 | - $table->addColumn('share_type', 'smallint', [ |
|
390 | - 'notnull' => true, |
|
391 | - 'length' => 1, |
|
392 | - 'default' => 0, |
|
393 | - ]); |
|
394 | - $table->addColumn('share_with', 'string', [ |
|
395 | - 'notnull' => false, |
|
396 | - 'length' => 255, |
|
397 | - ]); |
|
398 | - $table->addColumn('password', 'string', [ |
|
399 | - 'notnull' => false, |
|
400 | - 'length' => 255, |
|
401 | - ]); |
|
402 | - $table->addColumn('uid_owner', 'string', [ |
|
403 | - 'notnull' => true, |
|
404 | - 'length' => 64, |
|
405 | - 'default' => '', |
|
406 | - ]); |
|
407 | - $table->addColumn('uid_initiator', 'string', [ |
|
408 | - 'notnull' => false, |
|
409 | - 'length' => 64, |
|
410 | - ]); |
|
411 | - $table->addColumn('parent', 'integer', [ |
|
412 | - 'notnull' => false, |
|
413 | - 'length' => 4, |
|
414 | - ]); |
|
415 | - $table->addColumn('item_type', 'string', [ |
|
416 | - 'notnull' => true, |
|
417 | - 'length' => 64, |
|
418 | - 'default' => '', |
|
419 | - ]); |
|
420 | - $table->addColumn('item_source', 'string', [ |
|
421 | - 'notnull' => false, |
|
422 | - 'length' => 255, |
|
423 | - ]); |
|
424 | - $table->addColumn('item_target', 'string', [ |
|
425 | - 'notnull' => false, |
|
426 | - 'length' => 255, |
|
427 | - ]); |
|
428 | - $table->addColumn('file_source', 'integer', [ |
|
429 | - 'notnull' => false, |
|
430 | - 'length' => 4, |
|
431 | - ]); |
|
432 | - $table->addColumn('file_target', 'string', [ |
|
433 | - 'notnull' => false, |
|
434 | - 'length' => 512, |
|
435 | - ]); |
|
436 | - $table->addColumn('permissions', 'smallint', [ |
|
437 | - 'notnull' => true, |
|
438 | - 'length' => 1, |
|
439 | - 'default' => 0, |
|
440 | - ]); |
|
441 | - $table->addColumn('stime', 'bigint', [ |
|
442 | - 'notnull' => true, |
|
443 | - 'length' => 8, |
|
444 | - 'default' => 0, |
|
445 | - ]); |
|
446 | - $table->addColumn('accepted', 'smallint', [ |
|
447 | - 'notnull' => true, |
|
448 | - 'length' => 1, |
|
449 | - 'default' => 0, |
|
450 | - ]); |
|
451 | - $table->addColumn('expiration', 'datetime', [ |
|
452 | - 'notnull' => false, |
|
453 | - ]); |
|
454 | - $table->addColumn('token', 'string', [ |
|
455 | - 'notnull' => false, |
|
456 | - 'length' => 32, |
|
457 | - ]); |
|
458 | - $table->addColumn('mail_send', 'smallint', [ |
|
459 | - 'notnull' => true, |
|
460 | - 'length' => 1, |
|
461 | - 'default' => 0, |
|
462 | - ]); |
|
463 | - $table->addColumn('share_name', 'string', [ |
|
464 | - 'notnull' => false, |
|
465 | - 'length' => 64, |
|
466 | - ]); |
|
467 | - $table->setPrimaryKey(['id']); |
|
468 | - $table->addIndex(['item_type', 'share_type'], 'item_share_type_index'); |
|
469 | - $table->addIndex(['file_source'], 'file_source_index'); |
|
470 | - $table->addIndex(['token'], 'token_index'); |
|
471 | - $table->addIndex(['share_with'], 'share_with_index'); |
|
472 | - $table->addIndex(['parent'], 'parent_index'); |
|
473 | - $table->addIndex(['uid_owner'], 'owner_index'); |
|
474 | - $table->addIndex(['uid_initiator'], 'initiator_index'); |
|
475 | - } else { |
|
476 | - $table = $schema->getTable('share'); |
|
477 | - if (!$table->hasColumn('password')) { |
|
478 | - $table->addColumn('password', 'string', [ |
|
479 | - 'notnull' => false, |
|
480 | - 'length' => 255, |
|
481 | - ]); |
|
482 | - } |
|
483 | - } |
|
382 | + if (!$schema->hasTable('share')) { |
|
383 | + $table = $schema->createTable('share'); |
|
384 | + $table->addColumn('id', 'integer', [ |
|
385 | + 'autoincrement' => true, |
|
386 | + 'notnull' => true, |
|
387 | + 'length' => 4, |
|
388 | + ]); |
|
389 | + $table->addColumn('share_type', 'smallint', [ |
|
390 | + 'notnull' => true, |
|
391 | + 'length' => 1, |
|
392 | + 'default' => 0, |
|
393 | + ]); |
|
394 | + $table->addColumn('share_with', 'string', [ |
|
395 | + 'notnull' => false, |
|
396 | + 'length' => 255, |
|
397 | + ]); |
|
398 | + $table->addColumn('password', 'string', [ |
|
399 | + 'notnull' => false, |
|
400 | + 'length' => 255, |
|
401 | + ]); |
|
402 | + $table->addColumn('uid_owner', 'string', [ |
|
403 | + 'notnull' => true, |
|
404 | + 'length' => 64, |
|
405 | + 'default' => '', |
|
406 | + ]); |
|
407 | + $table->addColumn('uid_initiator', 'string', [ |
|
408 | + 'notnull' => false, |
|
409 | + 'length' => 64, |
|
410 | + ]); |
|
411 | + $table->addColumn('parent', 'integer', [ |
|
412 | + 'notnull' => false, |
|
413 | + 'length' => 4, |
|
414 | + ]); |
|
415 | + $table->addColumn('item_type', 'string', [ |
|
416 | + 'notnull' => true, |
|
417 | + 'length' => 64, |
|
418 | + 'default' => '', |
|
419 | + ]); |
|
420 | + $table->addColumn('item_source', 'string', [ |
|
421 | + 'notnull' => false, |
|
422 | + 'length' => 255, |
|
423 | + ]); |
|
424 | + $table->addColumn('item_target', 'string', [ |
|
425 | + 'notnull' => false, |
|
426 | + 'length' => 255, |
|
427 | + ]); |
|
428 | + $table->addColumn('file_source', 'integer', [ |
|
429 | + 'notnull' => false, |
|
430 | + 'length' => 4, |
|
431 | + ]); |
|
432 | + $table->addColumn('file_target', 'string', [ |
|
433 | + 'notnull' => false, |
|
434 | + 'length' => 512, |
|
435 | + ]); |
|
436 | + $table->addColumn('permissions', 'smallint', [ |
|
437 | + 'notnull' => true, |
|
438 | + 'length' => 1, |
|
439 | + 'default' => 0, |
|
440 | + ]); |
|
441 | + $table->addColumn('stime', 'bigint', [ |
|
442 | + 'notnull' => true, |
|
443 | + 'length' => 8, |
|
444 | + 'default' => 0, |
|
445 | + ]); |
|
446 | + $table->addColumn('accepted', 'smallint', [ |
|
447 | + 'notnull' => true, |
|
448 | + 'length' => 1, |
|
449 | + 'default' => 0, |
|
450 | + ]); |
|
451 | + $table->addColumn('expiration', 'datetime', [ |
|
452 | + 'notnull' => false, |
|
453 | + ]); |
|
454 | + $table->addColumn('token', 'string', [ |
|
455 | + 'notnull' => false, |
|
456 | + 'length' => 32, |
|
457 | + ]); |
|
458 | + $table->addColumn('mail_send', 'smallint', [ |
|
459 | + 'notnull' => true, |
|
460 | + 'length' => 1, |
|
461 | + 'default' => 0, |
|
462 | + ]); |
|
463 | + $table->addColumn('share_name', 'string', [ |
|
464 | + 'notnull' => false, |
|
465 | + 'length' => 64, |
|
466 | + ]); |
|
467 | + $table->setPrimaryKey(['id']); |
|
468 | + $table->addIndex(['item_type', 'share_type'], 'item_share_type_index'); |
|
469 | + $table->addIndex(['file_source'], 'file_source_index'); |
|
470 | + $table->addIndex(['token'], 'token_index'); |
|
471 | + $table->addIndex(['share_with'], 'share_with_index'); |
|
472 | + $table->addIndex(['parent'], 'parent_index'); |
|
473 | + $table->addIndex(['uid_owner'], 'owner_index'); |
|
474 | + $table->addIndex(['uid_initiator'], 'initiator_index'); |
|
475 | + } else { |
|
476 | + $table = $schema->getTable('share'); |
|
477 | + if (!$table->hasColumn('password')) { |
|
478 | + $table->addColumn('password', 'string', [ |
|
479 | + 'notnull' => false, |
|
480 | + 'length' => 255, |
|
481 | + ]); |
|
482 | + } |
|
483 | + } |
|
484 | 484 | |
485 | - if (!$schema->hasTable('jobs')) { |
|
486 | - $table = $schema->createTable('jobs'); |
|
487 | - $table->addColumn('id', 'integer', [ |
|
488 | - 'autoincrement' => true, |
|
489 | - 'notnull' => true, |
|
490 | - 'length' => 4, |
|
491 | - 'unsigned' => true, |
|
492 | - ]); |
|
493 | - $table->addColumn('class', 'string', [ |
|
494 | - 'notnull' => true, |
|
495 | - 'length' => 255, |
|
496 | - 'default' => '', |
|
497 | - ]); |
|
498 | - $table->addColumn('argument', 'string', [ |
|
499 | - 'notnull' => true, |
|
500 | - 'length' => 4000, |
|
501 | - 'default' => '', |
|
502 | - ]); |
|
503 | - $table->addColumn('last_run', 'integer', [ |
|
504 | - 'notnull' => false, |
|
505 | - 'default' => 0, |
|
506 | - ]); |
|
507 | - $table->addColumn('last_checked', 'integer', [ |
|
508 | - 'notnull' => false, |
|
509 | - 'default' => 0, |
|
510 | - ]); |
|
511 | - $table->addColumn('reserved_at', 'integer', [ |
|
512 | - 'notnull' => false, |
|
513 | - 'default' => 0, |
|
514 | - ]); |
|
515 | - $table->addColumn('execution_duration', 'integer', [ |
|
516 | - 'notnull' => true, |
|
517 | - 'default' => 0, |
|
518 | - ]); |
|
519 | - $table->setPrimaryKey(['id']); |
|
520 | - $table->addIndex(['class'], 'job_class_index'); |
|
521 | - } |
|
485 | + if (!$schema->hasTable('jobs')) { |
|
486 | + $table = $schema->createTable('jobs'); |
|
487 | + $table->addColumn('id', 'integer', [ |
|
488 | + 'autoincrement' => true, |
|
489 | + 'notnull' => true, |
|
490 | + 'length' => 4, |
|
491 | + 'unsigned' => true, |
|
492 | + ]); |
|
493 | + $table->addColumn('class', 'string', [ |
|
494 | + 'notnull' => true, |
|
495 | + 'length' => 255, |
|
496 | + 'default' => '', |
|
497 | + ]); |
|
498 | + $table->addColumn('argument', 'string', [ |
|
499 | + 'notnull' => true, |
|
500 | + 'length' => 4000, |
|
501 | + 'default' => '', |
|
502 | + ]); |
|
503 | + $table->addColumn('last_run', 'integer', [ |
|
504 | + 'notnull' => false, |
|
505 | + 'default' => 0, |
|
506 | + ]); |
|
507 | + $table->addColumn('last_checked', 'integer', [ |
|
508 | + 'notnull' => false, |
|
509 | + 'default' => 0, |
|
510 | + ]); |
|
511 | + $table->addColumn('reserved_at', 'integer', [ |
|
512 | + 'notnull' => false, |
|
513 | + 'default' => 0, |
|
514 | + ]); |
|
515 | + $table->addColumn('execution_duration', 'integer', [ |
|
516 | + 'notnull' => true, |
|
517 | + 'default' => 0, |
|
518 | + ]); |
|
519 | + $table->setPrimaryKey(['id']); |
|
520 | + $table->addIndex(['class'], 'job_class_index'); |
|
521 | + } |
|
522 | 522 | |
523 | - if (!$schema->hasTable('users')) { |
|
524 | - $table = $schema->createTable('users'); |
|
525 | - $table->addColumn('uid', 'string', [ |
|
526 | - 'notnull' => true, |
|
527 | - 'length' => 64, |
|
528 | - 'default' => '', |
|
529 | - ]); |
|
530 | - $table->addColumn('displayname', 'string', [ |
|
531 | - 'notnull' => false, |
|
532 | - 'length' => 64, |
|
533 | - ]); |
|
534 | - $table->addColumn('password', 'string', [ |
|
535 | - 'notnull' => true, |
|
536 | - 'length' => 255, |
|
537 | - 'default' => '', |
|
538 | - ]); |
|
539 | - $table->setPrimaryKey(['uid']); |
|
540 | - } |
|
523 | + if (!$schema->hasTable('users')) { |
|
524 | + $table = $schema->createTable('users'); |
|
525 | + $table->addColumn('uid', 'string', [ |
|
526 | + 'notnull' => true, |
|
527 | + 'length' => 64, |
|
528 | + 'default' => '', |
|
529 | + ]); |
|
530 | + $table->addColumn('displayname', 'string', [ |
|
531 | + 'notnull' => false, |
|
532 | + 'length' => 64, |
|
533 | + ]); |
|
534 | + $table->addColumn('password', 'string', [ |
|
535 | + 'notnull' => true, |
|
536 | + 'length' => 255, |
|
537 | + 'default' => '', |
|
538 | + ]); |
|
539 | + $table->setPrimaryKey(['uid']); |
|
540 | + } |
|
541 | 541 | |
542 | - if (!$schema->hasTable('authtoken')) { |
|
543 | - $table = $schema->createTable('authtoken'); |
|
544 | - $table->addColumn('id', 'integer', [ |
|
545 | - 'autoincrement' => true, |
|
546 | - 'notnull' => true, |
|
547 | - 'length' => 4, |
|
548 | - 'unsigned' => true, |
|
549 | - ]); |
|
550 | - $table->addColumn('uid', 'string', [ |
|
551 | - 'notnull' => true, |
|
552 | - 'length' => 64, |
|
553 | - 'default' => '', |
|
554 | - ]); |
|
555 | - $table->addColumn('login_name', 'string', [ |
|
556 | - 'notnull' => true, |
|
557 | - 'length' => 64, |
|
558 | - 'default' => '', |
|
559 | - ]); |
|
560 | - $table->addColumn('password', 'text', [ |
|
561 | - 'notnull' => false, |
|
562 | - ]); |
|
563 | - $table->addColumn('name', 'text', [ |
|
564 | - 'notnull' => true, |
|
565 | - 'default' => '', |
|
566 | - ]); |
|
567 | - $table->addColumn('token', 'string', [ |
|
568 | - 'notnull' => true, |
|
569 | - 'length' => 200, |
|
570 | - 'default' => '', |
|
571 | - ]); |
|
572 | - $table->addColumn('type', 'smallint', [ |
|
573 | - 'notnull' => false, |
|
574 | - 'length' => 2, |
|
575 | - 'default' => 0, |
|
576 | - 'unsigned' => true, |
|
577 | - ]); |
|
578 | - $table->addColumn('remember', 'smallint', [ |
|
579 | - 'notnull' => false, |
|
580 | - 'length' => 1, |
|
581 | - 'default' => 0, |
|
582 | - 'unsigned' => true, |
|
583 | - ]); |
|
584 | - $table->addColumn('last_activity', 'integer', [ |
|
585 | - 'notnull' => false, |
|
586 | - 'length' => 4, |
|
587 | - 'default' => 0, |
|
588 | - 'unsigned' => true, |
|
589 | - ]); |
|
590 | - $table->addColumn('last_check', 'integer', [ |
|
591 | - 'notnull' => false, |
|
592 | - 'length' => 4, |
|
593 | - 'default' => 0, |
|
594 | - 'unsigned' => true, |
|
595 | - ]); |
|
596 | - $table->addColumn('scope', 'text', [ |
|
597 | - 'notnull' => false, |
|
598 | - ]); |
|
599 | - $table->setPrimaryKey(['id']); |
|
600 | - $table->addUniqueIndex(['token'], 'authtoken_token_index'); |
|
601 | - $table->addIndex(['last_activity'], 'authtoken_last_activity_idx'); |
|
602 | - } else { |
|
603 | - $table = $schema->getTable('authtoken'); |
|
604 | - $table->addColumn('scope', 'text', [ |
|
605 | - 'notnull' => false, |
|
606 | - ]); |
|
607 | - } |
|
542 | + if (!$schema->hasTable('authtoken')) { |
|
543 | + $table = $schema->createTable('authtoken'); |
|
544 | + $table->addColumn('id', 'integer', [ |
|
545 | + 'autoincrement' => true, |
|
546 | + 'notnull' => true, |
|
547 | + 'length' => 4, |
|
548 | + 'unsigned' => true, |
|
549 | + ]); |
|
550 | + $table->addColumn('uid', 'string', [ |
|
551 | + 'notnull' => true, |
|
552 | + 'length' => 64, |
|
553 | + 'default' => '', |
|
554 | + ]); |
|
555 | + $table->addColumn('login_name', 'string', [ |
|
556 | + 'notnull' => true, |
|
557 | + 'length' => 64, |
|
558 | + 'default' => '', |
|
559 | + ]); |
|
560 | + $table->addColumn('password', 'text', [ |
|
561 | + 'notnull' => false, |
|
562 | + ]); |
|
563 | + $table->addColumn('name', 'text', [ |
|
564 | + 'notnull' => true, |
|
565 | + 'default' => '', |
|
566 | + ]); |
|
567 | + $table->addColumn('token', 'string', [ |
|
568 | + 'notnull' => true, |
|
569 | + 'length' => 200, |
|
570 | + 'default' => '', |
|
571 | + ]); |
|
572 | + $table->addColumn('type', 'smallint', [ |
|
573 | + 'notnull' => false, |
|
574 | + 'length' => 2, |
|
575 | + 'default' => 0, |
|
576 | + 'unsigned' => true, |
|
577 | + ]); |
|
578 | + $table->addColumn('remember', 'smallint', [ |
|
579 | + 'notnull' => false, |
|
580 | + 'length' => 1, |
|
581 | + 'default' => 0, |
|
582 | + 'unsigned' => true, |
|
583 | + ]); |
|
584 | + $table->addColumn('last_activity', 'integer', [ |
|
585 | + 'notnull' => false, |
|
586 | + 'length' => 4, |
|
587 | + 'default' => 0, |
|
588 | + 'unsigned' => true, |
|
589 | + ]); |
|
590 | + $table->addColumn('last_check', 'integer', [ |
|
591 | + 'notnull' => false, |
|
592 | + 'length' => 4, |
|
593 | + 'default' => 0, |
|
594 | + 'unsigned' => true, |
|
595 | + ]); |
|
596 | + $table->addColumn('scope', 'text', [ |
|
597 | + 'notnull' => false, |
|
598 | + ]); |
|
599 | + $table->setPrimaryKey(['id']); |
|
600 | + $table->addUniqueIndex(['token'], 'authtoken_token_index'); |
|
601 | + $table->addIndex(['last_activity'], 'authtoken_last_activity_idx'); |
|
602 | + } else { |
|
603 | + $table = $schema->getTable('authtoken'); |
|
604 | + $table->addColumn('scope', 'text', [ |
|
605 | + 'notnull' => false, |
|
606 | + ]); |
|
607 | + } |
|
608 | 608 | |
609 | - if (!$schema->hasTable('bruteforce_attempts')) { |
|
610 | - $table = $schema->createTable('bruteforce_attempts'); |
|
611 | - $table->addColumn('id', 'integer', [ |
|
612 | - 'autoincrement' => true, |
|
613 | - 'notnull' => true, |
|
614 | - 'length' => 4, |
|
615 | - 'unsigned' => true, |
|
616 | - ]); |
|
617 | - $table->addColumn('action', 'string', [ |
|
618 | - 'notnull' => true, |
|
619 | - 'length' => 64, |
|
620 | - 'default' => '', |
|
621 | - ]); |
|
622 | - $table->addColumn('occurred', 'integer', [ |
|
623 | - 'notnull' => true, |
|
624 | - 'length' => 4, |
|
625 | - 'default' => 0, |
|
626 | - 'unsigned' => true, |
|
627 | - ]); |
|
628 | - $table->addColumn('ip', 'string', [ |
|
629 | - 'notnull' => true, |
|
630 | - 'length' => 255, |
|
631 | - 'default' => '', |
|
632 | - ]); |
|
633 | - $table->addColumn('subnet', 'string', [ |
|
634 | - 'notnull' => true, |
|
635 | - 'length' => 255, |
|
636 | - 'default' => '', |
|
637 | - ]); |
|
638 | - $table->addColumn('metadata', 'string', [ |
|
639 | - 'notnull' => true, |
|
640 | - 'length' => 255, |
|
641 | - 'default' => '', |
|
642 | - ]); |
|
643 | - $table->setPrimaryKey(['id']); |
|
644 | - $table->addIndex(['ip'], 'bruteforce_attempts_ip'); |
|
645 | - $table->addIndex(['subnet'], 'bruteforce_attempts_subnet'); |
|
646 | - } |
|
609 | + if (!$schema->hasTable('bruteforce_attempts')) { |
|
610 | + $table = $schema->createTable('bruteforce_attempts'); |
|
611 | + $table->addColumn('id', 'integer', [ |
|
612 | + 'autoincrement' => true, |
|
613 | + 'notnull' => true, |
|
614 | + 'length' => 4, |
|
615 | + 'unsigned' => true, |
|
616 | + ]); |
|
617 | + $table->addColumn('action', 'string', [ |
|
618 | + 'notnull' => true, |
|
619 | + 'length' => 64, |
|
620 | + 'default' => '', |
|
621 | + ]); |
|
622 | + $table->addColumn('occurred', 'integer', [ |
|
623 | + 'notnull' => true, |
|
624 | + 'length' => 4, |
|
625 | + 'default' => 0, |
|
626 | + 'unsigned' => true, |
|
627 | + ]); |
|
628 | + $table->addColumn('ip', 'string', [ |
|
629 | + 'notnull' => true, |
|
630 | + 'length' => 255, |
|
631 | + 'default' => '', |
|
632 | + ]); |
|
633 | + $table->addColumn('subnet', 'string', [ |
|
634 | + 'notnull' => true, |
|
635 | + 'length' => 255, |
|
636 | + 'default' => '', |
|
637 | + ]); |
|
638 | + $table->addColumn('metadata', 'string', [ |
|
639 | + 'notnull' => true, |
|
640 | + 'length' => 255, |
|
641 | + 'default' => '', |
|
642 | + ]); |
|
643 | + $table->setPrimaryKey(['id']); |
|
644 | + $table->addIndex(['ip'], 'bruteforce_attempts_ip'); |
|
645 | + $table->addIndex(['subnet'], 'bruteforce_attempts_subnet'); |
|
646 | + } |
|
647 | 647 | |
648 | - if (!$schema->hasTable('vcategory')) { |
|
649 | - $table = $schema->createTable('vcategory'); |
|
650 | - $table->addColumn('id', 'integer', [ |
|
651 | - 'autoincrement' => true, |
|
652 | - 'notnull' => true, |
|
653 | - 'length' => 4, |
|
654 | - 'unsigned' => true, |
|
655 | - ]); |
|
656 | - $table->addColumn('uid', 'string', [ |
|
657 | - 'notnull' => true, |
|
658 | - 'length' => 64, |
|
659 | - 'default' => '', |
|
660 | - ]); |
|
661 | - $table->addColumn('type', 'string', [ |
|
662 | - 'notnull' => true, |
|
663 | - 'length' => 64, |
|
664 | - 'default' => '', |
|
665 | - ]); |
|
666 | - $table->addColumn('category', 'string', [ |
|
667 | - 'notnull' => true, |
|
668 | - 'length' => 255, |
|
669 | - 'default' => '', |
|
670 | - ]); |
|
671 | - $table->setPrimaryKey(['id']); |
|
672 | - $table->addIndex(['uid'], 'uid_index'); |
|
673 | - $table->addIndex(['type'], 'type_index'); |
|
674 | - $table->addIndex(['category'], 'category_index'); |
|
675 | - } |
|
648 | + if (!$schema->hasTable('vcategory')) { |
|
649 | + $table = $schema->createTable('vcategory'); |
|
650 | + $table->addColumn('id', 'integer', [ |
|
651 | + 'autoincrement' => true, |
|
652 | + 'notnull' => true, |
|
653 | + 'length' => 4, |
|
654 | + 'unsigned' => true, |
|
655 | + ]); |
|
656 | + $table->addColumn('uid', 'string', [ |
|
657 | + 'notnull' => true, |
|
658 | + 'length' => 64, |
|
659 | + 'default' => '', |
|
660 | + ]); |
|
661 | + $table->addColumn('type', 'string', [ |
|
662 | + 'notnull' => true, |
|
663 | + 'length' => 64, |
|
664 | + 'default' => '', |
|
665 | + ]); |
|
666 | + $table->addColumn('category', 'string', [ |
|
667 | + 'notnull' => true, |
|
668 | + 'length' => 255, |
|
669 | + 'default' => '', |
|
670 | + ]); |
|
671 | + $table->setPrimaryKey(['id']); |
|
672 | + $table->addIndex(['uid'], 'uid_index'); |
|
673 | + $table->addIndex(['type'], 'type_index'); |
|
674 | + $table->addIndex(['category'], 'category_index'); |
|
675 | + } |
|
676 | 676 | |
677 | - if (!$schema->hasTable('vcategory_to_object')) { |
|
678 | - $table = $schema->createTable('vcategory_to_object'); |
|
679 | - $table->addColumn('objid', 'integer', [ |
|
680 | - 'notnull' => true, |
|
681 | - 'length' => 4, |
|
682 | - 'default' => 0, |
|
683 | - 'unsigned' => true, |
|
684 | - ]); |
|
685 | - $table->addColumn('categoryid', 'integer', [ |
|
686 | - 'notnull' => true, |
|
687 | - 'length' => 4, |
|
688 | - 'default' => 0, |
|
689 | - 'unsigned' => true, |
|
690 | - ]); |
|
691 | - $table->addColumn('type', 'string', [ |
|
692 | - 'notnull' => true, |
|
693 | - 'length' => 64, |
|
694 | - 'default' => '', |
|
695 | - ]); |
|
696 | - $table->setPrimaryKey(['categoryid', 'objid', 'type']); |
|
697 | - $table->addIndex(['objid', 'type'], 'vcategory_objectd_index'); |
|
698 | - } |
|
677 | + if (!$schema->hasTable('vcategory_to_object')) { |
|
678 | + $table = $schema->createTable('vcategory_to_object'); |
|
679 | + $table->addColumn('objid', 'integer', [ |
|
680 | + 'notnull' => true, |
|
681 | + 'length' => 4, |
|
682 | + 'default' => 0, |
|
683 | + 'unsigned' => true, |
|
684 | + ]); |
|
685 | + $table->addColumn('categoryid', 'integer', [ |
|
686 | + 'notnull' => true, |
|
687 | + 'length' => 4, |
|
688 | + 'default' => 0, |
|
689 | + 'unsigned' => true, |
|
690 | + ]); |
|
691 | + $table->addColumn('type', 'string', [ |
|
692 | + 'notnull' => true, |
|
693 | + 'length' => 64, |
|
694 | + 'default' => '', |
|
695 | + ]); |
|
696 | + $table->setPrimaryKey(['categoryid', 'objid', 'type']); |
|
697 | + $table->addIndex(['objid', 'type'], 'vcategory_objectd_index'); |
|
698 | + } |
|
699 | 699 | |
700 | - if (!$schema->hasTable('systemtag')) { |
|
701 | - $table = $schema->createTable('systemtag'); |
|
702 | - $table->addColumn('id', 'integer', [ |
|
703 | - 'autoincrement' => true, |
|
704 | - 'notnull' => true, |
|
705 | - 'length' => 4, |
|
706 | - 'unsigned' => true, |
|
707 | - ]); |
|
708 | - $table->addColumn('name', 'string', [ |
|
709 | - 'notnull' => true, |
|
710 | - 'length' => 64, |
|
711 | - 'default' => '', |
|
712 | - ]); |
|
713 | - $table->addColumn('visibility', 'smallint', [ |
|
714 | - 'notnull' => true, |
|
715 | - 'length' => 1, |
|
716 | - 'default' => 1, |
|
717 | - ]); |
|
718 | - $table->addColumn('editable', 'smallint', [ |
|
719 | - 'notnull' => true, |
|
720 | - 'length' => 1, |
|
721 | - 'default' => 1, |
|
722 | - ]); |
|
723 | - $table->setPrimaryKey(['id']); |
|
724 | - $table->addUniqueIndex(['name', 'visibility', 'editable'], 'tag_ident'); |
|
725 | - } |
|
700 | + if (!$schema->hasTable('systemtag')) { |
|
701 | + $table = $schema->createTable('systemtag'); |
|
702 | + $table->addColumn('id', 'integer', [ |
|
703 | + 'autoincrement' => true, |
|
704 | + 'notnull' => true, |
|
705 | + 'length' => 4, |
|
706 | + 'unsigned' => true, |
|
707 | + ]); |
|
708 | + $table->addColumn('name', 'string', [ |
|
709 | + 'notnull' => true, |
|
710 | + 'length' => 64, |
|
711 | + 'default' => '', |
|
712 | + ]); |
|
713 | + $table->addColumn('visibility', 'smallint', [ |
|
714 | + 'notnull' => true, |
|
715 | + 'length' => 1, |
|
716 | + 'default' => 1, |
|
717 | + ]); |
|
718 | + $table->addColumn('editable', 'smallint', [ |
|
719 | + 'notnull' => true, |
|
720 | + 'length' => 1, |
|
721 | + 'default' => 1, |
|
722 | + ]); |
|
723 | + $table->setPrimaryKey(['id']); |
|
724 | + $table->addUniqueIndex(['name', 'visibility', 'editable'], 'tag_ident'); |
|
725 | + } |
|
726 | 726 | |
727 | - if (!$schema->hasTable('systemtag_object_mapping')) { |
|
728 | - $table = $schema->createTable('systemtag_object_mapping'); |
|
729 | - $table->addColumn('objectid', 'string', [ |
|
730 | - 'notnull' => true, |
|
731 | - 'length' => 64, |
|
732 | - 'default' => '', |
|
733 | - ]); |
|
734 | - $table->addColumn('objecttype', 'string', [ |
|
735 | - 'notnull' => true, |
|
736 | - 'length' => 64, |
|
737 | - 'default' => '', |
|
738 | - ]); |
|
739 | - $table->addColumn('systemtagid', 'integer', [ |
|
740 | - 'notnull' => true, |
|
741 | - 'length' => 4, |
|
742 | - 'default' => 0, |
|
743 | - 'unsigned' => true, |
|
744 | - ]); |
|
745 | - $table->setPrimaryKey(['objecttype', 'objectid', 'systemtagid'], 'som_pk'); |
|
727 | + if (!$schema->hasTable('systemtag_object_mapping')) { |
|
728 | + $table = $schema->createTable('systemtag_object_mapping'); |
|
729 | + $table->addColumn('objectid', 'string', [ |
|
730 | + 'notnull' => true, |
|
731 | + 'length' => 64, |
|
732 | + 'default' => '', |
|
733 | + ]); |
|
734 | + $table->addColumn('objecttype', 'string', [ |
|
735 | + 'notnull' => true, |
|
736 | + 'length' => 64, |
|
737 | + 'default' => '', |
|
738 | + ]); |
|
739 | + $table->addColumn('systemtagid', 'integer', [ |
|
740 | + 'notnull' => true, |
|
741 | + 'length' => 4, |
|
742 | + 'default' => 0, |
|
743 | + 'unsigned' => true, |
|
744 | + ]); |
|
745 | + $table->setPrimaryKey(['objecttype', 'objectid', 'systemtagid'], 'som_pk'); |
|
746 | 746 | // $table->addUniqueIndex(['objecttype', 'objectid', 'systemtagid'], 'mapping'); |
747 | - } |
|
747 | + } |
|
748 | 748 | |
749 | - if (!$schema->hasTable('systemtag_group')) { |
|
750 | - $table = $schema->createTable('systemtag_group'); |
|
751 | - $table->addColumn('systemtagid', 'integer', [ |
|
752 | - 'notnull' => true, |
|
753 | - 'length' => 4, |
|
754 | - 'default' => 0, |
|
755 | - 'unsigned' => true, |
|
756 | - ]); |
|
757 | - $table->addColumn('gid', 'string', [ |
|
758 | - 'notnull' => true, |
|
759 | - ]); |
|
760 | - $table->setPrimaryKey(['gid', 'systemtagid']); |
|
761 | - } |
|
749 | + if (!$schema->hasTable('systemtag_group')) { |
|
750 | + $table = $schema->createTable('systemtag_group'); |
|
751 | + $table->addColumn('systemtagid', 'integer', [ |
|
752 | + 'notnull' => true, |
|
753 | + 'length' => 4, |
|
754 | + 'default' => 0, |
|
755 | + 'unsigned' => true, |
|
756 | + ]); |
|
757 | + $table->addColumn('gid', 'string', [ |
|
758 | + 'notnull' => true, |
|
759 | + ]); |
|
760 | + $table->setPrimaryKey(['gid', 'systemtagid']); |
|
761 | + } |
|
762 | 762 | |
763 | - if (!$schema->hasTable('file_locks')) { |
|
764 | - $table = $schema->createTable('file_locks'); |
|
765 | - $table->addColumn('id', 'integer', [ |
|
766 | - 'autoincrement' => true, |
|
767 | - 'notnull' => true, |
|
768 | - 'length' => 4, |
|
769 | - 'unsigned' => true, |
|
770 | - ]); |
|
771 | - $table->addColumn('lock', 'integer', [ |
|
772 | - 'notnull' => true, |
|
773 | - 'length' => 4, |
|
774 | - 'default' => 0, |
|
775 | - ]); |
|
776 | - $table->addColumn('key', 'string', [ |
|
777 | - 'notnull' => true, |
|
778 | - 'length' => 64, |
|
779 | - ]); |
|
780 | - $table->addColumn('ttl', 'integer', [ |
|
781 | - 'notnull' => true, |
|
782 | - 'length' => 4, |
|
783 | - 'default' => -1, |
|
784 | - ]); |
|
785 | - $table->setPrimaryKey(['id']); |
|
786 | - $table->addUniqueIndex(['key'], 'lock_key_index'); |
|
787 | - $table->addIndex(['ttl'], 'lock_ttl_index'); |
|
788 | - } |
|
763 | + if (!$schema->hasTable('file_locks')) { |
|
764 | + $table = $schema->createTable('file_locks'); |
|
765 | + $table->addColumn('id', 'integer', [ |
|
766 | + 'autoincrement' => true, |
|
767 | + 'notnull' => true, |
|
768 | + 'length' => 4, |
|
769 | + 'unsigned' => true, |
|
770 | + ]); |
|
771 | + $table->addColumn('lock', 'integer', [ |
|
772 | + 'notnull' => true, |
|
773 | + 'length' => 4, |
|
774 | + 'default' => 0, |
|
775 | + ]); |
|
776 | + $table->addColumn('key', 'string', [ |
|
777 | + 'notnull' => true, |
|
778 | + 'length' => 64, |
|
779 | + ]); |
|
780 | + $table->addColumn('ttl', 'integer', [ |
|
781 | + 'notnull' => true, |
|
782 | + 'length' => 4, |
|
783 | + 'default' => -1, |
|
784 | + ]); |
|
785 | + $table->setPrimaryKey(['id']); |
|
786 | + $table->addUniqueIndex(['key'], 'lock_key_index'); |
|
787 | + $table->addIndex(['ttl'], 'lock_ttl_index'); |
|
788 | + } |
|
789 | 789 | |
790 | - if (!$schema->hasTable('comments')) { |
|
791 | - $table = $schema->createTable('comments'); |
|
792 | - $table->addColumn('id', 'integer', [ |
|
793 | - 'autoincrement' => true, |
|
794 | - 'notnull' => true, |
|
795 | - 'length' => 4, |
|
796 | - 'unsigned' => true, |
|
797 | - ]); |
|
798 | - $table->addColumn('parent_id', 'integer', [ |
|
799 | - 'notnull' => true, |
|
800 | - 'length' => 4, |
|
801 | - 'default' => 0, |
|
802 | - 'unsigned' => true, |
|
803 | - ]); |
|
804 | - $table->addColumn('topmost_parent_id', 'integer', [ |
|
805 | - 'notnull' => true, |
|
806 | - 'length' => 4, |
|
807 | - 'default' => 0, |
|
808 | - 'unsigned' => true, |
|
809 | - ]); |
|
810 | - $table->addColumn('children_count', 'integer', [ |
|
811 | - 'notnull' => true, |
|
812 | - 'length' => 4, |
|
813 | - 'default' => 0, |
|
814 | - 'unsigned' => true, |
|
815 | - ]); |
|
816 | - $table->addColumn('actor_type', 'string', [ |
|
817 | - 'notnull' => true, |
|
818 | - 'length' => 64, |
|
819 | - 'default' => '', |
|
820 | - ]); |
|
821 | - $table->addColumn('actor_id', 'string', [ |
|
822 | - 'notnull' => true, |
|
823 | - 'length' => 64, |
|
824 | - 'default' => '', |
|
825 | - ]); |
|
826 | - $table->addColumn('message', 'text', [ |
|
827 | - 'notnull' => false, |
|
828 | - ]); |
|
829 | - $table->addColumn('verb', 'string', [ |
|
830 | - 'notnull' => false, |
|
831 | - 'length' => 64, |
|
832 | - ]); |
|
833 | - $table->addColumn('creation_timestamp', 'datetime', [ |
|
834 | - 'notnull' => false, |
|
835 | - ]); |
|
836 | - $table->addColumn('latest_child_timestamp', 'datetime', [ |
|
837 | - 'notnull' => false, |
|
838 | - ]); |
|
839 | - $table->addColumn('object_type', 'string', [ |
|
840 | - 'notnull' => true, |
|
841 | - 'length' => 64, |
|
842 | - 'default' => '', |
|
843 | - ]); |
|
844 | - $table->addColumn('object_id', 'string', [ |
|
845 | - 'notnull' => true, |
|
846 | - 'length' => 64, |
|
847 | - 'default' => '', |
|
848 | - ]); |
|
849 | - $table->addColumn('reference_id', 'string', [ |
|
850 | - 'notnull' => false, |
|
851 | - 'length' => 64, |
|
852 | - ]); |
|
853 | - $table->setPrimaryKey(['id']); |
|
854 | - $table->addIndex(['parent_id'], 'comments_parent_id_index'); |
|
855 | - $table->addIndex(['topmost_parent_id'], 'comments_topmost_parent_id_idx'); |
|
856 | - $table->addIndex(['object_type', 'object_id', 'creation_timestamp'], 'comments_object_index'); |
|
857 | - $table->addIndex(['actor_type', 'actor_id'], 'comments_actor_index'); |
|
858 | - } |
|
790 | + if (!$schema->hasTable('comments')) { |
|
791 | + $table = $schema->createTable('comments'); |
|
792 | + $table->addColumn('id', 'integer', [ |
|
793 | + 'autoincrement' => true, |
|
794 | + 'notnull' => true, |
|
795 | + 'length' => 4, |
|
796 | + 'unsigned' => true, |
|
797 | + ]); |
|
798 | + $table->addColumn('parent_id', 'integer', [ |
|
799 | + 'notnull' => true, |
|
800 | + 'length' => 4, |
|
801 | + 'default' => 0, |
|
802 | + 'unsigned' => true, |
|
803 | + ]); |
|
804 | + $table->addColumn('topmost_parent_id', 'integer', [ |
|
805 | + 'notnull' => true, |
|
806 | + 'length' => 4, |
|
807 | + 'default' => 0, |
|
808 | + 'unsigned' => true, |
|
809 | + ]); |
|
810 | + $table->addColumn('children_count', 'integer', [ |
|
811 | + 'notnull' => true, |
|
812 | + 'length' => 4, |
|
813 | + 'default' => 0, |
|
814 | + 'unsigned' => true, |
|
815 | + ]); |
|
816 | + $table->addColumn('actor_type', 'string', [ |
|
817 | + 'notnull' => true, |
|
818 | + 'length' => 64, |
|
819 | + 'default' => '', |
|
820 | + ]); |
|
821 | + $table->addColumn('actor_id', 'string', [ |
|
822 | + 'notnull' => true, |
|
823 | + 'length' => 64, |
|
824 | + 'default' => '', |
|
825 | + ]); |
|
826 | + $table->addColumn('message', 'text', [ |
|
827 | + 'notnull' => false, |
|
828 | + ]); |
|
829 | + $table->addColumn('verb', 'string', [ |
|
830 | + 'notnull' => false, |
|
831 | + 'length' => 64, |
|
832 | + ]); |
|
833 | + $table->addColumn('creation_timestamp', 'datetime', [ |
|
834 | + 'notnull' => false, |
|
835 | + ]); |
|
836 | + $table->addColumn('latest_child_timestamp', 'datetime', [ |
|
837 | + 'notnull' => false, |
|
838 | + ]); |
|
839 | + $table->addColumn('object_type', 'string', [ |
|
840 | + 'notnull' => true, |
|
841 | + 'length' => 64, |
|
842 | + 'default' => '', |
|
843 | + ]); |
|
844 | + $table->addColumn('object_id', 'string', [ |
|
845 | + 'notnull' => true, |
|
846 | + 'length' => 64, |
|
847 | + 'default' => '', |
|
848 | + ]); |
|
849 | + $table->addColumn('reference_id', 'string', [ |
|
850 | + 'notnull' => false, |
|
851 | + 'length' => 64, |
|
852 | + ]); |
|
853 | + $table->setPrimaryKey(['id']); |
|
854 | + $table->addIndex(['parent_id'], 'comments_parent_id_index'); |
|
855 | + $table->addIndex(['topmost_parent_id'], 'comments_topmost_parent_id_idx'); |
|
856 | + $table->addIndex(['object_type', 'object_id', 'creation_timestamp'], 'comments_object_index'); |
|
857 | + $table->addIndex(['actor_type', 'actor_id'], 'comments_actor_index'); |
|
858 | + } |
|
859 | 859 | |
860 | - if (!$schema->hasTable('comments_read_markers')) { |
|
861 | - $table = $schema->createTable('comments_read_markers'); |
|
862 | - $table->addColumn('user_id', 'string', [ |
|
863 | - 'notnull' => true, |
|
864 | - 'length' => 64, |
|
865 | - 'default' => '', |
|
866 | - ]); |
|
867 | - $table->addColumn('marker_datetime', 'datetime', [ |
|
868 | - 'notnull' => false, |
|
869 | - ]); |
|
870 | - $table->addColumn('object_type', 'string', [ |
|
871 | - 'notnull' => true, |
|
872 | - 'length' => 64, |
|
873 | - 'default' => '', |
|
874 | - ]); |
|
875 | - $table->addColumn('object_id', 'string', [ |
|
876 | - 'notnull' => true, |
|
877 | - 'length' => 64, |
|
878 | - 'default' => '', |
|
879 | - ]); |
|
880 | - $table->addIndex(['object_type', 'object_id'], 'comments_marker_object_index'); |
|
881 | - $table->setPrimaryKey(['user_id', 'object_type', 'object_id'], 'crm_pk'); |
|
860 | + if (!$schema->hasTable('comments_read_markers')) { |
|
861 | + $table = $schema->createTable('comments_read_markers'); |
|
862 | + $table->addColumn('user_id', 'string', [ |
|
863 | + 'notnull' => true, |
|
864 | + 'length' => 64, |
|
865 | + 'default' => '', |
|
866 | + ]); |
|
867 | + $table->addColumn('marker_datetime', 'datetime', [ |
|
868 | + 'notnull' => false, |
|
869 | + ]); |
|
870 | + $table->addColumn('object_type', 'string', [ |
|
871 | + 'notnull' => true, |
|
872 | + 'length' => 64, |
|
873 | + 'default' => '', |
|
874 | + ]); |
|
875 | + $table->addColumn('object_id', 'string', [ |
|
876 | + 'notnull' => true, |
|
877 | + 'length' => 64, |
|
878 | + 'default' => '', |
|
879 | + ]); |
|
880 | + $table->addIndex(['object_type', 'object_id'], 'comments_marker_object_index'); |
|
881 | + $table->setPrimaryKey(['user_id', 'object_type', 'object_id'], 'crm_pk'); |
|
882 | 882 | // $table->addUniqueIndex(['user_id', 'object_type', 'object_id'], 'comments_marker_index'); |
883 | - } |
|
883 | + } |
|
884 | 884 | |
885 | 885 | // if (!$schema->hasTable('credentials')) { |
886 | 886 | // $table = $schema->createTable('credentials'); |
@@ -899,139 +899,139 @@ discard block |
||
899 | 899 | // $table->addIndex(['user'], 'credentials_user'); |
900 | 900 | // } |
901 | 901 | |
902 | - if (!$schema->hasTable('admin_sections')) { |
|
903 | - $table = $schema->createTable('admin_sections'); |
|
904 | - $table->addColumn('id', 'string', [ |
|
905 | - 'notnull' => true, |
|
906 | - 'length' => 64, |
|
907 | - ]); |
|
908 | - $table->addColumn('class', 'string', [ |
|
909 | - 'notnull' => true, |
|
910 | - 'length' => 255, |
|
911 | - 'default' => '', |
|
912 | - ]); |
|
913 | - $table->addColumn('priority', 'smallint', [ |
|
914 | - 'notnull' => true, |
|
915 | - 'length' => 1, |
|
916 | - 'default' => 0, |
|
917 | - ]); |
|
918 | - $table->setPrimaryKey(['id']); |
|
919 | - $table->addUniqueIndex(['class'], 'admin_sections_class'); |
|
920 | - } |
|
902 | + if (!$schema->hasTable('admin_sections')) { |
|
903 | + $table = $schema->createTable('admin_sections'); |
|
904 | + $table->addColumn('id', 'string', [ |
|
905 | + 'notnull' => true, |
|
906 | + 'length' => 64, |
|
907 | + ]); |
|
908 | + $table->addColumn('class', 'string', [ |
|
909 | + 'notnull' => true, |
|
910 | + 'length' => 255, |
|
911 | + 'default' => '', |
|
912 | + ]); |
|
913 | + $table->addColumn('priority', 'smallint', [ |
|
914 | + 'notnull' => true, |
|
915 | + 'length' => 1, |
|
916 | + 'default' => 0, |
|
917 | + ]); |
|
918 | + $table->setPrimaryKey(['id']); |
|
919 | + $table->addUniqueIndex(['class'], 'admin_sections_class'); |
|
920 | + } |
|
921 | 921 | |
922 | - if (!$schema->hasTable('admin_settings')) { |
|
923 | - $table = $schema->createTable('admin_settings'); |
|
924 | - $table->addColumn('id', 'integer', [ |
|
925 | - 'autoincrement' => true, |
|
926 | - 'notnull' => true, |
|
927 | - 'length' => 4, |
|
928 | - ]); |
|
929 | - $table->addColumn('class', 'string', [ |
|
930 | - 'notnull' => true, |
|
931 | - 'length' => 255, |
|
932 | - 'default' => '', |
|
933 | - ]); |
|
934 | - $table->addColumn('section', 'string', [ |
|
935 | - 'notnull' => false, |
|
936 | - 'length' => 64, |
|
937 | - ]); |
|
938 | - $table->addColumn('priority', 'smallint', [ |
|
939 | - 'notnull' => true, |
|
940 | - 'length' => 1, |
|
941 | - 'default' => 0, |
|
942 | - ]); |
|
943 | - $table->setPrimaryKey(['id']); |
|
944 | - $table->addUniqueIndex(['class'], 'admin_settings_class'); |
|
945 | - $table->addIndex(['section'], 'admin_settings_section'); |
|
946 | - } |
|
922 | + if (!$schema->hasTable('admin_settings')) { |
|
923 | + $table = $schema->createTable('admin_settings'); |
|
924 | + $table->addColumn('id', 'integer', [ |
|
925 | + 'autoincrement' => true, |
|
926 | + 'notnull' => true, |
|
927 | + 'length' => 4, |
|
928 | + ]); |
|
929 | + $table->addColumn('class', 'string', [ |
|
930 | + 'notnull' => true, |
|
931 | + 'length' => 255, |
|
932 | + 'default' => '', |
|
933 | + ]); |
|
934 | + $table->addColumn('section', 'string', [ |
|
935 | + 'notnull' => false, |
|
936 | + 'length' => 64, |
|
937 | + ]); |
|
938 | + $table->addColumn('priority', 'smallint', [ |
|
939 | + 'notnull' => true, |
|
940 | + 'length' => 1, |
|
941 | + 'default' => 0, |
|
942 | + ]); |
|
943 | + $table->setPrimaryKey(['id']); |
|
944 | + $table->addUniqueIndex(['class'], 'admin_settings_class'); |
|
945 | + $table->addIndex(['section'], 'admin_settings_section'); |
|
946 | + } |
|
947 | 947 | |
948 | - if (!$schema->hasTable('personal_sections')) { |
|
949 | - $table = $schema->createTable('personal_sections'); |
|
950 | - $table->addColumn('id', 'string', [ |
|
951 | - 'notnull' => true, |
|
952 | - 'length' => 64, |
|
953 | - ]); |
|
954 | - $table->addColumn('class', 'string', [ |
|
955 | - 'notnull' => true, |
|
956 | - 'length' => 255, |
|
957 | - 'default' => '', |
|
958 | - ]); |
|
959 | - $table->addColumn('priority', 'smallint', [ |
|
960 | - 'notnull' => true, |
|
961 | - 'length' => 1, |
|
962 | - 'default' => 0, |
|
963 | - ]); |
|
964 | - $table->setPrimaryKey(['id']); |
|
965 | - $table->addUniqueIndex(['class'], 'personal_sections_class'); |
|
966 | - } |
|
948 | + if (!$schema->hasTable('personal_sections')) { |
|
949 | + $table = $schema->createTable('personal_sections'); |
|
950 | + $table->addColumn('id', 'string', [ |
|
951 | + 'notnull' => true, |
|
952 | + 'length' => 64, |
|
953 | + ]); |
|
954 | + $table->addColumn('class', 'string', [ |
|
955 | + 'notnull' => true, |
|
956 | + 'length' => 255, |
|
957 | + 'default' => '', |
|
958 | + ]); |
|
959 | + $table->addColumn('priority', 'smallint', [ |
|
960 | + 'notnull' => true, |
|
961 | + 'length' => 1, |
|
962 | + 'default' => 0, |
|
963 | + ]); |
|
964 | + $table->setPrimaryKey(['id']); |
|
965 | + $table->addUniqueIndex(['class'], 'personal_sections_class'); |
|
966 | + } |
|
967 | 967 | |
968 | - if (!$schema->hasTable('personal_settings')) { |
|
969 | - $table = $schema->createTable('personal_settings'); |
|
970 | - $table->addColumn('id', 'integer', [ |
|
971 | - 'autoincrement' => true, |
|
972 | - 'notnull' => true, |
|
973 | - 'length' => 4, |
|
974 | - ]); |
|
975 | - $table->addColumn('class', 'string', [ |
|
976 | - 'notnull' => true, |
|
977 | - 'length' => 255, |
|
978 | - 'default' => '', |
|
979 | - ]); |
|
980 | - $table->addColumn('section', 'string', [ |
|
981 | - 'notnull' => false, |
|
982 | - 'length' => 64, |
|
983 | - ]); |
|
984 | - $table->addColumn('priority', 'smallint', [ |
|
985 | - 'notnull' => true, |
|
986 | - 'length' => 1, |
|
987 | - 'default' => 0, |
|
988 | - ]); |
|
989 | - $table->setPrimaryKey(['id']); |
|
990 | - $table->addUniqueIndex(['class'], 'personal_settings_class'); |
|
991 | - $table->addIndex(['section'], 'personal_settings_section'); |
|
992 | - } |
|
968 | + if (!$schema->hasTable('personal_settings')) { |
|
969 | + $table = $schema->createTable('personal_settings'); |
|
970 | + $table->addColumn('id', 'integer', [ |
|
971 | + 'autoincrement' => true, |
|
972 | + 'notnull' => true, |
|
973 | + 'length' => 4, |
|
974 | + ]); |
|
975 | + $table->addColumn('class', 'string', [ |
|
976 | + 'notnull' => true, |
|
977 | + 'length' => 255, |
|
978 | + 'default' => '', |
|
979 | + ]); |
|
980 | + $table->addColumn('section', 'string', [ |
|
981 | + 'notnull' => false, |
|
982 | + 'length' => 64, |
|
983 | + ]); |
|
984 | + $table->addColumn('priority', 'smallint', [ |
|
985 | + 'notnull' => true, |
|
986 | + 'length' => 1, |
|
987 | + 'default' => 0, |
|
988 | + ]); |
|
989 | + $table->setPrimaryKey(['id']); |
|
990 | + $table->addUniqueIndex(['class'], 'personal_settings_class'); |
|
991 | + $table->addIndex(['section'], 'personal_settings_section'); |
|
992 | + } |
|
993 | 993 | |
994 | - if (!$schema->hasTable('accounts')) { |
|
995 | - $table = $schema->createTable('accounts'); |
|
996 | - $table->addColumn('uid', 'string', [ |
|
997 | - 'notnull' => true, |
|
998 | - 'length' => 64, |
|
999 | - 'default' => '', |
|
1000 | - ]); |
|
1001 | - $table->addColumn('data', 'text', [ |
|
1002 | - 'notnull' => true, |
|
1003 | - 'default' => '', |
|
1004 | - ]); |
|
1005 | - $table->setPrimaryKey(['uid']); |
|
1006 | - } |
|
1007 | - return $schema; |
|
1008 | - } |
|
994 | + if (!$schema->hasTable('accounts')) { |
|
995 | + $table = $schema->createTable('accounts'); |
|
996 | + $table->addColumn('uid', 'string', [ |
|
997 | + 'notnull' => true, |
|
998 | + 'length' => 64, |
|
999 | + 'default' => '', |
|
1000 | + ]); |
|
1001 | + $table->addColumn('data', 'text', [ |
|
1002 | + 'notnull' => true, |
|
1003 | + 'default' => '', |
|
1004 | + ]); |
|
1005 | + $table->setPrimaryKey(['uid']); |
|
1006 | + } |
|
1007 | + return $schema; |
|
1008 | + } |
|
1009 | 1009 | |
1010 | - public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { |
|
1011 | - /** @var ISchemaWrapper $schema */ |
|
1012 | - $schema = $schemaClosure(); |
|
1013 | - if (!$schema->hasTable('dav_properties')) { |
|
1014 | - return; |
|
1015 | - } |
|
1016 | - $query = $this->connection->getQueryBuilder(); |
|
1017 | - $query->select('*') |
|
1018 | - ->from('dav_properties'); |
|
1010 | + public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { |
|
1011 | + /** @var ISchemaWrapper $schema */ |
|
1012 | + $schema = $schemaClosure(); |
|
1013 | + if (!$schema->hasTable('dav_properties')) { |
|
1014 | + return; |
|
1015 | + } |
|
1016 | + $query = $this->connection->getQueryBuilder(); |
|
1017 | + $query->select('*') |
|
1018 | + ->from('dav_properties'); |
|
1019 | 1019 | |
1020 | - $insert = $this->connection->getQueryBuilder(); |
|
1021 | - $insert->insert('properties') |
|
1022 | - ->setValue('propertypath', $insert->createParameter('propertypath')) |
|
1023 | - ->setValue('propertyname', $insert->createParameter('propertyname')) |
|
1024 | - ->setValue('propertyvalue', $insert->createParameter('propertyvalue')) |
|
1025 | - ->setValue('userid', $insert->createParameter('userid')); |
|
1020 | + $insert = $this->connection->getQueryBuilder(); |
|
1021 | + $insert->insert('properties') |
|
1022 | + ->setValue('propertypath', $insert->createParameter('propertypath')) |
|
1023 | + ->setValue('propertyname', $insert->createParameter('propertyname')) |
|
1024 | + ->setValue('propertyvalue', $insert->createParameter('propertyvalue')) |
|
1025 | + ->setValue('userid', $insert->createParameter('userid')); |
|
1026 | 1026 | |
1027 | - $result = $query->execute(); |
|
1028 | - while ($row = $result->fetch()) { |
|
1029 | - preg_match('/(calendar)\/([A-z0-9-@_]+)\//', $row['propertypath'], $match); |
|
1030 | - $insert->setParameter('propertypath', (string) $row['propertypath']) |
|
1031 | - ->setParameter('propertyname', (string) $row['propertyname']) |
|
1032 | - ->setParameter('propertyvalue', (string) $row['propertyvalue']) |
|
1033 | - ->setParameter('userid', (string) ($match[2] ?? '')); |
|
1034 | - $insert->execute(); |
|
1035 | - } |
|
1036 | - } |
|
1027 | + $result = $query->execute(); |
|
1028 | + while ($row = $result->fetch()) { |
|
1029 | + preg_match('/(calendar)\/([A-z0-9-@_]+)\//', $row['propertypath'], $match); |
|
1030 | + $insert->setParameter('propertypath', (string) $row['propertypath']) |
|
1031 | + ->setParameter('propertyname', (string) $row['propertyname']) |
|
1032 | + ->setParameter('propertyvalue', (string) $row['propertyvalue']) |
|
1033 | + ->setParameter('userid', (string) ($match[2] ?? '')); |
|
1034 | + $insert->execute(); |
|
1035 | + } |
|
1036 | + } |
|
1037 | 1037 | } |
@@ -34,102 +34,102 @@ |
||
34 | 34 | */ |
35 | 35 | class Version13000Date20170919121250 extends SimpleMigrationStep { |
36 | 36 | |
37 | - /** |
|
38 | - * @param IOutput $output |
|
39 | - * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
40 | - * @param array $options |
|
41 | - * @since 13.0.0 |
|
42 | - */ |
|
43 | - public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { |
|
44 | - } |
|
45 | - |
|
46 | - /** |
|
47 | - * @param IOutput $output |
|
48 | - * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
49 | - * @param array $options |
|
50 | - * @return null|ISchemaWrapper |
|
51 | - * @since 13.0.0 |
|
52 | - */ |
|
53 | - public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
|
54 | - /** @var ISchemaWrapper $schema */ |
|
55 | - $schema = $schemaClosure(); |
|
56 | - |
|
57 | - $table = $schema->getTable('jobs'); |
|
58 | - $column = $table->getColumn('id'); |
|
59 | - $column->setUnsigned(true); |
|
60 | - |
|
61 | - $table = $schema->getTable('authtoken'); |
|
62 | - $column = $table->getColumn('id'); |
|
63 | - $column->setUnsigned(true); |
|
64 | - $column = $table->getColumn('type'); |
|
65 | - $column->setUnsigned(true); |
|
66 | - if ($table->hasColumn('remember')) { |
|
67 | - $column = $table->getColumn('remember'); |
|
68 | - $column->setUnsigned(true); |
|
69 | - } else { |
|
70 | - $table->addColumn('remember', 'smallint', [ |
|
71 | - 'notnull' => false, |
|
72 | - 'length' => 1, |
|
73 | - 'default' => 0, |
|
74 | - 'unsigned' => true, |
|
75 | - ]); |
|
76 | - } |
|
77 | - $column = $table->getColumn('last_activity'); |
|
78 | - $column->setUnsigned(true); |
|
79 | - $column = $table->getColumn('last_check'); |
|
80 | - $column->setUnsigned(true); |
|
81 | - |
|
82 | - $table = $schema->getTable('bruteforce_attempts'); |
|
83 | - $column = $table->getColumn('id'); |
|
84 | - $column->setUnsigned(true); |
|
85 | - $column = $table->getColumn('occurred'); |
|
86 | - $column->setUnsigned(true); |
|
87 | - |
|
88 | - $table = $schema->getTable('comments'); |
|
89 | - $column = $table->getColumn('id'); |
|
90 | - $column->setUnsigned(true); |
|
91 | - $column = $table->getColumn('parent_id'); |
|
92 | - $column->setUnsigned(true); |
|
93 | - $column = $table->getColumn('topmost_parent_id'); |
|
94 | - $column->setUnsigned(true); |
|
95 | - $column = $table->getColumn('children_count'); |
|
96 | - $column->setUnsigned(true); |
|
97 | - |
|
98 | - $table = $schema->getTable('file_locks'); |
|
99 | - $column = $table->getColumn('id'); |
|
100 | - $column->setUnsigned(true); |
|
101 | - |
|
102 | - $table = $schema->getTable('systemtag'); |
|
103 | - $column = $table->getColumn('id'); |
|
104 | - $column->setUnsigned(true); |
|
105 | - |
|
106 | - $table = $schema->getTable('systemtag_object_mapping'); |
|
107 | - $column = $table->getColumn('systemtagid'); |
|
108 | - $column->setUnsigned(true); |
|
109 | - |
|
110 | - $table = $schema->getTable('systemtag_group'); |
|
111 | - $column = $table->getColumn('systemtagid'); |
|
112 | - $column->setUnsigned(true); |
|
113 | - |
|
114 | - $table = $schema->getTable('vcategory'); |
|
115 | - $column = $table->getColumn('id'); |
|
116 | - $column->setUnsigned(true); |
|
117 | - |
|
118 | - $table = $schema->getTable('vcategory_to_object'); |
|
119 | - $column = $table->getColumn('objid'); |
|
120 | - $column->setUnsigned(true); |
|
121 | - $column = $table->getColumn('categoryid'); |
|
122 | - $column->setUnsigned(true); |
|
123 | - |
|
124 | - return $schema; |
|
125 | - } |
|
126 | - |
|
127 | - /** |
|
128 | - * @param IOutput $output |
|
129 | - * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
130 | - * @param array $options |
|
131 | - * @since 13.0.0 |
|
132 | - */ |
|
133 | - public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { |
|
134 | - } |
|
37 | + /** |
|
38 | + * @param IOutput $output |
|
39 | + * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
40 | + * @param array $options |
|
41 | + * @since 13.0.0 |
|
42 | + */ |
|
43 | + public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { |
|
44 | + } |
|
45 | + |
|
46 | + /** |
|
47 | + * @param IOutput $output |
|
48 | + * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
49 | + * @param array $options |
|
50 | + * @return null|ISchemaWrapper |
|
51 | + * @since 13.0.0 |
|
52 | + */ |
|
53 | + public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
|
54 | + /** @var ISchemaWrapper $schema */ |
|
55 | + $schema = $schemaClosure(); |
|
56 | + |
|
57 | + $table = $schema->getTable('jobs'); |
|
58 | + $column = $table->getColumn('id'); |
|
59 | + $column->setUnsigned(true); |
|
60 | + |
|
61 | + $table = $schema->getTable('authtoken'); |
|
62 | + $column = $table->getColumn('id'); |
|
63 | + $column->setUnsigned(true); |
|
64 | + $column = $table->getColumn('type'); |
|
65 | + $column->setUnsigned(true); |
|
66 | + if ($table->hasColumn('remember')) { |
|
67 | + $column = $table->getColumn('remember'); |
|
68 | + $column->setUnsigned(true); |
|
69 | + } else { |
|
70 | + $table->addColumn('remember', 'smallint', [ |
|
71 | + 'notnull' => false, |
|
72 | + 'length' => 1, |
|
73 | + 'default' => 0, |
|
74 | + 'unsigned' => true, |
|
75 | + ]); |
|
76 | + } |
|
77 | + $column = $table->getColumn('last_activity'); |
|
78 | + $column->setUnsigned(true); |
|
79 | + $column = $table->getColumn('last_check'); |
|
80 | + $column->setUnsigned(true); |
|
81 | + |
|
82 | + $table = $schema->getTable('bruteforce_attempts'); |
|
83 | + $column = $table->getColumn('id'); |
|
84 | + $column->setUnsigned(true); |
|
85 | + $column = $table->getColumn('occurred'); |
|
86 | + $column->setUnsigned(true); |
|
87 | + |
|
88 | + $table = $schema->getTable('comments'); |
|
89 | + $column = $table->getColumn('id'); |
|
90 | + $column->setUnsigned(true); |
|
91 | + $column = $table->getColumn('parent_id'); |
|
92 | + $column->setUnsigned(true); |
|
93 | + $column = $table->getColumn('topmost_parent_id'); |
|
94 | + $column->setUnsigned(true); |
|
95 | + $column = $table->getColumn('children_count'); |
|
96 | + $column->setUnsigned(true); |
|
97 | + |
|
98 | + $table = $schema->getTable('file_locks'); |
|
99 | + $column = $table->getColumn('id'); |
|
100 | + $column->setUnsigned(true); |
|
101 | + |
|
102 | + $table = $schema->getTable('systemtag'); |
|
103 | + $column = $table->getColumn('id'); |
|
104 | + $column->setUnsigned(true); |
|
105 | + |
|
106 | + $table = $schema->getTable('systemtag_object_mapping'); |
|
107 | + $column = $table->getColumn('systemtagid'); |
|
108 | + $column->setUnsigned(true); |
|
109 | + |
|
110 | + $table = $schema->getTable('systemtag_group'); |
|
111 | + $column = $table->getColumn('systemtagid'); |
|
112 | + $column->setUnsigned(true); |
|
113 | + |
|
114 | + $table = $schema->getTable('vcategory'); |
|
115 | + $column = $table->getColumn('id'); |
|
116 | + $column->setUnsigned(true); |
|
117 | + |
|
118 | + $table = $schema->getTable('vcategory_to_object'); |
|
119 | + $column = $table->getColumn('objid'); |
|
120 | + $column->setUnsigned(true); |
|
121 | + $column = $table->getColumn('categoryid'); |
|
122 | + $column->setUnsigned(true); |
|
123 | + |
|
124 | + return $schema; |
|
125 | + } |
|
126 | + |
|
127 | + /** |
|
128 | + * @param IOutput $output |
|
129 | + * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
130 | + * @param array $options |
|
131 | + * @since 13.0.0 |
|
132 | + */ |
|
133 | + public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { |
|
134 | + } |
|
135 | 135 | } |
@@ -10,56 +10,56 @@ |
||
10 | 10 | use OCP\Migration\SimpleMigrationStep; |
11 | 11 | |
12 | 12 | class Version21000Date20201120141228 extends SimpleMigrationStep { |
13 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
14 | - /** @var ISchemaWrapper $schema */ |
|
15 | - $schema = $schemaClosure(); |
|
13 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
14 | + /** @var ISchemaWrapper $schema */ |
|
15 | + $schema = $schemaClosure(); |
|
16 | 16 | |
17 | - if ($schema->hasTable('authtoken')) { |
|
18 | - $table = $schema->getTable('authtoken'); |
|
19 | - $loginNameColumn = $table->getColumn('login_name'); |
|
20 | - if ($loginNameColumn->getLength() !== 255) { |
|
21 | - $loginNameColumn->setLength(255); |
|
22 | - } |
|
23 | - $table->changeColumn('type', [ |
|
24 | - 'notnull' => false, |
|
25 | - ]); |
|
26 | - $table->changeColumn('remember', [ |
|
27 | - 'notnull' => false, |
|
28 | - ]); |
|
29 | - $table->changeColumn('last_activity', [ |
|
30 | - 'notnull' => false, |
|
31 | - ]); |
|
32 | - $table->changeColumn('last_check', [ |
|
33 | - 'notnull' => false, |
|
34 | - ]); |
|
35 | - } |
|
17 | + if ($schema->hasTable('authtoken')) { |
|
18 | + $table = $schema->getTable('authtoken'); |
|
19 | + $loginNameColumn = $table->getColumn('login_name'); |
|
20 | + if ($loginNameColumn->getLength() !== 255) { |
|
21 | + $loginNameColumn->setLength(255); |
|
22 | + } |
|
23 | + $table->changeColumn('type', [ |
|
24 | + 'notnull' => false, |
|
25 | + ]); |
|
26 | + $table->changeColumn('remember', [ |
|
27 | + 'notnull' => false, |
|
28 | + ]); |
|
29 | + $table->changeColumn('last_activity', [ |
|
30 | + 'notnull' => false, |
|
31 | + ]); |
|
32 | + $table->changeColumn('last_check', [ |
|
33 | + 'notnull' => false, |
|
34 | + ]); |
|
35 | + } |
|
36 | 36 | |
37 | - if ($schema->hasTable('dav_job_status')) { |
|
38 | - $schema->dropTable('dav_job_status'); |
|
39 | - } |
|
37 | + if ($schema->hasTable('dav_job_status')) { |
|
38 | + $schema->dropTable('dav_job_status'); |
|
39 | + } |
|
40 | 40 | |
41 | - if ($schema->hasTable('systemtag')) { |
|
42 | - $table = $schema->getTable('systemtag'); |
|
43 | - if ($table->hasColumn('systemtag')) { |
|
44 | - $table->dropColumn('assignable'); |
|
45 | - } |
|
46 | - } |
|
41 | + if ($schema->hasTable('systemtag')) { |
|
42 | + $table = $schema->getTable('systemtag'); |
|
43 | + if ($table->hasColumn('systemtag')) { |
|
44 | + $table->dropColumn('assignable'); |
|
45 | + } |
|
46 | + } |
|
47 | 47 | |
48 | - if ($schema->hasTable('share')) { |
|
49 | - $table = $schema->getTable('share'); |
|
50 | - if ($table->hasColumn('attributes')) { |
|
51 | - $table->dropColumn('attributes'); |
|
52 | - } |
|
53 | - } |
|
48 | + if ($schema->hasTable('share')) { |
|
49 | + $table = $schema->getTable('share'); |
|
50 | + if ($table->hasColumn('attributes')) { |
|
51 | + $table->dropColumn('attributes'); |
|
52 | + } |
|
53 | + } |
|
54 | 54 | |
55 | - if ($schema->hasTable('jobs')) { |
|
56 | - $table = $schema->getTable('jobs'); |
|
57 | - $table->changeColumn('execution_duration', [ |
|
58 | - 'notnull' => false, |
|
59 | - 'default' => 0, |
|
60 | - ]); |
|
61 | - } |
|
55 | + if ($schema->hasTable('jobs')) { |
|
56 | + $table = $schema->getTable('jobs'); |
|
57 | + $table->changeColumn('execution_duration', [ |
|
58 | + 'notnull' => false, |
|
59 | + 'default' => 0, |
|
60 | + ]); |
|
61 | + } |
|
62 | 62 | |
63 | - return $schema; |
|
64 | - } |
|
63 | + return $schema; |
|
64 | + } |
|
65 | 65 | } |
@@ -57,216 +57,216 @@ |
||
57 | 57 | * @package OC\Core |
58 | 58 | */ |
59 | 59 | class Application extends App { |
60 | - public function __construct() { |
|
61 | - parent::__construct('core'); |
|
62 | - |
|
63 | - $container = $this->getContainer(); |
|
64 | - |
|
65 | - $container->registerService('defaultMailAddress', function () { |
|
66 | - return Util::getDefaultEmailAddress('lostpassword-noreply'); |
|
67 | - }); |
|
68 | - |
|
69 | - $server = $container->getServer(); |
|
70 | - /** @var IEventDispatcher $eventDispatcher */ |
|
71 | - $eventDispatcher = $server->query(IEventDispatcher::class); |
|
72 | - |
|
73 | - $notificationManager = $server->getNotificationManager(); |
|
74 | - $notificationManager->registerNotifierService(CoreNotifier::class); |
|
75 | - $notificationManager->registerNotifierService(AuthenticationNotifier::class); |
|
76 | - |
|
77 | - $oldEventDispatcher = $server->getEventDispatcher(); |
|
78 | - |
|
79 | - $oldEventDispatcher->addListener(IDBConnection::CHECK_MISSING_INDEXES_EVENT, |
|
80 | - function (GenericEvent $event) use ($container) { |
|
81 | - /** @var MissingIndexInformation $subject */ |
|
82 | - $subject = $event->getSubject(); |
|
83 | - |
|
84 | - $schema = new SchemaWrapper($container->query(IDBConnection::class)); |
|
85 | - |
|
86 | - if ($schema->hasTable('share')) { |
|
87 | - $table = $schema->getTable('share'); |
|
88 | - |
|
89 | - if (!$table->hasIndex('share_with_index')) { |
|
90 | - $subject->addHintForMissingSubject($table->getName(), 'share_with_index'); |
|
91 | - } |
|
92 | - if (!$table->hasIndex('parent_index')) { |
|
93 | - $subject->addHintForMissingSubject($table->getName(), 'parent_index'); |
|
94 | - } |
|
95 | - if (!$table->hasIndex('owner_index')) { |
|
96 | - $subject->addHintForMissingSubject($table->getName(), 'owner_index'); |
|
97 | - } |
|
98 | - if (!$table->hasIndex('initiator_index')) { |
|
99 | - $subject->addHintForMissingSubject($table->getName(), 'initiator_index'); |
|
100 | - } |
|
101 | - } |
|
102 | - |
|
103 | - if ($schema->hasTable('filecache')) { |
|
104 | - $table = $schema->getTable('filecache'); |
|
105 | - |
|
106 | - if (!$table->hasIndex('fs_mtime')) { |
|
107 | - $subject->addHintForMissingSubject($table->getName(), 'fs_mtime'); |
|
108 | - } |
|
109 | - |
|
110 | - if (!$table->hasIndex('fs_size')) { |
|
111 | - $subject->addHintForMissingSubject($table->getName(), 'fs_size'); |
|
112 | - } |
|
113 | - } |
|
114 | - |
|
115 | - if ($schema->hasTable('twofactor_providers')) { |
|
116 | - $table = $schema->getTable('twofactor_providers'); |
|
117 | - |
|
118 | - if (!$table->hasIndex('twofactor_providers_uid')) { |
|
119 | - $subject->addHintForMissingSubject($table->getName(), 'twofactor_providers_uid'); |
|
120 | - } |
|
121 | - } |
|
122 | - |
|
123 | - if ($schema->hasTable('login_flow_v2')) { |
|
124 | - $table = $schema->getTable('login_flow_v2'); |
|
125 | - |
|
126 | - if (!$table->hasIndex('poll_token')) { |
|
127 | - $subject->addHintForMissingSubject($table->getName(), 'poll_token'); |
|
128 | - } |
|
129 | - if (!$table->hasIndex('login_token')) { |
|
130 | - $subject->addHintForMissingSubject($table->getName(), 'login_token'); |
|
131 | - } |
|
132 | - if (!$table->hasIndex('timestamp')) { |
|
133 | - $subject->addHintForMissingSubject($table->getName(), 'timestamp'); |
|
134 | - } |
|
135 | - } |
|
136 | - |
|
137 | - if ($schema->hasTable('whats_new')) { |
|
138 | - $table = $schema->getTable('whats_new'); |
|
139 | - |
|
140 | - if (!$table->hasIndex('version')) { |
|
141 | - $subject->addHintForMissingSubject($table->getName(), 'version'); |
|
142 | - } |
|
143 | - } |
|
144 | - |
|
145 | - if ($schema->hasTable('cards')) { |
|
146 | - $table = $schema->getTable('cards'); |
|
147 | - |
|
148 | - if (!$table->hasIndex('cards_abid')) { |
|
149 | - $subject->addHintForMissingSubject($table->getName(), 'cards_abid'); |
|
150 | - } |
|
151 | - |
|
152 | - if (!$table->hasIndex('cards_abiduri')) { |
|
153 | - $subject->addHintForMissingSubject($table->getName(), 'cards_abiduri'); |
|
154 | - } |
|
155 | - } |
|
156 | - |
|
157 | - if ($schema->hasTable('cards_properties')) { |
|
158 | - $table = $schema->getTable('cards_properties'); |
|
159 | - |
|
160 | - if (!$table->hasIndex('cards_prop_abid')) { |
|
161 | - $subject->addHintForMissingSubject($table->getName(), 'cards_prop_abid'); |
|
162 | - } |
|
163 | - } |
|
164 | - |
|
165 | - if ($schema->hasTable('calendarobjects_props')) { |
|
166 | - $table = $schema->getTable('calendarobjects_props'); |
|
167 | - |
|
168 | - if (!$table->hasIndex('calendarobject_calid_index')) { |
|
169 | - $subject->addHintForMissingSubject($table->getName(), 'calendarobject_calid_index'); |
|
170 | - } |
|
171 | - } |
|
172 | - |
|
173 | - if ($schema->hasTable('schedulingobjects')) { |
|
174 | - $table = $schema->getTable('schedulingobjects'); |
|
175 | - if (!$table->hasIndex('schedulobj_principuri_index')) { |
|
176 | - $subject->addHintForMissingSubject($table->getName(), 'schedulobj_principuri_index'); |
|
177 | - } |
|
178 | - } |
|
179 | - |
|
180 | - if ($schema->hasTable('properties')) { |
|
181 | - $table = $schema->getTable('properties'); |
|
182 | - if (!$table->hasIndex('properties_path_index')) { |
|
183 | - $subject->addHintForMissingSubject($table->getName(), 'properties_path_index'); |
|
184 | - } |
|
185 | - } |
|
186 | - } |
|
187 | - ); |
|
188 | - |
|
189 | - $oldEventDispatcher->addListener(IDBConnection::CHECK_MISSING_PRIMARY_KEYS_EVENT, |
|
190 | - function (GenericEvent $event) use ($container) { |
|
191 | - /** @var MissingPrimaryKeyInformation $subject */ |
|
192 | - $subject = $event->getSubject(); |
|
193 | - |
|
194 | - $schema = new SchemaWrapper($container->query(IDBConnection::class)); |
|
195 | - |
|
196 | - if ($schema->hasTable('federated_reshares')) { |
|
197 | - $table = $schema->getTable('federated_reshares'); |
|
198 | - |
|
199 | - if (!$table->hasPrimaryKey()) { |
|
200 | - $subject->addHintForMissingSubject($table->getName()); |
|
201 | - } |
|
202 | - } |
|
203 | - |
|
204 | - if ($schema->hasTable('systemtag_object_mapping')) { |
|
205 | - $table = $schema->getTable('systemtag_object_mapping'); |
|
206 | - |
|
207 | - if (!$table->hasPrimaryKey()) { |
|
208 | - $subject->addHintForMissingSubject($table->getName()); |
|
209 | - } |
|
210 | - } |
|
211 | - |
|
212 | - if ($schema->hasTable('comments_read_markers')) { |
|
213 | - $table = $schema->getTable('comments_read_markers'); |
|
214 | - |
|
215 | - if (!$table->hasPrimaryKey()) { |
|
216 | - $subject->addHintForMissingSubject($table->getName()); |
|
217 | - } |
|
218 | - } |
|
219 | - |
|
220 | - if ($schema->hasTable('collres_resources')) { |
|
221 | - $table = $schema->getTable('collres_resources'); |
|
222 | - |
|
223 | - if (!$table->hasPrimaryKey()) { |
|
224 | - $subject->addHintForMissingSubject($table->getName()); |
|
225 | - } |
|
226 | - } |
|
227 | - |
|
228 | - if ($schema->hasTable('collres_accesscache')) { |
|
229 | - $table = $schema->getTable('collres_accesscache'); |
|
230 | - |
|
231 | - if (!$table->hasPrimaryKey()) { |
|
232 | - $subject->addHintForMissingSubject($table->getName()); |
|
233 | - } |
|
234 | - } |
|
235 | - |
|
236 | - if ($schema->hasTable('filecache_extended')) { |
|
237 | - $table = $schema->getTable('filecache_extended'); |
|
238 | - |
|
239 | - if (!$table->hasPrimaryKey()) { |
|
240 | - $subject->addHintForMissingSubject($table->getName()); |
|
241 | - } |
|
242 | - } |
|
243 | - } |
|
244 | - ); |
|
245 | - |
|
246 | - $oldEventDispatcher->addListener(IDBConnection::CHECK_MISSING_COLUMNS_EVENT, |
|
247 | - function (GenericEvent $event) use ($container) { |
|
248 | - /** @var MissingColumnInformation $subject */ |
|
249 | - $subject = $event->getSubject(); |
|
250 | - |
|
251 | - $schema = new SchemaWrapper($container->query(IDBConnection::class)); |
|
252 | - |
|
253 | - if ($schema->hasTable('comments')) { |
|
254 | - $table = $schema->getTable('comments'); |
|
255 | - |
|
256 | - if (!$table->hasColumn('reference_id')) { |
|
257 | - $subject->addHintForMissingColumn($table->getName(), 'reference_id'); |
|
258 | - } |
|
259 | - } |
|
260 | - } |
|
261 | - ); |
|
262 | - |
|
263 | - $eventDispatcher->addServiceListener(RemoteWipeStarted::class, RemoteWipeActivityListener::class); |
|
264 | - $eventDispatcher->addServiceListener(RemoteWipeStarted::class, RemoteWipeNotificationsListener::class); |
|
265 | - $eventDispatcher->addServiceListener(RemoteWipeStarted::class, RemoteWipeEmailListener::class); |
|
266 | - $eventDispatcher->addServiceListener(RemoteWipeFinished::class, RemoteWipeActivityListener::class); |
|
267 | - $eventDispatcher->addServiceListener(RemoteWipeFinished::class, RemoteWipeNotificationsListener::class); |
|
268 | - $eventDispatcher->addServiceListener(RemoteWipeFinished::class, RemoteWipeEmailListener::class); |
|
269 | - $eventDispatcher->addServiceListener(UserDeletedEvent::class, UserDeletedStoreCleanupListener::class); |
|
270 | - $eventDispatcher->addServiceListener(UserDeletedEvent::class, UserDeletedTokenCleanupListener::class); |
|
271 | - } |
|
60 | + public function __construct() { |
|
61 | + parent::__construct('core'); |
|
62 | + |
|
63 | + $container = $this->getContainer(); |
|
64 | + |
|
65 | + $container->registerService('defaultMailAddress', function () { |
|
66 | + return Util::getDefaultEmailAddress('lostpassword-noreply'); |
|
67 | + }); |
|
68 | + |
|
69 | + $server = $container->getServer(); |
|
70 | + /** @var IEventDispatcher $eventDispatcher */ |
|
71 | + $eventDispatcher = $server->query(IEventDispatcher::class); |
|
72 | + |
|
73 | + $notificationManager = $server->getNotificationManager(); |
|
74 | + $notificationManager->registerNotifierService(CoreNotifier::class); |
|
75 | + $notificationManager->registerNotifierService(AuthenticationNotifier::class); |
|
76 | + |
|
77 | + $oldEventDispatcher = $server->getEventDispatcher(); |
|
78 | + |
|
79 | + $oldEventDispatcher->addListener(IDBConnection::CHECK_MISSING_INDEXES_EVENT, |
|
80 | + function (GenericEvent $event) use ($container) { |
|
81 | + /** @var MissingIndexInformation $subject */ |
|
82 | + $subject = $event->getSubject(); |
|
83 | + |
|
84 | + $schema = new SchemaWrapper($container->query(IDBConnection::class)); |
|
85 | + |
|
86 | + if ($schema->hasTable('share')) { |
|
87 | + $table = $schema->getTable('share'); |
|
88 | + |
|
89 | + if (!$table->hasIndex('share_with_index')) { |
|
90 | + $subject->addHintForMissingSubject($table->getName(), 'share_with_index'); |
|
91 | + } |
|
92 | + if (!$table->hasIndex('parent_index')) { |
|
93 | + $subject->addHintForMissingSubject($table->getName(), 'parent_index'); |
|
94 | + } |
|
95 | + if (!$table->hasIndex('owner_index')) { |
|
96 | + $subject->addHintForMissingSubject($table->getName(), 'owner_index'); |
|
97 | + } |
|
98 | + if (!$table->hasIndex('initiator_index')) { |
|
99 | + $subject->addHintForMissingSubject($table->getName(), 'initiator_index'); |
|
100 | + } |
|
101 | + } |
|
102 | + |
|
103 | + if ($schema->hasTable('filecache')) { |
|
104 | + $table = $schema->getTable('filecache'); |
|
105 | + |
|
106 | + if (!$table->hasIndex('fs_mtime')) { |
|
107 | + $subject->addHintForMissingSubject($table->getName(), 'fs_mtime'); |
|
108 | + } |
|
109 | + |
|
110 | + if (!$table->hasIndex('fs_size')) { |
|
111 | + $subject->addHintForMissingSubject($table->getName(), 'fs_size'); |
|
112 | + } |
|
113 | + } |
|
114 | + |
|
115 | + if ($schema->hasTable('twofactor_providers')) { |
|
116 | + $table = $schema->getTable('twofactor_providers'); |
|
117 | + |
|
118 | + if (!$table->hasIndex('twofactor_providers_uid')) { |
|
119 | + $subject->addHintForMissingSubject($table->getName(), 'twofactor_providers_uid'); |
|
120 | + } |
|
121 | + } |
|
122 | + |
|
123 | + if ($schema->hasTable('login_flow_v2')) { |
|
124 | + $table = $schema->getTable('login_flow_v2'); |
|
125 | + |
|
126 | + if (!$table->hasIndex('poll_token')) { |
|
127 | + $subject->addHintForMissingSubject($table->getName(), 'poll_token'); |
|
128 | + } |
|
129 | + if (!$table->hasIndex('login_token')) { |
|
130 | + $subject->addHintForMissingSubject($table->getName(), 'login_token'); |
|
131 | + } |
|
132 | + if (!$table->hasIndex('timestamp')) { |
|
133 | + $subject->addHintForMissingSubject($table->getName(), 'timestamp'); |
|
134 | + } |
|
135 | + } |
|
136 | + |
|
137 | + if ($schema->hasTable('whats_new')) { |
|
138 | + $table = $schema->getTable('whats_new'); |
|
139 | + |
|
140 | + if (!$table->hasIndex('version')) { |
|
141 | + $subject->addHintForMissingSubject($table->getName(), 'version'); |
|
142 | + } |
|
143 | + } |
|
144 | + |
|
145 | + if ($schema->hasTable('cards')) { |
|
146 | + $table = $schema->getTable('cards'); |
|
147 | + |
|
148 | + if (!$table->hasIndex('cards_abid')) { |
|
149 | + $subject->addHintForMissingSubject($table->getName(), 'cards_abid'); |
|
150 | + } |
|
151 | + |
|
152 | + if (!$table->hasIndex('cards_abiduri')) { |
|
153 | + $subject->addHintForMissingSubject($table->getName(), 'cards_abiduri'); |
|
154 | + } |
|
155 | + } |
|
156 | + |
|
157 | + if ($schema->hasTable('cards_properties')) { |
|
158 | + $table = $schema->getTable('cards_properties'); |
|
159 | + |
|
160 | + if (!$table->hasIndex('cards_prop_abid')) { |
|
161 | + $subject->addHintForMissingSubject($table->getName(), 'cards_prop_abid'); |
|
162 | + } |
|
163 | + } |
|
164 | + |
|
165 | + if ($schema->hasTable('calendarobjects_props')) { |
|
166 | + $table = $schema->getTable('calendarobjects_props'); |
|
167 | + |
|
168 | + if (!$table->hasIndex('calendarobject_calid_index')) { |
|
169 | + $subject->addHintForMissingSubject($table->getName(), 'calendarobject_calid_index'); |
|
170 | + } |
|
171 | + } |
|
172 | + |
|
173 | + if ($schema->hasTable('schedulingobjects')) { |
|
174 | + $table = $schema->getTable('schedulingobjects'); |
|
175 | + if (!$table->hasIndex('schedulobj_principuri_index')) { |
|
176 | + $subject->addHintForMissingSubject($table->getName(), 'schedulobj_principuri_index'); |
|
177 | + } |
|
178 | + } |
|
179 | + |
|
180 | + if ($schema->hasTable('properties')) { |
|
181 | + $table = $schema->getTable('properties'); |
|
182 | + if (!$table->hasIndex('properties_path_index')) { |
|
183 | + $subject->addHintForMissingSubject($table->getName(), 'properties_path_index'); |
|
184 | + } |
|
185 | + } |
|
186 | + } |
|
187 | + ); |
|
188 | + |
|
189 | + $oldEventDispatcher->addListener(IDBConnection::CHECK_MISSING_PRIMARY_KEYS_EVENT, |
|
190 | + function (GenericEvent $event) use ($container) { |
|
191 | + /** @var MissingPrimaryKeyInformation $subject */ |
|
192 | + $subject = $event->getSubject(); |
|
193 | + |
|
194 | + $schema = new SchemaWrapper($container->query(IDBConnection::class)); |
|
195 | + |
|
196 | + if ($schema->hasTable('federated_reshares')) { |
|
197 | + $table = $schema->getTable('federated_reshares'); |
|
198 | + |
|
199 | + if (!$table->hasPrimaryKey()) { |
|
200 | + $subject->addHintForMissingSubject($table->getName()); |
|
201 | + } |
|
202 | + } |
|
203 | + |
|
204 | + if ($schema->hasTable('systemtag_object_mapping')) { |
|
205 | + $table = $schema->getTable('systemtag_object_mapping'); |
|
206 | + |
|
207 | + if (!$table->hasPrimaryKey()) { |
|
208 | + $subject->addHintForMissingSubject($table->getName()); |
|
209 | + } |
|
210 | + } |
|
211 | + |
|
212 | + if ($schema->hasTable('comments_read_markers')) { |
|
213 | + $table = $schema->getTable('comments_read_markers'); |
|
214 | + |
|
215 | + if (!$table->hasPrimaryKey()) { |
|
216 | + $subject->addHintForMissingSubject($table->getName()); |
|
217 | + } |
|
218 | + } |
|
219 | + |
|
220 | + if ($schema->hasTable('collres_resources')) { |
|
221 | + $table = $schema->getTable('collres_resources'); |
|
222 | + |
|
223 | + if (!$table->hasPrimaryKey()) { |
|
224 | + $subject->addHintForMissingSubject($table->getName()); |
|
225 | + } |
|
226 | + } |
|
227 | + |
|
228 | + if ($schema->hasTable('collres_accesscache')) { |
|
229 | + $table = $schema->getTable('collres_accesscache'); |
|
230 | + |
|
231 | + if (!$table->hasPrimaryKey()) { |
|
232 | + $subject->addHintForMissingSubject($table->getName()); |
|
233 | + } |
|
234 | + } |
|
235 | + |
|
236 | + if ($schema->hasTable('filecache_extended')) { |
|
237 | + $table = $schema->getTable('filecache_extended'); |
|
238 | + |
|
239 | + if (!$table->hasPrimaryKey()) { |
|
240 | + $subject->addHintForMissingSubject($table->getName()); |
|
241 | + } |
|
242 | + } |
|
243 | + } |
|
244 | + ); |
|
245 | + |
|
246 | + $oldEventDispatcher->addListener(IDBConnection::CHECK_MISSING_COLUMNS_EVENT, |
|
247 | + function (GenericEvent $event) use ($container) { |
|
248 | + /** @var MissingColumnInformation $subject */ |
|
249 | + $subject = $event->getSubject(); |
|
250 | + |
|
251 | + $schema = new SchemaWrapper($container->query(IDBConnection::class)); |
|
252 | + |
|
253 | + if ($schema->hasTable('comments')) { |
|
254 | + $table = $schema->getTable('comments'); |
|
255 | + |
|
256 | + if (!$table->hasColumn('reference_id')) { |
|
257 | + $subject->addHintForMissingColumn($table->getName(), 'reference_id'); |
|
258 | + } |
|
259 | + } |
|
260 | + } |
|
261 | + ); |
|
262 | + |
|
263 | + $eventDispatcher->addServiceListener(RemoteWipeStarted::class, RemoteWipeActivityListener::class); |
|
264 | + $eventDispatcher->addServiceListener(RemoteWipeStarted::class, RemoteWipeNotificationsListener::class); |
|
265 | + $eventDispatcher->addServiceListener(RemoteWipeStarted::class, RemoteWipeEmailListener::class); |
|
266 | + $eventDispatcher->addServiceListener(RemoteWipeFinished::class, RemoteWipeActivityListener::class); |
|
267 | + $eventDispatcher->addServiceListener(RemoteWipeFinished::class, RemoteWipeNotificationsListener::class); |
|
268 | + $eventDispatcher->addServiceListener(RemoteWipeFinished::class, RemoteWipeEmailListener::class); |
|
269 | + $eventDispatcher->addServiceListener(UserDeletedEvent::class, UserDeletedStoreCleanupListener::class); |
|
270 | + $eventDispatcher->addServiceListener(UserDeletedEvent::class, UserDeletedTokenCleanupListener::class); |
|
271 | + } |
|
272 | 272 | } |
@@ -50,267 +50,267 @@ |
||
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 | - $cardsUpdated = false; |
|
204 | - if ($schema->hasTable('cards')) { |
|
205 | - $table = $schema->getTable('cards'); |
|
206 | - |
|
207 | - if ($table->hasIndex('addressbookid_uri_index')) { |
|
208 | - $output->writeln('<info>Renaming addressbookid_uri_index index to to the cards table, this can take some time...</info>'); |
|
209 | - |
|
210 | - foreach ($table->getIndexes() as $index) { |
|
211 | - if ($index->getColumns() === ['addressbookid', 'uri']) { |
|
212 | - $table->renameIndex('addressbookid_uri_index', 'cards_abiduri'); |
|
213 | - } |
|
214 | - } |
|
215 | - |
|
216 | - $this->connection->migrateToSchema($schema->getWrappedSchema()); |
|
217 | - $cardsUpdated = true; |
|
218 | - } |
|
219 | - |
|
220 | - if (!$table->hasIndex('cards_abid')) { |
|
221 | - $output->writeln('<info>Adding cards_abid index to the cards table, this can take some time...</info>'); |
|
222 | - |
|
223 | - foreach ($table->getIndexes() as $index) { |
|
224 | - if ($index->getColumns() === ['addressbookid']) { |
|
225 | - $table->dropIndex($index->getName()); |
|
226 | - } |
|
227 | - } |
|
228 | - |
|
229 | - $table->addIndex(['addressbookid'], 'cards_abid'); |
|
230 | - $this->connection->migrateToSchema($schema->getWrappedSchema()); |
|
231 | - $cardsUpdated = true; |
|
232 | - } |
|
233 | - |
|
234 | - if (!$table->hasIndex('cards_abiduri')) { |
|
235 | - $output->writeln('<info>Adding cards_abiduri index to the cards table, this can take some time...</info>'); |
|
236 | - |
|
237 | - foreach ($table->getIndexes() as $index) { |
|
238 | - if ($index->getColumns() === ['addressbookid', 'uri']) { |
|
239 | - $table->dropIndex($index->getName()); |
|
240 | - } |
|
241 | - } |
|
242 | - |
|
243 | - $table->addIndex(['addressbookid', 'uri'], 'cards_abiduri'); |
|
244 | - $this->connection->migrateToSchema($schema->getWrappedSchema()); |
|
245 | - $cardsUpdated = true; |
|
246 | - } |
|
247 | - |
|
248 | - if ($cardsUpdated) { |
|
249 | - $updated = true; |
|
250 | - $output->writeln('<info>cards table updated successfully.</info>'); |
|
251 | - } |
|
252 | - } |
|
253 | - |
|
254 | - $output->writeln('<info>Check indices of the cards_properties table.</info>'); |
|
255 | - if ($schema->hasTable('cards_properties')) { |
|
256 | - $table = $schema->getTable('cards_properties'); |
|
257 | - if (!$table->hasIndex('cards_prop_abid')) { |
|
258 | - $output->writeln('<info>Adding cards_prop_abid index to the cards_properties table, this can take some time...</info>'); |
|
259 | - |
|
260 | - foreach ($table->getIndexes() as $index) { |
|
261 | - if ($index->getColumns() === ['addressbookid']) { |
|
262 | - $table->dropIndex($index->getName()); |
|
263 | - } |
|
264 | - } |
|
265 | - |
|
266 | - $table->addIndex(['addressbookid'], 'cards_prop_abid'); |
|
267 | - $this->connection->migrateToSchema($schema->getWrappedSchema()); |
|
268 | - $updated = true; |
|
269 | - $output->writeln('<info>cards_properties table updated successfully.</info>'); |
|
270 | - } |
|
271 | - } |
|
272 | - |
|
273 | - $output->writeln('<info>Check indices of the calendarobjects_props table.</info>'); |
|
274 | - if ($schema->hasTable('calendarobjects_props')) { |
|
275 | - $table = $schema->getTable('calendarobjects_props'); |
|
276 | - if (!$table->hasIndex('calendarobject_calid_index')) { |
|
277 | - $output->writeln('<info>Adding calendarobject_calid_index index to the calendarobjects_props table, this can take some time...</info>'); |
|
278 | - |
|
279 | - $table->addIndex(['calendarid', 'calendartype'], 'calendarobject_calid_index'); |
|
280 | - $this->connection->migrateToSchema($schema->getWrappedSchema()); |
|
281 | - $updated = true; |
|
282 | - $output->writeln('<info>calendarobjects_props table updated successfully.</info>'); |
|
283 | - } |
|
284 | - } |
|
285 | - |
|
286 | - $output->writeln('<info>Check indices of the schedulingobjects table.</info>'); |
|
287 | - if ($schema->hasTable('schedulingobjects')) { |
|
288 | - $table = $schema->getTable('schedulingobjects'); |
|
289 | - if (!$table->hasIndex('schedulobj_principuri_index')) { |
|
290 | - $output->writeln('<info>Adding schedulobj_principuri_index index to the schedulingobjects table, this can take some time...</info>'); |
|
291 | - |
|
292 | - $table->addIndex(['principaluri'], 'schedulobj_principuri_index'); |
|
293 | - $this->connection->migrateToSchema($schema->getWrappedSchema()); |
|
294 | - $updated = true; |
|
295 | - $output->writeln('<info>schedulingobjects table updated successfully.</info>'); |
|
296 | - } |
|
297 | - } |
|
298 | - |
|
299 | - $output->writeln('<info>Check indices of the oc_properties table.</info>'); |
|
300 | - if ($schema->hasTable('properties')) { |
|
301 | - $table = $schema->getTable('properties'); |
|
302 | - if (!$table->hasIndex('properties_path_index')) { |
|
303 | - $output->writeln('<info>Adding properties_path_index index to the oc_properties table, this can take some time...</info>'); |
|
304 | - |
|
305 | - $table->addIndex(['userid', 'propertypath'], 'properties_path_index'); |
|
306 | - $this->connection->migrateToSchema($schema->getWrappedSchema()); |
|
307 | - $updated = true; |
|
308 | - $output->writeln('<info>oc_properties table updated successfully.</info>'); |
|
309 | - } |
|
310 | - } |
|
311 | - |
|
312 | - if (!$updated) { |
|
313 | - $output->writeln('<info>Done.</info>'); |
|
314 | - } |
|
315 | - } |
|
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 | + $cardsUpdated = false; |
|
204 | + if ($schema->hasTable('cards')) { |
|
205 | + $table = $schema->getTable('cards'); |
|
206 | + |
|
207 | + if ($table->hasIndex('addressbookid_uri_index')) { |
|
208 | + $output->writeln('<info>Renaming addressbookid_uri_index index to to the cards table, this can take some time...</info>'); |
|
209 | + |
|
210 | + foreach ($table->getIndexes() as $index) { |
|
211 | + if ($index->getColumns() === ['addressbookid', 'uri']) { |
|
212 | + $table->renameIndex('addressbookid_uri_index', 'cards_abiduri'); |
|
213 | + } |
|
214 | + } |
|
215 | + |
|
216 | + $this->connection->migrateToSchema($schema->getWrappedSchema()); |
|
217 | + $cardsUpdated = true; |
|
218 | + } |
|
219 | + |
|
220 | + if (!$table->hasIndex('cards_abid')) { |
|
221 | + $output->writeln('<info>Adding cards_abid index to the cards table, this can take some time...</info>'); |
|
222 | + |
|
223 | + foreach ($table->getIndexes() as $index) { |
|
224 | + if ($index->getColumns() === ['addressbookid']) { |
|
225 | + $table->dropIndex($index->getName()); |
|
226 | + } |
|
227 | + } |
|
228 | + |
|
229 | + $table->addIndex(['addressbookid'], 'cards_abid'); |
|
230 | + $this->connection->migrateToSchema($schema->getWrappedSchema()); |
|
231 | + $cardsUpdated = true; |
|
232 | + } |
|
233 | + |
|
234 | + if (!$table->hasIndex('cards_abiduri')) { |
|
235 | + $output->writeln('<info>Adding cards_abiduri index to the cards table, this can take some time...</info>'); |
|
236 | + |
|
237 | + foreach ($table->getIndexes() as $index) { |
|
238 | + if ($index->getColumns() === ['addressbookid', 'uri']) { |
|
239 | + $table->dropIndex($index->getName()); |
|
240 | + } |
|
241 | + } |
|
242 | + |
|
243 | + $table->addIndex(['addressbookid', 'uri'], 'cards_abiduri'); |
|
244 | + $this->connection->migrateToSchema($schema->getWrappedSchema()); |
|
245 | + $cardsUpdated = true; |
|
246 | + } |
|
247 | + |
|
248 | + if ($cardsUpdated) { |
|
249 | + $updated = true; |
|
250 | + $output->writeln('<info>cards table updated successfully.</info>'); |
|
251 | + } |
|
252 | + } |
|
253 | + |
|
254 | + $output->writeln('<info>Check indices of the cards_properties table.</info>'); |
|
255 | + if ($schema->hasTable('cards_properties')) { |
|
256 | + $table = $schema->getTable('cards_properties'); |
|
257 | + if (!$table->hasIndex('cards_prop_abid')) { |
|
258 | + $output->writeln('<info>Adding cards_prop_abid index to the cards_properties table, this can take some time...</info>'); |
|
259 | + |
|
260 | + foreach ($table->getIndexes() as $index) { |
|
261 | + if ($index->getColumns() === ['addressbookid']) { |
|
262 | + $table->dropIndex($index->getName()); |
|
263 | + } |
|
264 | + } |
|
265 | + |
|
266 | + $table->addIndex(['addressbookid'], 'cards_prop_abid'); |
|
267 | + $this->connection->migrateToSchema($schema->getWrappedSchema()); |
|
268 | + $updated = true; |
|
269 | + $output->writeln('<info>cards_properties table updated successfully.</info>'); |
|
270 | + } |
|
271 | + } |
|
272 | + |
|
273 | + $output->writeln('<info>Check indices of the calendarobjects_props table.</info>'); |
|
274 | + if ($schema->hasTable('calendarobjects_props')) { |
|
275 | + $table = $schema->getTable('calendarobjects_props'); |
|
276 | + if (!$table->hasIndex('calendarobject_calid_index')) { |
|
277 | + $output->writeln('<info>Adding calendarobject_calid_index index to the calendarobjects_props table, this can take some time...</info>'); |
|
278 | + |
|
279 | + $table->addIndex(['calendarid', 'calendartype'], 'calendarobject_calid_index'); |
|
280 | + $this->connection->migrateToSchema($schema->getWrappedSchema()); |
|
281 | + $updated = true; |
|
282 | + $output->writeln('<info>calendarobjects_props table updated successfully.</info>'); |
|
283 | + } |
|
284 | + } |
|
285 | + |
|
286 | + $output->writeln('<info>Check indices of the schedulingobjects table.</info>'); |
|
287 | + if ($schema->hasTable('schedulingobjects')) { |
|
288 | + $table = $schema->getTable('schedulingobjects'); |
|
289 | + if (!$table->hasIndex('schedulobj_principuri_index')) { |
|
290 | + $output->writeln('<info>Adding schedulobj_principuri_index index to the schedulingobjects table, this can take some time...</info>'); |
|
291 | + |
|
292 | + $table->addIndex(['principaluri'], 'schedulobj_principuri_index'); |
|
293 | + $this->connection->migrateToSchema($schema->getWrappedSchema()); |
|
294 | + $updated = true; |
|
295 | + $output->writeln('<info>schedulingobjects table updated successfully.</info>'); |
|
296 | + } |
|
297 | + } |
|
298 | + |
|
299 | + $output->writeln('<info>Check indices of the oc_properties table.</info>'); |
|
300 | + if ($schema->hasTable('properties')) { |
|
301 | + $table = $schema->getTable('properties'); |
|
302 | + if (!$table->hasIndex('properties_path_index')) { |
|
303 | + $output->writeln('<info>Adding properties_path_index index to the oc_properties table, this can take some time...</info>'); |
|
304 | + |
|
305 | + $table->addIndex(['userid', 'propertypath'], 'properties_path_index'); |
|
306 | + $this->connection->migrateToSchema($schema->getWrappedSchema()); |
|
307 | + $updated = true; |
|
308 | + $output->writeln('<info>oc_properties table updated successfully.</info>'); |
|
309 | + } |
|
310 | + } |
|
311 | + |
|
312 | + if (!$updated) { |
|
313 | + $output->writeln('<info>Done.</info>'); |
|
314 | + } |
|
315 | + } |
|
316 | 316 | } |
@@ -33,125 +33,125 @@ |
||
33 | 33 | use OCP\Migration\SimpleMigrationStep; |
34 | 34 | |
35 | 35 | class Version1011Date20200630192246 extends SimpleMigrationStep { |
36 | - /** |
|
37 | - * @param IOutput $output |
|
38 | - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
39 | - * @param array $options |
|
40 | - * @return null|ISchemaWrapper |
|
41 | - */ |
|
42 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { |
|
43 | - /** @var ISchemaWrapper $schema */ |
|
44 | - $schema = $schemaClosure(); |
|
36 | + /** |
|
37 | + * @param IOutput $output |
|
38 | + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
39 | + * @param array $options |
|
40 | + * @return null|ISchemaWrapper |
|
41 | + */ |
|
42 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { |
|
43 | + /** @var ISchemaWrapper $schema */ |
|
44 | + $schema = $schemaClosure(); |
|
45 | 45 | |
46 | - if (!$schema->hasTable('external_mounts')) { |
|
47 | - $table = $schema->createTable('external_mounts'); |
|
48 | - $table->addColumn('mount_id', Types::BIGINT, [ |
|
49 | - 'autoincrement' => true, |
|
50 | - 'notnull' => true, |
|
51 | - 'length' => 6, |
|
52 | - ]); |
|
53 | - $table->addColumn('mount_point', Types::STRING, [ |
|
54 | - 'notnull' => true, |
|
55 | - 'length' => 128, |
|
56 | - ]); |
|
57 | - $table->addColumn('storage_backend', Types::STRING, [ |
|
58 | - 'notnull' => true, |
|
59 | - 'length' => 64, |
|
60 | - ]); |
|
61 | - $table->addColumn('auth_backend', Types::STRING, [ |
|
62 | - 'notnull' => true, |
|
63 | - 'length' => 64, |
|
64 | - ]); |
|
65 | - $table->addColumn('priority', Types::INTEGER, [ |
|
66 | - 'notnull' => true, |
|
67 | - 'length' => 4, |
|
68 | - 'default' => 100, |
|
69 | - ]); |
|
70 | - $table->addColumn('type', Types::INTEGER, [ |
|
71 | - 'notnull' => true, |
|
72 | - 'length' => 4, |
|
73 | - ]); |
|
74 | - $table->setPrimaryKey(['mount_id']); |
|
75 | - } |
|
46 | + if (!$schema->hasTable('external_mounts')) { |
|
47 | + $table = $schema->createTable('external_mounts'); |
|
48 | + $table->addColumn('mount_id', Types::BIGINT, [ |
|
49 | + 'autoincrement' => true, |
|
50 | + 'notnull' => true, |
|
51 | + 'length' => 6, |
|
52 | + ]); |
|
53 | + $table->addColumn('mount_point', Types::STRING, [ |
|
54 | + 'notnull' => true, |
|
55 | + 'length' => 128, |
|
56 | + ]); |
|
57 | + $table->addColumn('storage_backend', Types::STRING, [ |
|
58 | + 'notnull' => true, |
|
59 | + 'length' => 64, |
|
60 | + ]); |
|
61 | + $table->addColumn('auth_backend', Types::STRING, [ |
|
62 | + 'notnull' => true, |
|
63 | + 'length' => 64, |
|
64 | + ]); |
|
65 | + $table->addColumn('priority', Types::INTEGER, [ |
|
66 | + 'notnull' => true, |
|
67 | + 'length' => 4, |
|
68 | + 'default' => 100, |
|
69 | + ]); |
|
70 | + $table->addColumn('type', Types::INTEGER, [ |
|
71 | + 'notnull' => true, |
|
72 | + 'length' => 4, |
|
73 | + ]); |
|
74 | + $table->setPrimaryKey(['mount_id']); |
|
75 | + } |
|
76 | 76 | |
77 | - if (!$schema->hasTable('external_applicable')) { |
|
78 | - $table = $schema->createTable('external_applicable'); |
|
79 | - $table->addColumn('applicable_id', Types::BIGINT, [ |
|
80 | - 'autoincrement' => true, |
|
81 | - 'notnull' => true, |
|
82 | - 'length' => 6, |
|
83 | - ]); |
|
84 | - $table->addColumn('mount_id', Types::BIGINT, [ |
|
85 | - 'notnull' => true, |
|
86 | - 'length' => 6, |
|
87 | - ]); |
|
88 | - $table->addColumn('type', Types::INTEGER, [ |
|
89 | - 'notnull' => true, |
|
90 | - 'length' => 4, |
|
91 | - ]); |
|
92 | - $table->addColumn('value', Types::STRING, [ |
|
93 | - 'notnull' => false, |
|
94 | - 'length' => 64, |
|
95 | - ]); |
|
96 | - $table->setPrimaryKey(['applicable_id']); |
|
97 | - $table->addIndex(['mount_id'], 'applicable_mount'); |
|
98 | - $table->addIndex(['type', 'value'], 'applicable_type_value'); |
|
99 | - $table->addUniqueIndex(['type', 'value', 'mount_id'], 'applicable_type_value_mount'); |
|
100 | - } |
|
77 | + if (!$schema->hasTable('external_applicable')) { |
|
78 | + $table = $schema->createTable('external_applicable'); |
|
79 | + $table->addColumn('applicable_id', Types::BIGINT, [ |
|
80 | + 'autoincrement' => true, |
|
81 | + 'notnull' => true, |
|
82 | + 'length' => 6, |
|
83 | + ]); |
|
84 | + $table->addColumn('mount_id', Types::BIGINT, [ |
|
85 | + 'notnull' => true, |
|
86 | + 'length' => 6, |
|
87 | + ]); |
|
88 | + $table->addColumn('type', Types::INTEGER, [ |
|
89 | + 'notnull' => true, |
|
90 | + 'length' => 4, |
|
91 | + ]); |
|
92 | + $table->addColumn('value', Types::STRING, [ |
|
93 | + 'notnull' => false, |
|
94 | + 'length' => 64, |
|
95 | + ]); |
|
96 | + $table->setPrimaryKey(['applicable_id']); |
|
97 | + $table->addIndex(['mount_id'], 'applicable_mount'); |
|
98 | + $table->addIndex(['type', 'value'], 'applicable_type_value'); |
|
99 | + $table->addUniqueIndex(['type', 'value', 'mount_id'], 'applicable_type_value_mount'); |
|
100 | + } |
|
101 | 101 | |
102 | - if (!$schema->hasTable('external_config')) { |
|
103 | - $table = $schema->createTable('external_config'); |
|
104 | - $table->addColumn('config_id', Types::BIGINT, [ |
|
105 | - 'autoincrement' => true, |
|
106 | - 'notnull' => true, |
|
107 | - 'length' => 6, |
|
108 | - ]); |
|
109 | - $table->addColumn('mount_id', Types::BIGINT, [ |
|
110 | - 'notnull' => true, |
|
111 | - 'length' => 6, |
|
112 | - ]); |
|
113 | - $table->addColumn('key', Types::STRING, [ |
|
114 | - 'notnull' => true, |
|
115 | - 'length' => 64, |
|
116 | - ]); |
|
117 | - $table->addColumn('value', Types::STRING, [ |
|
118 | - 'notnull' => false, |
|
119 | - 'length' => 4096, |
|
120 | - ]); |
|
121 | - $table->setPrimaryKey(['config_id']); |
|
122 | - $table->addIndex(['mount_id'], 'config_mount'); |
|
123 | - $table->addUniqueIndex(['mount_id', 'key'], 'config_mount_key'); |
|
124 | - } else { |
|
125 | - $table = $schema->getTable('external_config'); |
|
126 | - $table->changeColumn('value', [ |
|
127 | - 'notnull' => false, |
|
128 | - 'length' => 4096, |
|
129 | - ]); |
|
130 | - } |
|
102 | + if (!$schema->hasTable('external_config')) { |
|
103 | + $table = $schema->createTable('external_config'); |
|
104 | + $table->addColumn('config_id', Types::BIGINT, [ |
|
105 | + 'autoincrement' => true, |
|
106 | + 'notnull' => true, |
|
107 | + 'length' => 6, |
|
108 | + ]); |
|
109 | + $table->addColumn('mount_id', Types::BIGINT, [ |
|
110 | + 'notnull' => true, |
|
111 | + 'length' => 6, |
|
112 | + ]); |
|
113 | + $table->addColumn('key', Types::STRING, [ |
|
114 | + 'notnull' => true, |
|
115 | + 'length' => 64, |
|
116 | + ]); |
|
117 | + $table->addColumn('value', Types::STRING, [ |
|
118 | + 'notnull' => false, |
|
119 | + 'length' => 4096, |
|
120 | + ]); |
|
121 | + $table->setPrimaryKey(['config_id']); |
|
122 | + $table->addIndex(['mount_id'], 'config_mount'); |
|
123 | + $table->addUniqueIndex(['mount_id', 'key'], 'config_mount_key'); |
|
124 | + } else { |
|
125 | + $table = $schema->getTable('external_config'); |
|
126 | + $table->changeColumn('value', [ |
|
127 | + 'notnull' => false, |
|
128 | + 'length' => 4096, |
|
129 | + ]); |
|
130 | + } |
|
131 | 131 | |
132 | - if (!$schema->hasTable('external_options')) { |
|
133 | - $table = $schema->createTable('external_options'); |
|
134 | - $table->addColumn('option_id', Types::BIGINT, [ |
|
135 | - 'autoincrement' => true, |
|
136 | - 'notnull' => true, |
|
137 | - 'length' => 6, |
|
138 | - ]); |
|
139 | - $table->addColumn('mount_id', Types::BIGINT, [ |
|
140 | - 'notnull' => true, |
|
141 | - 'length' => 6, |
|
142 | - ]); |
|
143 | - $table->addColumn('key', Types::STRING, [ |
|
144 | - 'notnull' => true, |
|
145 | - 'length' => 64, |
|
146 | - ]); |
|
147 | - $table->addColumn('value', Types::STRING, [ |
|
148 | - 'notnull' => true, |
|
149 | - 'length' => 256, |
|
150 | - ]); |
|
151 | - $table->setPrimaryKey(['option_id']); |
|
152 | - $table->addIndex(['mount_id'], 'option_mount'); |
|
153 | - $table->addUniqueIndex(['mount_id', 'key'], 'option_mount_key'); |
|
154 | - } |
|
155 | - return $schema; |
|
156 | - } |
|
132 | + if (!$schema->hasTable('external_options')) { |
|
133 | + $table = $schema->createTable('external_options'); |
|
134 | + $table->addColumn('option_id', Types::BIGINT, [ |
|
135 | + 'autoincrement' => true, |
|
136 | + 'notnull' => true, |
|
137 | + 'length' => 6, |
|
138 | + ]); |
|
139 | + $table->addColumn('mount_id', Types::BIGINT, [ |
|
140 | + 'notnull' => true, |
|
141 | + 'length' => 6, |
|
142 | + ]); |
|
143 | + $table->addColumn('key', Types::STRING, [ |
|
144 | + 'notnull' => true, |
|
145 | + 'length' => 64, |
|
146 | + ]); |
|
147 | + $table->addColumn('value', Types::STRING, [ |
|
148 | + 'notnull' => true, |
|
149 | + 'length' => 256, |
|
150 | + ]); |
|
151 | + $table->setPrimaryKey(['option_id']); |
|
152 | + $table->addIndex(['mount_id'], 'option_mount'); |
|
153 | + $table->addUniqueIndex(['mount_id', 'key'], 'option_mount_key'); |
|
154 | + } |
|
155 | + return $schema; |
|
156 | + } |
|
157 | 157 | } |
@@ -30,467 +30,467 @@ |
||
30 | 30 | use OCP\Migration\SimpleMigrationStep; |
31 | 31 | |
32 | 32 | class Version1004Date20170825134824 extends SimpleMigrationStep { |
33 | - /** |
|
34 | - * @param IOutput $output |
|
35 | - * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
36 | - * @param array $options |
|
37 | - * @return null|ISchemaWrapper |
|
38 | - * @since 13.0.0 |
|
39 | - */ |
|
40 | - public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
|
41 | - /** @var ISchemaWrapper $schema */ |
|
42 | - $schema = $schemaClosure(); |
|
33 | + /** |
|
34 | + * @param IOutput $output |
|
35 | + * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
36 | + * @param array $options |
|
37 | + * @return null|ISchemaWrapper |
|
38 | + * @since 13.0.0 |
|
39 | + */ |
|
40 | + public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
|
41 | + /** @var ISchemaWrapper $schema */ |
|
42 | + $schema = $schemaClosure(); |
|
43 | 43 | |
44 | - if (!$schema->hasTable('addressbooks')) { |
|
45 | - $table = $schema->createTable('addressbooks'); |
|
46 | - $table->addColumn('id', 'bigint', [ |
|
47 | - 'autoincrement' => true, |
|
48 | - 'notnull' => true, |
|
49 | - 'length' => 11, |
|
50 | - 'unsigned' => true, |
|
51 | - ]); |
|
52 | - $table->addColumn('principaluri', 'string', [ |
|
53 | - 'notnull' => false, |
|
54 | - 'length' => 255, |
|
55 | - ]); |
|
56 | - $table->addColumn('displayname', 'string', [ |
|
57 | - 'notnull' => false, |
|
58 | - 'length' => 255, |
|
59 | - ]); |
|
60 | - $table->addColumn('uri', 'string', [ |
|
61 | - 'notnull' => false, |
|
62 | - 'length' => 255, |
|
63 | - ]); |
|
64 | - $table->addColumn('description', 'string', [ |
|
65 | - 'notnull' => false, |
|
66 | - 'length' => 255, |
|
67 | - ]); |
|
68 | - $table->addColumn('synctoken', 'integer', [ |
|
69 | - 'notnull' => true, |
|
70 | - 'default' => 1, |
|
71 | - 'length' => 10, |
|
72 | - 'unsigned' => true, |
|
73 | - ]); |
|
74 | - $table->setPrimaryKey(['id']); |
|
75 | - $table->addUniqueIndex(['principaluri', 'uri'], 'addressbook_index'); |
|
76 | - } |
|
44 | + if (!$schema->hasTable('addressbooks')) { |
|
45 | + $table = $schema->createTable('addressbooks'); |
|
46 | + $table->addColumn('id', 'bigint', [ |
|
47 | + 'autoincrement' => true, |
|
48 | + 'notnull' => true, |
|
49 | + 'length' => 11, |
|
50 | + 'unsigned' => true, |
|
51 | + ]); |
|
52 | + $table->addColumn('principaluri', 'string', [ |
|
53 | + 'notnull' => false, |
|
54 | + 'length' => 255, |
|
55 | + ]); |
|
56 | + $table->addColumn('displayname', 'string', [ |
|
57 | + 'notnull' => false, |
|
58 | + 'length' => 255, |
|
59 | + ]); |
|
60 | + $table->addColumn('uri', 'string', [ |
|
61 | + 'notnull' => false, |
|
62 | + 'length' => 255, |
|
63 | + ]); |
|
64 | + $table->addColumn('description', 'string', [ |
|
65 | + 'notnull' => false, |
|
66 | + 'length' => 255, |
|
67 | + ]); |
|
68 | + $table->addColumn('synctoken', 'integer', [ |
|
69 | + 'notnull' => true, |
|
70 | + 'default' => 1, |
|
71 | + 'length' => 10, |
|
72 | + 'unsigned' => true, |
|
73 | + ]); |
|
74 | + $table->setPrimaryKey(['id']); |
|
75 | + $table->addUniqueIndex(['principaluri', 'uri'], 'addressbook_index'); |
|
76 | + } |
|
77 | 77 | |
78 | - if (!$schema->hasTable('cards')) { |
|
79 | - $table = $schema->createTable('cards'); |
|
80 | - $table->addColumn('id', 'bigint', [ |
|
81 | - 'autoincrement' => true, |
|
82 | - 'notnull' => true, |
|
83 | - 'length' => 11, |
|
84 | - 'unsigned' => true, |
|
85 | - ]); |
|
86 | - $table->addColumn('addressbookid', 'integer', [ |
|
87 | - 'notnull' => true, |
|
88 | - 'default' => 0, |
|
89 | - ]); |
|
90 | - $table->addColumn('carddata', 'blob', [ |
|
91 | - 'notnull' => false, |
|
92 | - ]); |
|
93 | - $table->addColumn('uri', 'string', [ |
|
94 | - 'notnull' => false, |
|
95 | - 'length' => 255, |
|
96 | - ]); |
|
97 | - $table->addColumn('lastmodified', 'bigint', [ |
|
98 | - 'notnull' => false, |
|
99 | - 'length' => 11, |
|
100 | - 'unsigned' => true, |
|
101 | - ]); |
|
102 | - $table->addColumn('etag', 'string', [ |
|
103 | - 'notnull' => false, |
|
104 | - 'length' => 32, |
|
105 | - ]); |
|
106 | - $table->addColumn('size', 'bigint', [ |
|
107 | - 'notnull' => true, |
|
108 | - 'length' => 11, |
|
109 | - 'unsigned' => true, |
|
110 | - ]); |
|
111 | - $table->setPrimaryKey(['id']); |
|
112 | - } |
|
78 | + if (!$schema->hasTable('cards')) { |
|
79 | + $table = $schema->createTable('cards'); |
|
80 | + $table->addColumn('id', 'bigint', [ |
|
81 | + 'autoincrement' => true, |
|
82 | + 'notnull' => true, |
|
83 | + 'length' => 11, |
|
84 | + 'unsigned' => true, |
|
85 | + ]); |
|
86 | + $table->addColumn('addressbookid', 'integer', [ |
|
87 | + 'notnull' => true, |
|
88 | + 'default' => 0, |
|
89 | + ]); |
|
90 | + $table->addColumn('carddata', 'blob', [ |
|
91 | + 'notnull' => false, |
|
92 | + ]); |
|
93 | + $table->addColumn('uri', 'string', [ |
|
94 | + 'notnull' => false, |
|
95 | + 'length' => 255, |
|
96 | + ]); |
|
97 | + $table->addColumn('lastmodified', 'bigint', [ |
|
98 | + 'notnull' => false, |
|
99 | + 'length' => 11, |
|
100 | + 'unsigned' => true, |
|
101 | + ]); |
|
102 | + $table->addColumn('etag', 'string', [ |
|
103 | + 'notnull' => false, |
|
104 | + 'length' => 32, |
|
105 | + ]); |
|
106 | + $table->addColumn('size', 'bigint', [ |
|
107 | + 'notnull' => true, |
|
108 | + 'length' => 11, |
|
109 | + 'unsigned' => true, |
|
110 | + ]); |
|
111 | + $table->setPrimaryKey(['id']); |
|
112 | + } |
|
113 | 113 | |
114 | - if (!$schema->hasTable('addressbookchanges')) { |
|
115 | - $table = $schema->createTable('addressbookchanges'); |
|
116 | - $table->addColumn('id', 'bigint', [ |
|
117 | - 'autoincrement' => true, |
|
118 | - 'notnull' => true, |
|
119 | - 'length' => 11, |
|
120 | - 'unsigned' => true, |
|
121 | - ]); |
|
122 | - $table->addColumn('uri', 'string', [ |
|
123 | - 'notnull' => false, |
|
124 | - 'length' => 255, |
|
125 | - ]); |
|
126 | - $table->addColumn('synctoken', 'integer', [ |
|
127 | - 'notnull' => true, |
|
128 | - 'default' => 1, |
|
129 | - 'length' => 10, |
|
130 | - 'unsigned' => true, |
|
131 | - ]); |
|
132 | - $table->addColumn('addressbookid', 'integer', [ |
|
133 | - 'notnull' => true, |
|
134 | - ]); |
|
135 | - $table->addColumn('operation', 'smallint', [ |
|
136 | - 'notnull' => true, |
|
137 | - 'length' => 1, |
|
138 | - ]); |
|
139 | - $table->setPrimaryKey(['id']); |
|
140 | - $table->addIndex(['addressbookid', 'synctoken'], 'addressbookid_synctoken'); |
|
141 | - } |
|
114 | + if (!$schema->hasTable('addressbookchanges')) { |
|
115 | + $table = $schema->createTable('addressbookchanges'); |
|
116 | + $table->addColumn('id', 'bigint', [ |
|
117 | + 'autoincrement' => true, |
|
118 | + 'notnull' => true, |
|
119 | + 'length' => 11, |
|
120 | + 'unsigned' => true, |
|
121 | + ]); |
|
122 | + $table->addColumn('uri', 'string', [ |
|
123 | + 'notnull' => false, |
|
124 | + 'length' => 255, |
|
125 | + ]); |
|
126 | + $table->addColumn('synctoken', 'integer', [ |
|
127 | + 'notnull' => true, |
|
128 | + 'default' => 1, |
|
129 | + 'length' => 10, |
|
130 | + 'unsigned' => true, |
|
131 | + ]); |
|
132 | + $table->addColumn('addressbookid', 'integer', [ |
|
133 | + 'notnull' => true, |
|
134 | + ]); |
|
135 | + $table->addColumn('operation', 'smallint', [ |
|
136 | + 'notnull' => true, |
|
137 | + 'length' => 1, |
|
138 | + ]); |
|
139 | + $table->setPrimaryKey(['id']); |
|
140 | + $table->addIndex(['addressbookid', 'synctoken'], 'addressbookid_synctoken'); |
|
141 | + } |
|
142 | 142 | |
143 | - if (!$schema->hasTable('calendarobjects')) { |
|
144 | - $table = $schema->createTable('calendarobjects'); |
|
145 | - $table->addColumn('id', 'bigint', [ |
|
146 | - 'autoincrement' => true, |
|
147 | - 'notnull' => true, |
|
148 | - 'length' => 11, |
|
149 | - 'unsigned' => true, |
|
150 | - ]); |
|
151 | - $table->addColumn('calendardata', 'blob', [ |
|
152 | - 'notnull' => false, |
|
153 | - ]); |
|
154 | - $table->addColumn('uri', 'string', [ |
|
155 | - 'notnull' => false, |
|
156 | - 'length' => 255, |
|
157 | - ]); |
|
158 | - $table->addColumn('calendarid', 'integer', [ |
|
159 | - 'notnull' => true, |
|
160 | - 'length' => 10, |
|
161 | - 'unsigned' => true, |
|
162 | - ]); |
|
163 | - $table->addColumn('lastmodified', 'integer', [ |
|
164 | - 'notnull' => false, |
|
165 | - 'length' => 10, |
|
166 | - 'unsigned' => true, |
|
167 | - ]); |
|
168 | - $table->addColumn('etag', 'string', [ |
|
169 | - 'notnull' => false, |
|
170 | - 'length' => 32, |
|
171 | - ]); |
|
172 | - $table->addColumn('size', 'bigint', [ |
|
173 | - 'notnull' => true, |
|
174 | - 'length' => 11, |
|
175 | - 'unsigned' => true, |
|
176 | - ]); |
|
177 | - $table->addColumn('componenttype', 'string', [ |
|
178 | - 'notnull' => false, |
|
179 | - 'length' => 8, |
|
180 | - ]); |
|
181 | - $table->addColumn('firstoccurence', 'bigint', [ |
|
182 | - 'notnull' => false, |
|
183 | - 'length' => 11, |
|
184 | - 'unsigned' => true, |
|
185 | - ]); |
|
186 | - $table->addColumn('lastoccurence', 'bigint', [ |
|
187 | - 'notnull' => false, |
|
188 | - 'length' => 11, |
|
189 | - 'unsigned' => true, |
|
190 | - ]); |
|
191 | - $table->addColumn('uid', 'string', [ |
|
192 | - 'notnull' => false, |
|
193 | - 'length' => 255, |
|
194 | - ]); |
|
195 | - $table->addColumn('classification', 'integer', [ |
|
196 | - 'notnull' => false, |
|
197 | - 'default' => 0, |
|
198 | - ]); |
|
199 | - $table->setPrimaryKey(['id']); |
|
200 | - $table->addUniqueIndex(['calendarid', 'uri'], 'calobjects_index'); |
|
201 | - } |
|
143 | + if (!$schema->hasTable('calendarobjects')) { |
|
144 | + $table = $schema->createTable('calendarobjects'); |
|
145 | + $table->addColumn('id', 'bigint', [ |
|
146 | + 'autoincrement' => true, |
|
147 | + 'notnull' => true, |
|
148 | + 'length' => 11, |
|
149 | + 'unsigned' => true, |
|
150 | + ]); |
|
151 | + $table->addColumn('calendardata', 'blob', [ |
|
152 | + 'notnull' => false, |
|
153 | + ]); |
|
154 | + $table->addColumn('uri', 'string', [ |
|
155 | + 'notnull' => false, |
|
156 | + 'length' => 255, |
|
157 | + ]); |
|
158 | + $table->addColumn('calendarid', 'integer', [ |
|
159 | + 'notnull' => true, |
|
160 | + 'length' => 10, |
|
161 | + 'unsigned' => true, |
|
162 | + ]); |
|
163 | + $table->addColumn('lastmodified', 'integer', [ |
|
164 | + 'notnull' => false, |
|
165 | + 'length' => 10, |
|
166 | + 'unsigned' => true, |
|
167 | + ]); |
|
168 | + $table->addColumn('etag', 'string', [ |
|
169 | + 'notnull' => false, |
|
170 | + 'length' => 32, |
|
171 | + ]); |
|
172 | + $table->addColumn('size', 'bigint', [ |
|
173 | + 'notnull' => true, |
|
174 | + 'length' => 11, |
|
175 | + 'unsigned' => true, |
|
176 | + ]); |
|
177 | + $table->addColumn('componenttype', 'string', [ |
|
178 | + 'notnull' => false, |
|
179 | + 'length' => 8, |
|
180 | + ]); |
|
181 | + $table->addColumn('firstoccurence', 'bigint', [ |
|
182 | + 'notnull' => false, |
|
183 | + 'length' => 11, |
|
184 | + 'unsigned' => true, |
|
185 | + ]); |
|
186 | + $table->addColumn('lastoccurence', 'bigint', [ |
|
187 | + 'notnull' => false, |
|
188 | + 'length' => 11, |
|
189 | + 'unsigned' => true, |
|
190 | + ]); |
|
191 | + $table->addColumn('uid', 'string', [ |
|
192 | + 'notnull' => false, |
|
193 | + 'length' => 255, |
|
194 | + ]); |
|
195 | + $table->addColumn('classification', 'integer', [ |
|
196 | + 'notnull' => false, |
|
197 | + 'default' => 0, |
|
198 | + ]); |
|
199 | + $table->setPrimaryKey(['id']); |
|
200 | + $table->addUniqueIndex(['calendarid', 'uri'], 'calobjects_index'); |
|
201 | + } |
|
202 | 202 | |
203 | - if (!$schema->hasTable('calendars')) { |
|
204 | - $table = $schema->createTable('calendars'); |
|
205 | - $table->addColumn('id', 'bigint', [ |
|
206 | - 'autoincrement' => true, |
|
207 | - 'notnull' => true, |
|
208 | - 'length' => 11, |
|
209 | - 'unsigned' => true, |
|
210 | - ]); |
|
211 | - $table->addColumn('principaluri', 'string', [ |
|
212 | - 'notnull' => false, |
|
213 | - 'length' => 255, |
|
214 | - ]); |
|
215 | - $table->addColumn('displayname', 'string', [ |
|
216 | - 'notnull' => false, |
|
217 | - 'length' => 255, |
|
218 | - ]); |
|
219 | - $table->addColumn('uri', 'string', [ |
|
220 | - 'notnull' => false, |
|
221 | - 'length' => 255, |
|
222 | - ]); |
|
223 | - $table->addColumn('synctoken', 'integer', [ |
|
224 | - 'notnull' => true, |
|
225 | - 'default' => 1, |
|
226 | - 'unsigned' => true, |
|
227 | - ]); |
|
228 | - $table->addColumn('description', 'string', [ |
|
229 | - 'notnull' => false, |
|
230 | - 'length' => 255, |
|
231 | - ]); |
|
232 | - $table->addColumn('calendarorder', 'integer', [ |
|
233 | - 'notnull' => true, |
|
234 | - 'default' => 0, |
|
235 | - 'unsigned' => true, |
|
236 | - ]); |
|
237 | - $table->addColumn('calendarcolor', 'string', [ |
|
238 | - 'notnull' => false, |
|
239 | - ]); |
|
240 | - $table->addColumn('timezone', 'text', [ |
|
241 | - 'notnull' => false, |
|
242 | - ]); |
|
243 | - $table->addColumn('components', 'string', [ |
|
244 | - 'notnull' => false, |
|
245 | - 'length' => 64, |
|
246 | - ]); |
|
247 | - $table->addColumn('transparent', 'smallint', [ |
|
248 | - 'notnull' => true, |
|
249 | - 'length' => 1, |
|
250 | - 'default' => 0, |
|
251 | - ]); |
|
252 | - $table->setPrimaryKey(['id']); |
|
253 | - $table->addUniqueIndex(['principaluri', 'uri'], 'calendars_index'); |
|
254 | - } else { |
|
255 | - $table = $schema->getTable('calendars'); |
|
256 | - $table->changeColumn('components', [ |
|
257 | - 'notnull' => false, |
|
258 | - 'length' => 64, |
|
259 | - ]); |
|
260 | - } |
|
203 | + if (!$schema->hasTable('calendars')) { |
|
204 | + $table = $schema->createTable('calendars'); |
|
205 | + $table->addColumn('id', 'bigint', [ |
|
206 | + 'autoincrement' => true, |
|
207 | + 'notnull' => true, |
|
208 | + 'length' => 11, |
|
209 | + 'unsigned' => true, |
|
210 | + ]); |
|
211 | + $table->addColumn('principaluri', 'string', [ |
|
212 | + 'notnull' => false, |
|
213 | + 'length' => 255, |
|
214 | + ]); |
|
215 | + $table->addColumn('displayname', 'string', [ |
|
216 | + 'notnull' => false, |
|
217 | + 'length' => 255, |
|
218 | + ]); |
|
219 | + $table->addColumn('uri', 'string', [ |
|
220 | + 'notnull' => false, |
|
221 | + 'length' => 255, |
|
222 | + ]); |
|
223 | + $table->addColumn('synctoken', 'integer', [ |
|
224 | + 'notnull' => true, |
|
225 | + 'default' => 1, |
|
226 | + 'unsigned' => true, |
|
227 | + ]); |
|
228 | + $table->addColumn('description', 'string', [ |
|
229 | + 'notnull' => false, |
|
230 | + 'length' => 255, |
|
231 | + ]); |
|
232 | + $table->addColumn('calendarorder', 'integer', [ |
|
233 | + 'notnull' => true, |
|
234 | + 'default' => 0, |
|
235 | + 'unsigned' => true, |
|
236 | + ]); |
|
237 | + $table->addColumn('calendarcolor', 'string', [ |
|
238 | + 'notnull' => false, |
|
239 | + ]); |
|
240 | + $table->addColumn('timezone', 'text', [ |
|
241 | + 'notnull' => false, |
|
242 | + ]); |
|
243 | + $table->addColumn('components', 'string', [ |
|
244 | + 'notnull' => false, |
|
245 | + 'length' => 64, |
|
246 | + ]); |
|
247 | + $table->addColumn('transparent', 'smallint', [ |
|
248 | + 'notnull' => true, |
|
249 | + 'length' => 1, |
|
250 | + 'default' => 0, |
|
251 | + ]); |
|
252 | + $table->setPrimaryKey(['id']); |
|
253 | + $table->addUniqueIndex(['principaluri', 'uri'], 'calendars_index'); |
|
254 | + } else { |
|
255 | + $table = $schema->getTable('calendars'); |
|
256 | + $table->changeColumn('components', [ |
|
257 | + 'notnull' => false, |
|
258 | + 'length' => 64, |
|
259 | + ]); |
|
260 | + } |
|
261 | 261 | |
262 | - if (!$schema->hasTable('calendarchanges')) { |
|
263 | - $table = $schema->createTable('calendarchanges'); |
|
264 | - $table->addColumn('id', 'bigint', [ |
|
265 | - 'autoincrement' => true, |
|
266 | - 'notnull' => true, |
|
267 | - 'length' => 11, |
|
268 | - 'unsigned' => true, |
|
269 | - ]); |
|
270 | - $table->addColumn('uri', 'string', [ |
|
271 | - 'notnull' => false, |
|
272 | - 'length' => 255, |
|
273 | - ]); |
|
274 | - $table->addColumn('synctoken', 'integer', [ |
|
275 | - 'notnull' => true, |
|
276 | - 'default' => 1, |
|
277 | - 'length' => 10, |
|
278 | - 'unsigned' => true, |
|
279 | - ]); |
|
280 | - $table->addColumn('calendarid', 'integer', [ |
|
281 | - 'notnull' => true, |
|
282 | - ]); |
|
283 | - $table->addColumn('operation', 'smallint', [ |
|
284 | - 'notnull' => true, |
|
285 | - 'length' => 1, |
|
286 | - ]); |
|
287 | - $table->setPrimaryKey(['id']); |
|
288 | - $table->addIndex(['calendarid', 'synctoken'], 'calendarid_synctoken'); |
|
289 | - } |
|
262 | + if (!$schema->hasTable('calendarchanges')) { |
|
263 | + $table = $schema->createTable('calendarchanges'); |
|
264 | + $table->addColumn('id', 'bigint', [ |
|
265 | + 'autoincrement' => true, |
|
266 | + 'notnull' => true, |
|
267 | + 'length' => 11, |
|
268 | + 'unsigned' => true, |
|
269 | + ]); |
|
270 | + $table->addColumn('uri', 'string', [ |
|
271 | + 'notnull' => false, |
|
272 | + 'length' => 255, |
|
273 | + ]); |
|
274 | + $table->addColumn('synctoken', 'integer', [ |
|
275 | + 'notnull' => true, |
|
276 | + 'default' => 1, |
|
277 | + 'length' => 10, |
|
278 | + 'unsigned' => true, |
|
279 | + ]); |
|
280 | + $table->addColumn('calendarid', 'integer', [ |
|
281 | + 'notnull' => true, |
|
282 | + ]); |
|
283 | + $table->addColumn('operation', 'smallint', [ |
|
284 | + 'notnull' => true, |
|
285 | + 'length' => 1, |
|
286 | + ]); |
|
287 | + $table->setPrimaryKey(['id']); |
|
288 | + $table->addIndex(['calendarid', 'synctoken'], 'calendarid_synctoken'); |
|
289 | + } |
|
290 | 290 | |
291 | - if (!$schema->hasTable('calendarsubscriptions')) { |
|
292 | - $table = $schema->createTable('calendarsubscriptions'); |
|
293 | - $table->addColumn('id', 'bigint', [ |
|
294 | - 'autoincrement' => true, |
|
295 | - 'notnull' => true, |
|
296 | - 'length' => 11, |
|
297 | - 'unsigned' => true, |
|
298 | - ]); |
|
299 | - $table->addColumn('uri', 'string', [ |
|
300 | - 'notnull' => false, |
|
301 | - ]); |
|
302 | - $table->addColumn('principaluri', 'string', [ |
|
303 | - 'notnull' => false, |
|
304 | - 'length' => 255, |
|
305 | - ]); |
|
306 | - $table->addColumn('source', 'string', [ |
|
307 | - 'notnull' => false, |
|
308 | - 'length' => 255, |
|
309 | - ]); |
|
310 | - $table->addColumn('displayname', 'string', [ |
|
311 | - 'notnull' => false, |
|
312 | - 'length' => 100, |
|
313 | - ]); |
|
314 | - $table->addColumn('refreshrate', 'string', [ |
|
315 | - 'notnull' => false, |
|
316 | - 'length' => 10, |
|
317 | - ]); |
|
318 | - $table->addColumn('calendarorder', 'integer', [ |
|
319 | - 'notnull' => true, |
|
320 | - 'default' => 0, |
|
321 | - 'unsigned' => true, |
|
322 | - ]); |
|
323 | - $table->addColumn('calendarcolor', 'string', [ |
|
324 | - 'notnull' => false, |
|
325 | - ]); |
|
326 | - $table->addColumn('striptodos', 'smallint', [ |
|
327 | - 'notnull' => false, |
|
328 | - 'length' => 1, |
|
329 | - ]); |
|
330 | - $table->addColumn('stripalarms', 'smallint', [ |
|
331 | - 'notnull' => false, |
|
332 | - 'length' => 1, |
|
333 | - ]); |
|
334 | - $table->addColumn('stripattachments', 'smallint', [ |
|
335 | - 'notnull' => false, |
|
336 | - 'length' => 1, |
|
337 | - ]); |
|
338 | - $table->addColumn('lastmodified', 'integer', [ |
|
339 | - 'notnull' => false, |
|
340 | - 'unsigned' => true, |
|
341 | - ]); |
|
342 | - $table->setPrimaryKey(['id']); |
|
343 | - $table->addUniqueIndex(['principaluri', 'uri'], 'calsub_index'); |
|
344 | - } else { |
|
345 | - $table = $schema->getTable('calendarsubscriptions'); |
|
346 | - $table->changeColumn('lastmodified', [ |
|
347 | - 'notnull' => false, |
|
348 | - 'unsigned' => true, |
|
349 | - ]); |
|
350 | - } |
|
291 | + if (!$schema->hasTable('calendarsubscriptions')) { |
|
292 | + $table = $schema->createTable('calendarsubscriptions'); |
|
293 | + $table->addColumn('id', 'bigint', [ |
|
294 | + 'autoincrement' => true, |
|
295 | + 'notnull' => true, |
|
296 | + 'length' => 11, |
|
297 | + 'unsigned' => true, |
|
298 | + ]); |
|
299 | + $table->addColumn('uri', 'string', [ |
|
300 | + 'notnull' => false, |
|
301 | + ]); |
|
302 | + $table->addColumn('principaluri', 'string', [ |
|
303 | + 'notnull' => false, |
|
304 | + 'length' => 255, |
|
305 | + ]); |
|
306 | + $table->addColumn('source', 'string', [ |
|
307 | + 'notnull' => false, |
|
308 | + 'length' => 255, |
|
309 | + ]); |
|
310 | + $table->addColumn('displayname', 'string', [ |
|
311 | + 'notnull' => false, |
|
312 | + 'length' => 100, |
|
313 | + ]); |
|
314 | + $table->addColumn('refreshrate', 'string', [ |
|
315 | + 'notnull' => false, |
|
316 | + 'length' => 10, |
|
317 | + ]); |
|
318 | + $table->addColumn('calendarorder', 'integer', [ |
|
319 | + 'notnull' => true, |
|
320 | + 'default' => 0, |
|
321 | + 'unsigned' => true, |
|
322 | + ]); |
|
323 | + $table->addColumn('calendarcolor', 'string', [ |
|
324 | + 'notnull' => false, |
|
325 | + ]); |
|
326 | + $table->addColumn('striptodos', 'smallint', [ |
|
327 | + 'notnull' => false, |
|
328 | + 'length' => 1, |
|
329 | + ]); |
|
330 | + $table->addColumn('stripalarms', 'smallint', [ |
|
331 | + 'notnull' => false, |
|
332 | + 'length' => 1, |
|
333 | + ]); |
|
334 | + $table->addColumn('stripattachments', 'smallint', [ |
|
335 | + 'notnull' => false, |
|
336 | + 'length' => 1, |
|
337 | + ]); |
|
338 | + $table->addColumn('lastmodified', 'integer', [ |
|
339 | + 'notnull' => false, |
|
340 | + 'unsigned' => true, |
|
341 | + ]); |
|
342 | + $table->setPrimaryKey(['id']); |
|
343 | + $table->addUniqueIndex(['principaluri', 'uri'], 'calsub_index'); |
|
344 | + } else { |
|
345 | + $table = $schema->getTable('calendarsubscriptions'); |
|
346 | + $table->changeColumn('lastmodified', [ |
|
347 | + 'notnull' => false, |
|
348 | + 'unsigned' => true, |
|
349 | + ]); |
|
350 | + } |
|
351 | 351 | |
352 | - if (!$schema->hasTable('schedulingobjects')) { |
|
353 | - $table = $schema->createTable('schedulingobjects'); |
|
354 | - $table->addColumn('id', 'bigint', [ |
|
355 | - 'autoincrement' => true, |
|
356 | - 'notnull' => true, |
|
357 | - 'length' => 11, |
|
358 | - 'unsigned' => true, |
|
359 | - ]); |
|
360 | - $table->addColumn('principaluri', 'string', [ |
|
361 | - 'notnull' => false, |
|
362 | - 'length' => 255, |
|
363 | - ]); |
|
364 | - $table->addColumn('calendardata', 'blob', [ |
|
365 | - 'notnull' => false, |
|
366 | - ]); |
|
367 | - $table->addColumn('uri', 'string', [ |
|
368 | - 'notnull' => false, |
|
369 | - 'length' => 255, |
|
370 | - ]); |
|
371 | - $table->addColumn('lastmodified', 'integer', [ |
|
372 | - 'notnull' => false, |
|
373 | - 'unsigned' => true, |
|
374 | - ]); |
|
375 | - $table->addColumn('etag', 'string', [ |
|
376 | - 'notnull' => false, |
|
377 | - 'length' => 32, |
|
378 | - ]); |
|
379 | - $table->addColumn('size', 'bigint', [ |
|
380 | - 'notnull' => true, |
|
381 | - 'length' => 11, |
|
382 | - 'unsigned' => true, |
|
383 | - ]); |
|
384 | - $table->setPrimaryKey(['id']); |
|
385 | - $table->addIndex(['principaluri'], 'schedulobj_principuri_index'); |
|
386 | - } |
|
352 | + if (!$schema->hasTable('schedulingobjects')) { |
|
353 | + $table = $schema->createTable('schedulingobjects'); |
|
354 | + $table->addColumn('id', 'bigint', [ |
|
355 | + 'autoincrement' => true, |
|
356 | + 'notnull' => true, |
|
357 | + 'length' => 11, |
|
358 | + 'unsigned' => true, |
|
359 | + ]); |
|
360 | + $table->addColumn('principaluri', 'string', [ |
|
361 | + 'notnull' => false, |
|
362 | + 'length' => 255, |
|
363 | + ]); |
|
364 | + $table->addColumn('calendardata', 'blob', [ |
|
365 | + 'notnull' => false, |
|
366 | + ]); |
|
367 | + $table->addColumn('uri', 'string', [ |
|
368 | + 'notnull' => false, |
|
369 | + 'length' => 255, |
|
370 | + ]); |
|
371 | + $table->addColumn('lastmodified', 'integer', [ |
|
372 | + 'notnull' => false, |
|
373 | + 'unsigned' => true, |
|
374 | + ]); |
|
375 | + $table->addColumn('etag', 'string', [ |
|
376 | + 'notnull' => false, |
|
377 | + 'length' => 32, |
|
378 | + ]); |
|
379 | + $table->addColumn('size', 'bigint', [ |
|
380 | + 'notnull' => true, |
|
381 | + 'length' => 11, |
|
382 | + 'unsigned' => true, |
|
383 | + ]); |
|
384 | + $table->setPrimaryKey(['id']); |
|
385 | + $table->addIndex(['principaluri'], 'schedulobj_principuri_index'); |
|
386 | + } |
|
387 | 387 | |
388 | - if (!$schema->hasTable('cards_properties')) { |
|
389 | - $table = $schema->createTable('cards_properties'); |
|
390 | - $table->addColumn('id', 'bigint', [ |
|
391 | - 'autoincrement' => true, |
|
392 | - 'notnull' => true, |
|
393 | - 'length' => 11, |
|
394 | - 'unsigned' => true, |
|
395 | - ]); |
|
396 | - $table->addColumn('addressbookid', 'bigint', [ |
|
397 | - 'notnull' => true, |
|
398 | - 'length' => 11, |
|
399 | - 'default' => 0, |
|
400 | - ]); |
|
401 | - $table->addColumn('cardid', 'bigint', [ |
|
402 | - 'notnull' => true, |
|
403 | - 'length' => 11, |
|
404 | - 'default' => 0, |
|
405 | - 'unsigned' => true, |
|
406 | - ]); |
|
407 | - $table->addColumn('name', 'string', [ |
|
408 | - 'notnull' => false, |
|
409 | - 'length' => 64, |
|
410 | - ]); |
|
411 | - $table->addColumn('value', 'string', [ |
|
412 | - 'notnull' => false, |
|
413 | - 'length' => 255, |
|
414 | - ]); |
|
415 | - $table->addColumn('preferred', 'integer', [ |
|
416 | - 'notnull' => true, |
|
417 | - 'length' => 4, |
|
418 | - 'default' => 1, |
|
419 | - ]); |
|
420 | - $table->setPrimaryKey(['id']); |
|
421 | - $table->addIndex(['cardid'], 'card_contactid_index'); |
|
422 | - $table->addIndex(['name'], 'card_name_index'); |
|
423 | - $table->addIndex(['value'], 'card_value_index'); |
|
424 | - } |
|
388 | + if (!$schema->hasTable('cards_properties')) { |
|
389 | + $table = $schema->createTable('cards_properties'); |
|
390 | + $table->addColumn('id', 'bigint', [ |
|
391 | + 'autoincrement' => true, |
|
392 | + 'notnull' => true, |
|
393 | + 'length' => 11, |
|
394 | + 'unsigned' => true, |
|
395 | + ]); |
|
396 | + $table->addColumn('addressbookid', 'bigint', [ |
|
397 | + 'notnull' => true, |
|
398 | + 'length' => 11, |
|
399 | + 'default' => 0, |
|
400 | + ]); |
|
401 | + $table->addColumn('cardid', 'bigint', [ |
|
402 | + 'notnull' => true, |
|
403 | + 'length' => 11, |
|
404 | + 'default' => 0, |
|
405 | + 'unsigned' => true, |
|
406 | + ]); |
|
407 | + $table->addColumn('name', 'string', [ |
|
408 | + 'notnull' => false, |
|
409 | + 'length' => 64, |
|
410 | + ]); |
|
411 | + $table->addColumn('value', 'string', [ |
|
412 | + 'notnull' => false, |
|
413 | + 'length' => 255, |
|
414 | + ]); |
|
415 | + $table->addColumn('preferred', 'integer', [ |
|
416 | + 'notnull' => true, |
|
417 | + 'length' => 4, |
|
418 | + 'default' => 1, |
|
419 | + ]); |
|
420 | + $table->setPrimaryKey(['id']); |
|
421 | + $table->addIndex(['cardid'], 'card_contactid_index'); |
|
422 | + $table->addIndex(['name'], 'card_name_index'); |
|
423 | + $table->addIndex(['value'], 'card_value_index'); |
|
424 | + } |
|
425 | 425 | |
426 | - if (!$schema->hasTable('calendarobjects_props')) { |
|
427 | - $table = $schema->createTable('calendarobjects_props'); |
|
428 | - $table->addColumn('id', 'bigint', [ |
|
429 | - 'autoincrement' => true, |
|
430 | - 'notnull' => true, |
|
431 | - 'length' => 11, |
|
432 | - 'unsigned' => true, |
|
433 | - ]); |
|
434 | - $table->addColumn('calendarid', 'bigint', [ |
|
435 | - 'notnull' => true, |
|
436 | - 'length' => 11, |
|
437 | - 'default' => 0, |
|
438 | - ]); |
|
439 | - $table->addColumn('objectid', 'bigint', [ |
|
440 | - 'notnull' => true, |
|
441 | - 'length' => 11, |
|
442 | - 'default' => 0, |
|
443 | - 'unsigned' => true, |
|
444 | - ]); |
|
445 | - $table->addColumn('name', 'string', [ |
|
446 | - 'notnull' => false, |
|
447 | - 'length' => 64, |
|
448 | - ]); |
|
449 | - $table->addColumn('parameter', 'string', [ |
|
450 | - 'notnull' => false, |
|
451 | - 'length' => 64, |
|
452 | - ]); |
|
453 | - $table->addColumn('value', 'string', [ |
|
454 | - 'notnull' => false, |
|
455 | - 'length' => 255, |
|
456 | - ]); |
|
457 | - $table->setPrimaryKey(['id']); |
|
458 | - $table->addIndex(['objectid'], 'calendarobject_index'); |
|
459 | - $table->addIndex(['name'], 'calendarobject_name_index'); |
|
460 | - $table->addIndex(['value'], 'calendarobject_value_index'); |
|
461 | - } |
|
426 | + if (!$schema->hasTable('calendarobjects_props')) { |
|
427 | + $table = $schema->createTable('calendarobjects_props'); |
|
428 | + $table->addColumn('id', 'bigint', [ |
|
429 | + 'autoincrement' => true, |
|
430 | + 'notnull' => true, |
|
431 | + 'length' => 11, |
|
432 | + 'unsigned' => true, |
|
433 | + ]); |
|
434 | + $table->addColumn('calendarid', 'bigint', [ |
|
435 | + 'notnull' => true, |
|
436 | + 'length' => 11, |
|
437 | + 'default' => 0, |
|
438 | + ]); |
|
439 | + $table->addColumn('objectid', 'bigint', [ |
|
440 | + 'notnull' => true, |
|
441 | + 'length' => 11, |
|
442 | + 'default' => 0, |
|
443 | + 'unsigned' => true, |
|
444 | + ]); |
|
445 | + $table->addColumn('name', 'string', [ |
|
446 | + 'notnull' => false, |
|
447 | + 'length' => 64, |
|
448 | + ]); |
|
449 | + $table->addColumn('parameter', 'string', [ |
|
450 | + 'notnull' => false, |
|
451 | + 'length' => 64, |
|
452 | + ]); |
|
453 | + $table->addColumn('value', 'string', [ |
|
454 | + 'notnull' => false, |
|
455 | + 'length' => 255, |
|
456 | + ]); |
|
457 | + $table->setPrimaryKey(['id']); |
|
458 | + $table->addIndex(['objectid'], 'calendarobject_index'); |
|
459 | + $table->addIndex(['name'], 'calendarobject_name_index'); |
|
460 | + $table->addIndex(['value'], 'calendarobject_value_index'); |
|
461 | + } |
|
462 | 462 | |
463 | - if (!$schema->hasTable('dav_shares')) { |
|
464 | - $table = $schema->createTable('dav_shares'); |
|
465 | - $table->addColumn('id', 'bigint', [ |
|
466 | - 'autoincrement' => true, |
|
467 | - 'notnull' => true, |
|
468 | - 'length' => 11, |
|
469 | - 'unsigned' => true, |
|
470 | - ]); |
|
471 | - $table->addColumn('principaluri', 'string', [ |
|
472 | - 'notnull' => false, |
|
473 | - 'length' => 255, |
|
474 | - ]); |
|
475 | - $table->addColumn('type', 'string', [ |
|
476 | - 'notnull' => false, |
|
477 | - 'length' => 255, |
|
478 | - ]); |
|
479 | - $table->addColumn('access', 'smallint', [ |
|
480 | - 'notnull' => false, |
|
481 | - 'length' => 1, |
|
482 | - ]); |
|
483 | - $table->addColumn('resourceid', 'integer', [ |
|
484 | - 'notnull' => true, |
|
485 | - 'unsigned' => true, |
|
486 | - ]); |
|
487 | - $table->addColumn('publicuri', 'string', [ |
|
488 | - 'notnull' => false, |
|
489 | - 'length' => 255, |
|
490 | - ]); |
|
491 | - $table->setPrimaryKey(['id']); |
|
492 | - $table->addUniqueIndex(['principaluri', 'resourceid', 'type', 'publicuri'], 'dav_shares_index'); |
|
493 | - } |
|
494 | - return $schema; |
|
495 | - } |
|
463 | + if (!$schema->hasTable('dav_shares')) { |
|
464 | + $table = $schema->createTable('dav_shares'); |
|
465 | + $table->addColumn('id', 'bigint', [ |
|
466 | + 'autoincrement' => true, |
|
467 | + 'notnull' => true, |
|
468 | + 'length' => 11, |
|
469 | + 'unsigned' => true, |
|
470 | + ]); |
|
471 | + $table->addColumn('principaluri', 'string', [ |
|
472 | + 'notnull' => false, |
|
473 | + 'length' => 255, |
|
474 | + ]); |
|
475 | + $table->addColumn('type', 'string', [ |
|
476 | + 'notnull' => false, |
|
477 | + 'length' => 255, |
|
478 | + ]); |
|
479 | + $table->addColumn('access', 'smallint', [ |
|
480 | + 'notnull' => false, |
|
481 | + 'length' => 1, |
|
482 | + ]); |
|
483 | + $table->addColumn('resourceid', 'integer', [ |
|
484 | + 'notnull' => true, |
|
485 | + 'unsigned' => true, |
|
486 | + ]); |
|
487 | + $table->addColumn('publicuri', 'string', [ |
|
488 | + 'notnull' => false, |
|
489 | + 'length' => 255, |
|
490 | + ]); |
|
491 | + $table->setPrimaryKey(['id']); |
|
492 | + $table->addUniqueIndex(['principaluri', 'resourceid', 'type', 'publicuri'], 'dav_shares_index'); |
|
493 | + } |
|
494 | + return $schema; |
|
495 | + } |
|
496 | 496 | } |
@@ -35,13 +35,13 @@ |
||
35 | 35 | $OC_VersionString = '21.0.0 alpha'; |
36 | 36 | |
37 | 37 | $OC_VersionCanBeUpgradedFrom = [ |
38 | - 'nextcloud' => [ |
|
39 | - '20.0' => true, |
|
40 | - '21.0' => true, |
|
41 | - ], |
|
42 | - 'owncloud' => [ |
|
43 | - '10.5' => true, |
|
44 | - ], |
|
38 | + 'nextcloud' => [ |
|
39 | + '20.0' => true, |
|
40 | + '21.0' => true, |
|
41 | + ], |
|
42 | + 'owncloud' => [ |
|
43 | + '10.5' => true, |
|
44 | + ], |
|
45 | 45 | ]; |
46 | 46 | |
47 | 47 | // default Nextcloud channel |
@@ -78,197 +78,197 @@ |
||
78 | 78 | |
79 | 79 | class Repair implements IOutput { |
80 | 80 | |
81 | - /** @var IRepairStep[] */ |
|
82 | - private $repairSteps; |
|
81 | + /** @var IRepairStep[] */ |
|
82 | + private $repairSteps; |
|
83 | 83 | |
84 | - /** @var EventDispatcherInterface */ |
|
85 | - private $dispatcher; |
|
84 | + /** @var EventDispatcherInterface */ |
|
85 | + private $dispatcher; |
|
86 | 86 | |
87 | - /** @var string */ |
|
88 | - private $currentStep; |
|
87 | + /** @var string */ |
|
88 | + private $currentStep; |
|
89 | 89 | |
90 | - /** |
|
91 | - * Creates a new repair step runner |
|
92 | - * |
|
93 | - * @param IRepairStep[] $repairSteps array of RepairStep instances |
|
94 | - * @param EventDispatcherInterface $dispatcher |
|
95 | - */ |
|
96 | - public function __construct(array $repairSteps, EventDispatcherInterface $dispatcher) { |
|
97 | - $this->repairSteps = $repairSteps; |
|
98 | - $this->dispatcher = $dispatcher; |
|
99 | - } |
|
90 | + /** |
|
91 | + * Creates a new repair step runner |
|
92 | + * |
|
93 | + * @param IRepairStep[] $repairSteps array of RepairStep instances |
|
94 | + * @param EventDispatcherInterface $dispatcher |
|
95 | + */ |
|
96 | + public function __construct(array $repairSteps, EventDispatcherInterface $dispatcher) { |
|
97 | + $this->repairSteps = $repairSteps; |
|
98 | + $this->dispatcher = $dispatcher; |
|
99 | + } |
|
100 | 100 | |
101 | - /** |
|
102 | - * Run a series of repair steps for common problems |
|
103 | - */ |
|
104 | - public function run() { |
|
105 | - if (count($this->repairSteps) === 0) { |
|
106 | - $this->emit('\OC\Repair', 'info', ['No repair steps available']); |
|
101 | + /** |
|
102 | + * Run a series of repair steps for common problems |
|
103 | + */ |
|
104 | + public function run() { |
|
105 | + if (count($this->repairSteps) === 0) { |
|
106 | + $this->emit('\OC\Repair', 'info', ['No repair steps available']); |
|
107 | 107 | |
108 | - return; |
|
109 | - } |
|
110 | - // run each repair step |
|
111 | - foreach ($this->repairSteps as $step) { |
|
112 | - $this->currentStep = $step->getName(); |
|
113 | - $this->emit('\OC\Repair', 'step', [$this->currentStep]); |
|
114 | - $step->run($this); |
|
115 | - } |
|
116 | - } |
|
108 | + return; |
|
109 | + } |
|
110 | + // run each repair step |
|
111 | + foreach ($this->repairSteps as $step) { |
|
112 | + $this->currentStep = $step->getName(); |
|
113 | + $this->emit('\OC\Repair', 'step', [$this->currentStep]); |
|
114 | + $step->run($this); |
|
115 | + } |
|
116 | + } |
|
117 | 117 | |
118 | - /** |
|
119 | - * Add repair step |
|
120 | - * |
|
121 | - * @param IRepairStep|string $repairStep repair step |
|
122 | - * @throws \Exception |
|
123 | - */ |
|
124 | - public function addStep($repairStep) { |
|
125 | - if (is_string($repairStep)) { |
|
126 | - try { |
|
127 | - $s = \OC::$server->query($repairStep); |
|
128 | - } catch (QueryException $e) { |
|
129 | - if (class_exists($repairStep)) { |
|
130 | - $s = new $repairStep(); |
|
131 | - } else { |
|
132 | - throw new \Exception("Repair step '$repairStep' is unknown"); |
|
133 | - } |
|
134 | - } |
|
118 | + /** |
|
119 | + * Add repair step |
|
120 | + * |
|
121 | + * @param IRepairStep|string $repairStep repair step |
|
122 | + * @throws \Exception |
|
123 | + */ |
|
124 | + public function addStep($repairStep) { |
|
125 | + if (is_string($repairStep)) { |
|
126 | + try { |
|
127 | + $s = \OC::$server->query($repairStep); |
|
128 | + } catch (QueryException $e) { |
|
129 | + if (class_exists($repairStep)) { |
|
130 | + $s = new $repairStep(); |
|
131 | + } else { |
|
132 | + throw new \Exception("Repair step '$repairStep' is unknown"); |
|
133 | + } |
|
134 | + } |
|
135 | 135 | |
136 | - if ($s instanceof IRepairStep) { |
|
137 | - $this->repairSteps[] = $s; |
|
138 | - } else { |
|
139 | - throw new \Exception("Repair step '$repairStep' is not of type \\OCP\\Migration\\IRepairStep"); |
|
140 | - } |
|
141 | - } else { |
|
142 | - $this->repairSteps[] = $repairStep; |
|
143 | - } |
|
144 | - } |
|
136 | + if ($s instanceof IRepairStep) { |
|
137 | + $this->repairSteps[] = $s; |
|
138 | + } else { |
|
139 | + throw new \Exception("Repair step '$repairStep' is not of type \\OCP\\Migration\\IRepairStep"); |
|
140 | + } |
|
141 | + } else { |
|
142 | + $this->repairSteps[] = $repairStep; |
|
143 | + } |
|
144 | + } |
|
145 | 145 | |
146 | - /** |
|
147 | - * Returns the default repair steps to be run on the |
|
148 | - * command line or after an upgrade. |
|
149 | - * |
|
150 | - * @return IRepairStep[] |
|
151 | - */ |
|
152 | - public static function getRepairSteps() { |
|
153 | - return [ |
|
154 | - new Collation(\OC::$server->getConfig(), \OC::$server->getLogger(), \OC::$server->getDatabaseConnection(), false), |
|
155 | - new RepairMimeTypes(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection()), |
|
156 | - new CleanTags(\OC::$server->getDatabaseConnection(), \OC::$server->getUserManager()), |
|
157 | - new RepairInvalidShares(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection()), |
|
158 | - new MoveUpdaterStepFile(\OC::$server->getConfig()), |
|
159 | - new MoveAvatars( |
|
160 | - \OC::$server->getJobList(), |
|
161 | - \OC::$server->getConfig() |
|
162 | - ), |
|
163 | - new CleanPreviews( |
|
164 | - \OC::$server->getJobList(), |
|
165 | - \OC::$server->getUserManager(), |
|
166 | - \OC::$server->getConfig() |
|
167 | - ), |
|
168 | - new FixMountStorages(\OC::$server->getDatabaseConnection()), |
|
169 | - new UpdateLanguageCodes(\OC::$server->getDatabaseConnection(), \OC::$server->getConfig()), |
|
170 | - new InstallCoreBundle( |
|
171 | - \OC::$server->query(BundleFetcher::class), |
|
172 | - \OC::$server->getConfig(), |
|
173 | - \OC::$server->query(Installer::class) |
|
174 | - ), |
|
175 | - new AddLogRotateJob(\OC::$server->getJobList()), |
|
176 | - new ClearFrontendCaches(\OC::$server->getMemCacheFactory(), \OC::$server->query(SCSSCacher::class), \OC::$server->query(JSCombiner::class)), |
|
177 | - new ClearGeneratedAvatarCache(\OC::$server->getConfig(), \OC::$server->query(AvatarManager::class)), |
|
178 | - new AddPreviewBackgroundCleanupJob(\OC::$server->getJobList()), |
|
179 | - new AddCleanupUpdaterBackupsJob(\OC::$server->getJobList()), |
|
180 | - new CleanupCardDAVPhotoCache(\OC::$server->getConfig(), \OC::$server->getAppDataDir('dav-photocache'), \OC::$server->getLogger()), |
|
181 | - new AddClenupLoginFlowV2BackgroundJob(\OC::$server->getJobList()), |
|
182 | - new RemoveLinkShares(\OC::$server->getDatabaseConnection(), \OC::$server->getConfig(), \OC::$server->getGroupManager(), \OC::$server->getNotificationManager(), \OC::$server->query(ITimeFactory::class)), |
|
183 | - new ClearCollectionsAccessCache(\OC::$server->getConfig(), \OC::$server->query(IManager::class)), |
|
184 | - \OC::$server->query(ResetGeneratedAvatarFlag::class), |
|
185 | - \OC::$server->query(EncryptionLegacyCipher::class), |
|
186 | - \OC::$server->query(EncryptionMigration::class), |
|
187 | - \OC::$server->get(ShippedDashboardEnable::class), |
|
188 | - \OC::$server->get(AddBruteForceCleanupJob::class), |
|
189 | - \OC::$server->get(AddCheckForUserCertificatesJob::class), |
|
190 | - ]; |
|
191 | - } |
|
146 | + /** |
|
147 | + * Returns the default repair steps to be run on the |
|
148 | + * command line or after an upgrade. |
|
149 | + * |
|
150 | + * @return IRepairStep[] |
|
151 | + */ |
|
152 | + public static function getRepairSteps() { |
|
153 | + return [ |
|
154 | + new Collation(\OC::$server->getConfig(), \OC::$server->getLogger(), \OC::$server->getDatabaseConnection(), false), |
|
155 | + new RepairMimeTypes(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection()), |
|
156 | + new CleanTags(\OC::$server->getDatabaseConnection(), \OC::$server->getUserManager()), |
|
157 | + new RepairInvalidShares(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection()), |
|
158 | + new MoveUpdaterStepFile(\OC::$server->getConfig()), |
|
159 | + new MoveAvatars( |
|
160 | + \OC::$server->getJobList(), |
|
161 | + \OC::$server->getConfig() |
|
162 | + ), |
|
163 | + new CleanPreviews( |
|
164 | + \OC::$server->getJobList(), |
|
165 | + \OC::$server->getUserManager(), |
|
166 | + \OC::$server->getConfig() |
|
167 | + ), |
|
168 | + new FixMountStorages(\OC::$server->getDatabaseConnection()), |
|
169 | + new UpdateLanguageCodes(\OC::$server->getDatabaseConnection(), \OC::$server->getConfig()), |
|
170 | + new InstallCoreBundle( |
|
171 | + \OC::$server->query(BundleFetcher::class), |
|
172 | + \OC::$server->getConfig(), |
|
173 | + \OC::$server->query(Installer::class) |
|
174 | + ), |
|
175 | + new AddLogRotateJob(\OC::$server->getJobList()), |
|
176 | + new ClearFrontendCaches(\OC::$server->getMemCacheFactory(), \OC::$server->query(SCSSCacher::class), \OC::$server->query(JSCombiner::class)), |
|
177 | + new ClearGeneratedAvatarCache(\OC::$server->getConfig(), \OC::$server->query(AvatarManager::class)), |
|
178 | + new AddPreviewBackgroundCleanupJob(\OC::$server->getJobList()), |
|
179 | + new AddCleanupUpdaterBackupsJob(\OC::$server->getJobList()), |
|
180 | + new CleanupCardDAVPhotoCache(\OC::$server->getConfig(), \OC::$server->getAppDataDir('dav-photocache'), \OC::$server->getLogger()), |
|
181 | + new AddClenupLoginFlowV2BackgroundJob(\OC::$server->getJobList()), |
|
182 | + new RemoveLinkShares(\OC::$server->getDatabaseConnection(), \OC::$server->getConfig(), \OC::$server->getGroupManager(), \OC::$server->getNotificationManager(), \OC::$server->query(ITimeFactory::class)), |
|
183 | + new ClearCollectionsAccessCache(\OC::$server->getConfig(), \OC::$server->query(IManager::class)), |
|
184 | + \OC::$server->query(ResetGeneratedAvatarFlag::class), |
|
185 | + \OC::$server->query(EncryptionLegacyCipher::class), |
|
186 | + \OC::$server->query(EncryptionMigration::class), |
|
187 | + \OC::$server->get(ShippedDashboardEnable::class), |
|
188 | + \OC::$server->get(AddBruteForceCleanupJob::class), |
|
189 | + \OC::$server->get(AddCheckForUserCertificatesJob::class), |
|
190 | + ]; |
|
191 | + } |
|
192 | 192 | |
193 | - /** |
|
194 | - * Returns expensive repair steps to be run on the |
|
195 | - * command line with a special option. |
|
196 | - * |
|
197 | - * @return IRepairStep[] |
|
198 | - */ |
|
199 | - public static function getExpensiveRepairSteps() { |
|
200 | - return [ |
|
201 | - new OldGroupMembershipShares(\OC::$server->getDatabaseConnection(), \OC::$server->getGroupManager()), |
|
202 | - \OC::$server->get(ValidatePhoneNumber::class), |
|
203 | - ]; |
|
204 | - } |
|
193 | + /** |
|
194 | + * Returns expensive repair steps to be run on the |
|
195 | + * command line with a special option. |
|
196 | + * |
|
197 | + * @return IRepairStep[] |
|
198 | + */ |
|
199 | + public static function getExpensiveRepairSteps() { |
|
200 | + return [ |
|
201 | + new OldGroupMembershipShares(\OC::$server->getDatabaseConnection(), \OC::$server->getGroupManager()), |
|
202 | + \OC::$server->get(ValidatePhoneNumber::class), |
|
203 | + ]; |
|
204 | + } |
|
205 | 205 | |
206 | - /** |
|
207 | - * Returns the repair steps to be run before an |
|
208 | - * upgrade. |
|
209 | - * |
|
210 | - * @return IRepairStep[] |
|
211 | - */ |
|
212 | - public static function getBeforeUpgradeRepairSteps() { |
|
213 | - $connection = \OC::$server->getDatabaseConnection(); |
|
214 | - $config = \OC::$server->getConfig(); |
|
215 | - $steps = [ |
|
216 | - new Collation(\OC::$server->getConfig(), \OC::$server->getLogger(), $connection, true), |
|
217 | - new SqliteAutoincrement($connection), |
|
218 | - new SaveAccountsTableData($connection, $config), |
|
219 | - new DropAccountTermsTable($connection) |
|
220 | - ]; |
|
206 | + /** |
|
207 | + * Returns the repair steps to be run before an |
|
208 | + * upgrade. |
|
209 | + * |
|
210 | + * @return IRepairStep[] |
|
211 | + */ |
|
212 | + public static function getBeforeUpgradeRepairSteps() { |
|
213 | + $connection = \OC::$server->getDatabaseConnection(); |
|
214 | + $config = \OC::$server->getConfig(); |
|
215 | + $steps = [ |
|
216 | + new Collation(\OC::$server->getConfig(), \OC::$server->getLogger(), $connection, true), |
|
217 | + new SqliteAutoincrement($connection), |
|
218 | + new SaveAccountsTableData($connection, $config), |
|
219 | + new DropAccountTermsTable($connection) |
|
220 | + ]; |
|
221 | 221 | |
222 | - return $steps; |
|
223 | - } |
|
222 | + return $steps; |
|
223 | + } |
|
224 | 224 | |
225 | - /** |
|
226 | - * @param string $scope |
|
227 | - * @param string $method |
|
228 | - * @param array $arguments |
|
229 | - */ |
|
230 | - public function emit($scope, $method, array $arguments = []) { |
|
231 | - if (!is_null($this->dispatcher)) { |
|
232 | - $this->dispatcher->dispatch("$scope::$method", |
|
233 | - new GenericEvent("$scope::$method", $arguments)); |
|
234 | - } |
|
235 | - } |
|
225 | + /** |
|
226 | + * @param string $scope |
|
227 | + * @param string $method |
|
228 | + * @param array $arguments |
|
229 | + */ |
|
230 | + public function emit($scope, $method, array $arguments = []) { |
|
231 | + if (!is_null($this->dispatcher)) { |
|
232 | + $this->dispatcher->dispatch("$scope::$method", |
|
233 | + new GenericEvent("$scope::$method", $arguments)); |
|
234 | + } |
|
235 | + } |
|
236 | 236 | |
237 | - public function info($string) { |
|
238 | - // for now just emit as we did in the past |
|
239 | - $this->emit('\OC\Repair', 'info', [$string]); |
|
240 | - } |
|
237 | + public function info($string) { |
|
238 | + // for now just emit as we did in the past |
|
239 | + $this->emit('\OC\Repair', 'info', [$string]); |
|
240 | + } |
|
241 | 241 | |
242 | - /** |
|
243 | - * @param string $message |
|
244 | - */ |
|
245 | - public function warning($message) { |
|
246 | - // for now just emit as we did in the past |
|
247 | - $this->emit('\OC\Repair', 'warning', [$message]); |
|
248 | - } |
|
242 | + /** |
|
243 | + * @param string $message |
|
244 | + */ |
|
245 | + public function warning($message) { |
|
246 | + // for now just emit as we did in the past |
|
247 | + $this->emit('\OC\Repair', 'warning', [$message]); |
|
248 | + } |
|
249 | 249 | |
250 | - /** |
|
251 | - * @param int $max |
|
252 | - */ |
|
253 | - public function startProgress($max = 0) { |
|
254 | - // for now just emit as we did in the past |
|
255 | - $this->emit('\OC\Repair', 'startProgress', [$max, $this->currentStep]); |
|
256 | - } |
|
250 | + /** |
|
251 | + * @param int $max |
|
252 | + */ |
|
253 | + public function startProgress($max = 0) { |
|
254 | + // for now just emit as we did in the past |
|
255 | + $this->emit('\OC\Repair', 'startProgress', [$max, $this->currentStep]); |
|
256 | + } |
|
257 | 257 | |
258 | - /** |
|
259 | - * @param int $step |
|
260 | - * @param string $description |
|
261 | - */ |
|
262 | - public function advance($step = 1, $description = '') { |
|
263 | - // for now just emit as we did in the past |
|
264 | - $this->emit('\OC\Repair', 'advance', [$step, $description]); |
|
265 | - } |
|
258 | + /** |
|
259 | + * @param int $step |
|
260 | + * @param string $description |
|
261 | + */ |
|
262 | + public function advance($step = 1, $description = '') { |
|
263 | + // for now just emit as we did in the past |
|
264 | + $this->emit('\OC\Repair', 'advance', [$step, $description]); |
|
265 | + } |
|
266 | 266 | |
267 | - /** |
|
268 | - * @param int $max |
|
269 | - */ |
|
270 | - public function finishProgress() { |
|
271 | - // for now just emit as we did in the past |
|
272 | - $this->emit('\OC\Repair', 'finishProgress', []); |
|
273 | - } |
|
267 | + /** |
|
268 | + * @param int $max |
|
269 | + */ |
|
270 | + public function finishProgress() { |
|
271 | + // for now just emit as we did in the past |
|
272 | + $this->emit('\OC\Repair', 'finishProgress', []); |
|
273 | + } |
|
274 | 274 | } |