| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,695 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * @copyright 2021 Double Bastion LLC <www.doublebastion.com> |
|
| 4 |
+ * |
|
| 5 |
+ * @author Double Bastion LLC |
|
| 6 |
+ * |
|
| 7 |
+ * @license GNU AGPL version 3 or any later version |
|
| 8 |
+ * |
|
| 9 |
+ * This program is free software; you can redistribute it and/or |
|
| 10 |
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE |
|
| 11 |
+ * License as published by the Free Software Foundation; either |
|
| 12 |
+ * version 3 of the License, or any later version. |
|
| 13 |
+ * |
|
| 14 |
+ * This program is distributed in the hope that it will be useful, |
|
| 15 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 16 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 17 |
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details. |
|
| 18 |
+ * |
|
| 19 |
+ * You should have received a copy of the GNU Affero General Public |
|
| 20 |
+ * License along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
| 21 |
+ * |
|
| 22 |
+ */ |
|
| 23 |
+ |
|
| 24 |
+declare(strict_types=1); |
|
| 25 |
+ |
|
| 26 |
+namespace OCA\SMSRelentless\Migration; |
|
| 27 |
+ |
|
| 28 |
+use Closure; |
|
| 29 |
+use OCP\DB\Types; |
|
| 30 |
+use OCP\DB\ISchemaWrapper; |
|
| 31 |
+use OCP\IDBConnection; |
|
| 32 |
+use OCP\Migration\IOutput; |
|
| 33 |
+use OCP\Migration\SimpleMigrationStep; |
|
| 34 |
+ |
|
| 35 |
+ |
|
| 36 |
+class Version136Date20240502081941 extends SimpleMigrationStep {
|
|
| 37 |
+ |
|
| 38 |
+ /** @var IDBConnection */ |
|
| 39 |
+ private $connection; |
|
| 40 |
+ |
|
| 41 |
+ /** |
|
| 42 |
+ * @param IDBConnection $connection |
|
| 43 |
+ */ |
|
| 44 |
+ public function __construct(IDBConnection $connection) {
|
|
| 45 |
+ $this->connection = $connection; |
|
| 46 |
+ } |
|
| 47 |
+ |
|
| 48 |
+ /** |
|
| 49 |
+ * @param IOutput $output |
|
| 50 |
+ * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 51 |
+ * @param array $options |
|
| 52 |
+ * @return null|ISchemaWrapper |
|
| 53 |
+ */ |
|
| 54 |
+ public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
|
|
| 55 |
+ /** @var ISchemaWrapper $schema */ |
|
| 56 |
+ $schema = $schemaClosure(); |
|
| 57 |
+ |
|
| 58 |
+ if (!$schema->hasTable('sms_relent_settings')) {
|
|
| 59 |
+ $table = $schema->createTable('sms_relent_settings');
|
|
| 60 |
+ $table->addColumn('id', Types::BIGINT, [
|
|
| 61 |
+ 'autoincrement' => true, |
|
| 62 |
+ 'notnull' => true, |
|
| 63 |
+ 'length' => 11, |
|
| 64 |
+ 'unsigned' => true, |
|
| 65 |
+ ]); |
|
| 66 |
+ $table->addColumn('user_id', Types::STRING, [
|
|
| 67 |
+ 'notnull' => true, |
|
| 68 |
+ 'length' => 128, |
|
| 69 |
+ ]); |
|
| 70 |
+ $table->addColumn('telapi_key', Types::STRING, [
|
|
| 71 |
+ 'notnull' => false, |
|
| 72 |
+ 'length' => 512, |
|
| 73 |
+ ]); |
|
| 74 |
+ $table->addColumn('tel_pub_key', Types::STRING, [
|
|
| 75 |
+ 'notnull' => false, |
|
| 76 |
+ 'length' => 512, |
|
| 77 |
+ ]); |
|
| 78 |
+ $table->addColumn('telapi_url_rec', Types::STRING, [
|
|
| 79 |
+ 'notnull' => false, |
|
| 80 |
+ 'length' => 512, |
|
| 81 |
+ ]); |
|
| 82 |
+ $table->addColumn('telapi_url', Types::STRING, [
|
|
| 83 |
+ 'notnull' => false, |
|
| 84 |
+ 'length' => 512, |
|
| 85 |
+ ]); |
|
| 86 |
+ $table->addColumn('messaging_profile_id', Types::STRING, [
|
|
| 87 |
+ 'notnull' => false, |
|
| 88 |
+ 'length' => 512, |
|
| 89 |
+ ]); |
|
| 90 |
+ $table->addColumn('nexapi_key', Types::STRING, [
|
|
| 91 |
+ 'notnull' => false, |
|
| 92 |
+ 'length' => 512, |
|
| 93 |
+ ]); |
|
| 94 |
+ $table->addColumn('nexapi_secret', Types::STRING, [
|
|
| 95 |
+ 'notnull' => false, |
|
| 96 |
+ 'length' => 512, |
|
| 97 |
+ ]); |
|
| 98 |
+ $table->addColumn('nexapi_url_rec', Types::STRING, [
|
|
| 99 |
+ 'notnull' => false, |
|
| 100 |
+ 'length' => 512, |
|
| 101 |
+ ]); |
|
| 102 |
+ $table->addColumn('nexapi_url', Types::STRING, [
|
|
| 103 |
+ 'notnull' => false, |
|
| 104 |
+ 'length' => 512, |
|
| 105 |
+ ]); |
|
| 106 |
+ $table->addColumn('twilapi_key', Types::STRING, [
|
|
| 107 |
+ 'notnull' => false, |
|
| 108 |
+ 'length' => 512, |
|
| 109 |
+ ]); |
|
| 110 |
+ $table->addColumn('twilapi_secret', Types::STRING, [
|
|
| 111 |
+ 'notnull' => false, |
|
| 112 |
+ 'length' => 512, |
|
| 113 |
+ ]); |
|
| 114 |
+ $table->addColumn('twilapi_url_rec', Types::STRING, [
|
|
| 115 |
+ 'notnull' => false, |
|
| 116 |
+ 'length' => 512, |
|
| 117 |
+ ]); |
|
| 118 |
+ $table->addColumn('twilapi_url', Types::STRING, [
|
|
| 119 |
+ 'notnull' => false, |
|
| 120 |
+ 'length' => 512, |
|
| 121 |
+ ]); |
|
| 122 |
+ $table->addColumn('flowapi_key', Types::STRING, [
|
|
| 123 |
+ 'notnull' => false, |
|
| 124 |
+ 'length' => 512, |
|
| 125 |
+ ]); |
|
| 126 |
+ $table->addColumn('flowapi_secret', Types::STRING, [
|
|
| 127 |
+ 'notnull' => false, |
|
| 128 |
+ 'length' => 512, |
|
| 129 |
+ ]); |
|
| 130 |
+ $table->addColumn('flowapi_url_rec', Types::STRING, [
|
|
| 131 |
+ 'notnull' => false, |
|
| 132 |
+ 'length' => 512, |
|
| 133 |
+ ]); |
|
| 134 |
+ $table->addColumn('flowapi_url', Types::STRING, [
|
|
| 135 |
+ 'notnull' => false, |
|
| 136 |
+ 'length' => 512, |
|
| 137 |
+ ]); |
|
| 138 |
+ $table->addColumn('tel_sender_name', Types::STRING, [
|
|
| 139 |
+ 'notnull' => false, |
|
| 140 |
+ 'length' => 48, |
|
| 141 |
+ 'default' => '', |
|
| 142 |
+ ]); |
|
| 143 |
+ $table->addColumn('nex_sender_name', Types::STRING, [
|
|
| 144 |
+ 'notnull' => false, |
|
| 145 |
+ 'length' => 48, |
|
| 146 |
+ 'default' => '', |
|
| 147 |
+ ]); |
|
| 148 |
+ $table->addColumn('twil_sender_name', Types::STRING, [
|
|
| 149 |
+ 'notnull' => false, |
|
| 150 |
+ 'length' => 48, |
|
| 151 |
+ 'default' => '', |
|
| 152 |
+ ]); |
|
| 153 |
+ $table->addColumn('flow_sender_name', Types::STRING, [
|
|
| 154 |
+ 'notnull' => false, |
|
| 155 |
+ 'length' => 48, |
|
| 156 |
+ 'default' => '', |
|
| 157 |
+ ]); |
|
| 158 |
+ $table->addColumn('messagesperpage', Types::INTEGER, [
|
|
| 159 |
+ 'notnull' => false, |
|
| 160 |
+ 'length' => 10, |
|
| 161 |
+ 'unsigned' => true, |
|
| 162 |
+ ]); |
|
| 163 |
+ $table->addColumn('get_notify', Types::SMALLINT, [
|
|
| 164 |
+ 'notnull' => false, |
|
| 165 |
+ 'length' => 1, |
|
| 166 |
+ ]); |
|
| 167 |
+ $table->addColumn('notification_email', Types::STRING, [
|
|
| 168 |
+ 'notnull' => false, |
|
| 169 |
+ 'length' => 512, |
|
| 170 |
+ 'default' => '', |
|
| 171 |
+ ]); |
|
| 172 |
+ $table->addColumn('getsmsinemail', Types::SMALLINT, [
|
|
| 173 |
+ 'notnull' => false, |
|
| 174 |
+ 'length' => 1, |
|
| 175 |
+ ]); |
|
| 176 |
+ $table->addColumn('show_all_messages', Types::SMALLINT, [
|
|
| 177 |
+ 'notnull' => false, |
|
| 178 |
+ 'length' => 1, |
|
| 179 |
+ ]); |
|
| 180 |
+ $table->addColumn('show_display_names', Types::SMALLINT, [
|
|
| 181 |
+ 'notnull' => false, |
|
| 182 |
+ 'length' => 1, |
|
| 183 |
+ ]); |
|
| 184 |
+ $table->addColumn('add_display_names', Types::SMALLINT, [
|
|
| 185 |
+ 'notnull' => false, |
|
| 186 |
+ 'length' => 1, |
|
| 187 |
+ ]); |
|
| 188 |
+ $table->addColumn('available_numbers', Types::TEXT, [
|
|
| 189 |
+ 'notnull' => false, |
|
| 190 |
+ 'default' => '', |
|
| 191 |
+ ]); |
|
| 192 |
+ $table->addColumn('msg_check_interval', Types::INTEGER, [
|
|
| 193 |
+ 'notnull' => false, |
|
| 194 |
+ 'length' => 10, |
|
| 195 |
+ 'unsigned' => true, |
|
| 196 |
+ ]); |
|
| 197 |
+ $table->addColumn('new_message_rcd', Types::SMALLINT, [
|
|
| 198 |
+ 'notnull' => false, |
|
| 199 |
+ 'length' => 1, |
|
| 200 |
+ ]); |
|
| 201 |
+ $table->addColumn('archived_conv_nmbr', Types::INTEGER, [
|
|
| 202 |
+ 'notnull' => false, |
|
| 203 |
+ 'length' => 10, |
|
| 204 |
+ 'unsigned' => true, |
|
| 205 |
+ ]); |
|
| 206 |
+ $table->setPrimaryKey(['id']); |
|
| 207 |
+ $table->addUniqueIndex(['id']); |
|
| 208 |
+ |
|
| 209 |
+ } else {
|
|
| 210 |
+ $table = $schema->getTable('sms_relent_settings');
|
|
| 211 |
+ |
|
| 212 |
+ $table->changeColumn('telapi_key', [
|
|
| 213 |
+ 'notnull' => false, |
|
| 214 |
+ ]); |
|
| 215 |
+ $table->changeColumn('tel_pub_key', [
|
|
| 216 |
+ 'notnull' => false, |
|
| 217 |
+ ]); |
|
| 218 |
+ $table->changeColumn('telapi_url_rec', [
|
|
| 219 |
+ 'notnull' => false, |
|
| 220 |
+ ]); |
|
| 221 |
+ $table->changeColumn('telapi_url', [
|
|
| 222 |
+ 'notnull' => false, |
|
| 223 |
+ ]); |
|
| 224 |
+ $table->changeColumn('messaging_profile_id', [
|
|
| 225 |
+ 'notnull' => false, |
|
| 226 |
+ ]); |
|
| 227 |
+ $table->changeColumn('nexapi_key', [
|
|
| 228 |
+ 'notnull' => false, |
|
| 229 |
+ ]); |
|
| 230 |
+ $table->changeColumn('nexapi_secret', [
|
|
| 231 |
+ 'notnull' => false, |
|
| 232 |
+ ]); |
|
| 233 |
+ $table->changeColumn('nexapi_url_rec', [
|
|
| 234 |
+ 'notnull' => false, |
|
| 235 |
+ ]); |
|
| 236 |
+ $table->changeColumn('nexapi_url', [
|
|
| 237 |
+ 'notnull' => false, |
|
| 238 |
+ ]); |
|
| 239 |
+ $table->changeColumn('twilapi_key', [
|
|
| 240 |
+ 'notnull' => false, |
|
| 241 |
+ ]); |
|
| 242 |
+ $table->changeColumn('twilapi_secret', [
|
|
| 243 |
+ 'notnull' => false, |
|
| 244 |
+ ]); |
|
| 245 |
+ $table->changeColumn('twilapi_url_rec', [
|
|
| 246 |
+ 'notnull' => false, |
|
| 247 |
+ ]); |
|
| 248 |
+ $table->changeColumn('twilapi_url', [
|
|
| 249 |
+ 'notnull' => false, |
|
| 250 |
+ ]); |
|
| 251 |
+ $table->changeColumn('flowapi_key', [
|
|
| 252 |
+ 'notnull' => false, |
|
| 253 |
+ ]); |
|
| 254 |
+ $table->changeColumn('flowapi_secret', [
|
|
| 255 |
+ 'notnull' => false, |
|
| 256 |
+ ]); |
|
| 257 |
+ $table->changeColumn('flowapi_url_rec', [
|
|
| 258 |
+ 'notnull' => false, |
|
| 259 |
+ ]); |
|
| 260 |
+ $table->changeColumn('flowapi_url', [
|
|
| 261 |
+ 'notnull' => false, |
|
| 262 |
+ ]); |
|
| 263 |
+ |
|
| 264 |
+ } |
|
| 265 |
+ |
|
| 266 |
+ |
|
| 267 |
+ if (!$schema->hasTable('sms_relent_received')) {
|
|
| 268 |
+ $table = $schema->createTable('sms_relent_received');
|
|
| 269 |
+ $table->addColumn('id', Types::BIGINT, [
|
|
| 270 |
+ 'autoincrement' => true, |
|
| 271 |
+ 'notnull' => true, |
|
| 272 |
+ 'length' => 11, |
|
| 273 |
+ 'unsigned' => true, |
|
| 274 |
+ ]); |
|
| 275 |
+ $table->addColumn('user_id', Types::STRING, [
|
|
| 276 |
+ 'notnull' => true, |
|
| 277 |
+ 'length' => 64, |
|
| 278 |
+ ]); |
|
| 279 |
+ $table->addColumn('message_id', Types::STRING, [
|
|
| 280 |
+ 'notnull' => true, |
|
| 281 |
+ 'length' => 512, |
|
| 282 |
+ ]); |
|
| 283 |
+ $table->addColumn('date', Types::DATETIME, [
|
|
| 284 |
+ 'notnull' => true, |
|
| 285 |
+ ]); |
|
| 286 |
+ $table->addColumn('from', Types::STRING, [
|
|
| 287 |
+ 'notnull' => true, |
|
| 288 |
+ 'length' => 128, |
|
| 289 |
+ ]); |
|
| 290 |
+ $table->addColumn('to', Types::STRING, [
|
|
| 291 |
+ 'notnull' => true, |
|
| 292 |
+ 'length' => 128, |
|
| 293 |
+ ]); |
|
| 294 |
+ $table->addColumn('message', Types::TEXT, [
|
|
| 295 |
+ 'notnull' => false, |
|
| 296 |
+ 'default' => '', |
|
| 297 |
+ ]); |
|
| 298 |
+ $table->addColumn('author_displayname', Types::STRING, [
|
|
| 299 |
+ 'notnull' => true, |
|
| 300 |
+ 'length' => 255, |
|
| 301 |
+ ]); |
|
| 302 |
+ $table->addColumn('internal_sender', Types::SMALLINT, [
|
|
| 303 |
+ 'notnull' => false, |
|
| 304 |
+ 'length' => 1, |
|
| 305 |
+ ]); |
|
| 306 |
+ $table->addColumn('conversation_id', Types::STRING, [
|
|
| 307 |
+ 'notnull' => false, |
|
| 308 |
+ 'length' => 255, |
|
| 309 |
+ ]); |
|
| 310 |
+ $table->setPrimaryKey(['id']); |
|
| 311 |
+ $table->addUniqueIndex(['id']); |
|
| 312 |
+ |
|
| 313 |
+ } |
|
| 314 |
+ |
|
| 315 |
+ |
|
| 316 |
+ if (!$schema->hasTable('sms_relent_sent')) {
|
|
| 317 |
+ $table = $schema->createTable('sms_relent_sent');
|
|
| 318 |
+ $table->addColumn('id', Types::BIGINT, [
|
|
| 319 |
+ 'autoincrement' => true, |
|
| 320 |
+ 'notnull' => true, |
|
| 321 |
+ 'length' => 11, |
|
| 322 |
+ 'unsigned' => true, |
|
| 323 |
+ ]); |
|
| 324 |
+ $table->addColumn('user_id', Types::STRING, [
|
|
| 325 |
+ 'notnull' => true, |
|
| 326 |
+ 'length' => 64, |
|
| 327 |
+ ]); |
|
| 328 |
+ $table->addColumn('message_id', Types::STRING, [
|
|
| 329 |
+ 'notnull' => true, |
|
| 330 |
+ 'length' => 512, |
|
| 331 |
+ ]); |
|
| 332 |
+ $table->addColumn('date', Types::DATETIME, [
|
|
| 333 |
+ 'notnull' => true, |
|
| 334 |
+ ]); |
|
| 335 |
+ $table->addColumn('from', Types::STRING, [
|
|
| 336 |
+ 'notnull' => true, |
|
| 337 |
+ 'length' => 128, |
|
| 338 |
+ ]); |
|
| 339 |
+ $table->addColumn('to', Types::STRING, [
|
|
| 340 |
+ 'notnull' => true, |
|
| 341 |
+ 'length' => 128, |
|
| 342 |
+ ]); |
|
| 343 |
+ $table->addColumn('network ', Types::STRING, [
|
|
| 344 |
+ 'notnull' => false, |
|
| 345 |
+ 'length' => 64, |
|
| 346 |
+ 'default' => '', |
|
| 347 |
+ ]); |
|
| 348 |
+ $table->addColumn('price', Types::STRING, [
|
|
| 349 |
+ 'notnull' => false, |
|
| 350 |
+ 'length' => 64, |
|
| 351 |
+ 'default' => '', |
|
| 352 |
+ ]); |
|
| 353 |
+ $table->addColumn('status', Types::STRING, [
|
|
| 354 |
+ 'notnull' => false, |
|
| 355 |
+ 'length' => 512, |
|
| 356 |
+ 'default' => '', |
|
| 357 |
+ ]); |
|
| 358 |
+ $table->addColumn('deliveryreceipt', Types::STRING, [
|
|
| 359 |
+ 'notnull' => false, |
|
| 360 |
+ 'length' => 64, |
|
| 361 |
+ 'default' => '', |
|
| 362 |
+ ]); |
|
| 363 |
+ $table->addColumn('message', Types::TEXT, [
|
|
| 364 |
+ 'notnull' => false, |
|
| 365 |
+ 'default' => '', |
|
| 366 |
+ ]); |
|
| 367 |
+ $table->addColumn('author_displayname', Types::STRING, [
|
|
| 368 |
+ 'notnull' => true, |
|
| 369 |
+ 'length' => 255, |
|
| 370 |
+ ]); |
|
| 371 |
+ $table->addColumn('conversation_id', Types::STRING, [
|
|
| 372 |
+ 'notnull' => false, |
|
| 373 |
+ 'length' => 255, |
|
| 374 |
+ ]); |
|
| 375 |
+ $table->setPrimaryKey(['id']); |
|
| 376 |
+ $table->addUniqueIndex(['id']); |
|
| 377 |
+ |
|
| 378 |
+ } |
|
| 379 |
+ |
|
| 380 |
+ |
|
| 381 |
+ if (!$schema->hasTable('sms_relent_autorply')) {
|
|
| 382 |
+ $table = $schema->createTable('sms_relent_autorply');
|
|
| 383 |
+ $table->addColumn('id', Types::BIGINT, [
|
|
| 384 |
+ 'autoincrement' => true, |
|
| 385 |
+ 'notnull' => true, |
|
| 386 |
+ 'length' => 11, |
|
| 387 |
+ 'unsigned' => true, |
|
| 388 |
+ ]); |
|
| 389 |
+ $table->addColumn('user_id', Types::STRING, [
|
|
| 390 |
+ 'notnull' => true, |
|
| 391 |
+ 'length' => 128, |
|
| 392 |
+ ]); |
|
| 393 |
+ $table->addColumn('saved_by_dsplname', Types::STRING, [
|
|
| 394 |
+ 'notnull' => true, |
|
| 395 |
+ 'length' => 255, |
|
| 396 |
+ ]); |
|
| 397 |
+ $table->addColumn('phone_number', Types::STRING, [
|
|
| 398 |
+ 'notnull' => true, |
|
| 399 |
+ 'length' => 128, |
|
| 400 |
+ ]); |
|
| 401 |
+ $table->addColumn('days_of_week', Types::STRING, [
|
|
| 402 |
+ 'notnull' => false, |
|
| 403 |
+ 'length' => 64, |
|
| 404 |
+ 'default' => '', |
|
| 405 |
+ ]); |
|
| 406 |
+ $table->addColumn('daily_start', Types::STRING, [
|
|
| 407 |
+ 'notnull' => false, |
|
| 408 |
+ 'length' => 8, |
|
| 409 |
+ 'default' => '', |
|
| 410 |
+ ]); |
|
| 411 |
+ $table->addColumn('daily_end', Types::STRING, [
|
|
| 412 |
+ 'notnull' => false, |
|
| 413 |
+ 'length' => 8, |
|
| 414 |
+ 'default' => '', |
|
| 415 |
+ ]); |
|
| 416 |
+ $table->addColumn('vacation_start', Types::DATETIME, [
|
|
| 417 |
+ 'notnull' => false, |
|
| 418 |
+ ]); |
|
| 419 |
+ $table->addColumn('vacation_end', Types::DATETIME, [
|
|
| 420 |
+ 'notnull' => false, |
|
| 421 |
+ ]); |
|
| 422 |
+ $table->addColumn('message_text', Types::TEXT, [
|
|
| 423 |
+ 'notnull' => false, |
|
| 424 |
+ 'default' => '', |
|
| 425 |
+ ]); |
|
| 426 |
+ $table->setPrimaryKey(['id']); |
|
| 427 |
+ $table->addUniqueIndex(['id']); |
|
| 428 |
+ |
|
| 429 |
+ } |
|
| 430 |
+ |
|
| 431 |
+ |
|
| 432 |
+ if (!$schema->hasTable('sms_relent_restrict')) {
|
|
| 433 |
+ $table = $schema->createTable('sms_relent_restrict');
|
|
| 434 |
+ $table->addColumn('id', Types::BIGINT, [
|
|
| 435 |
+ 'autoincrement' => true, |
|
| 436 |
+ 'notnull' => true, |
|
| 437 |
+ 'length' => 11, |
|
| 438 |
+ 'unsigned' => true, |
|
| 439 |
+ ]); |
|
| 440 |
+ $table->addColumn('user_id', Types::STRING, [
|
|
| 441 |
+ 'notnull' => true, |
|
| 442 |
+ 'length' => 128, |
|
| 443 |
+ ]); |
|
| 444 |
+ $table->addColumn('saved_by_dsplname', Types::STRING, [
|
|
| 445 |
+ 'notnull' => true, |
|
| 446 |
+ 'length' => 255, |
|
| 447 |
+ ]); |
|
| 448 |
+ $table->addColumn('phone_number', Types::STRING, [
|
|
| 449 |
+ 'notnull' => true, |
|
| 450 |
+ 'length' => 128, |
|
| 451 |
+ ]); |
|
| 452 |
+ $table->addColumn('groups', Types::STRING, [
|
|
| 453 |
+ 'notnull' => true, |
|
| 454 |
+ 'length' => 2048, |
|
| 455 |
+ ]); |
|
| 456 |
+ $table->addColumn('users', Types::STRING, [
|
|
| 457 |
+ 'notnull' => true, |
|
| 458 |
+ 'length' => 2048, |
|
| 459 |
+ ]); |
|
| 460 |
+ $table->setPrimaryKey(['id']); |
|
| 461 |
+ $table->addUniqueIndex(['id']); |
|
| 462 |
+ |
|
| 463 |
+ } |
|
| 464 |
+ |
|
| 465 |
+ |
|
| 466 |
+ if (!$schema->hasTable('sms_relent_subac')) {
|
|
| 467 |
+ $table = $schema->createTable('sms_relent_subac');
|
|
| 468 |
+ $table->addColumn('id', Types::BIGINT, [
|
|
| 469 |
+ 'autoincrement' => true, |
|
| 470 |
+ 'notnull' => true, |
|
| 471 |
+ 'length' => 11, |
|
| 472 |
+ 'unsigned' => true, |
|
| 473 |
+ ]); |
|
| 474 |
+ $table->addColumn('user_id', Types::STRING, [
|
|
| 475 |
+ 'notnull' => true, |
|
| 476 |
+ 'length' => 128, |
|
| 477 |
+ ]); |
|
| 478 |
+ $table->addColumn('tnx_groups_allowed', Types::TEXT, [
|
|
| 479 |
+ 'notnull' => false, |
|
| 480 |
+ 'default' => '', |
|
| 481 |
+ ]); |
|
| 482 |
+ $table->addColumn('tnx_users_allowed', Types::TEXT, [
|
|
| 483 |
+ 'notnull' => false, |
|
| 484 |
+ 'default' => '', |
|
| 485 |
+ ]); |
|
| 486 |
+ $table->addColumn('plv_groups_allowed', Types::TEXT, [
|
|
| 487 |
+ 'notnull' => false, |
|
| 488 |
+ 'default' => '', |
|
| 489 |
+ ]); |
|
| 490 |
+ $table->addColumn('plv_users_allowed', Types::TEXT, [
|
|
| 491 |
+ 'notnull' => false, |
|
| 492 |
+ 'default' => '', |
|
| 493 |
+ ]); |
|
| 494 |
+ $table->addColumn('twl_groups_allowed', Types::TEXT, [
|
|
| 495 |
+ 'notnull' => false, |
|
| 496 |
+ 'default' => '', |
|
| 497 |
+ ]); |
|
| 498 |
+ $table->addColumn('twl_users_allowed', Types::TEXT, [
|
|
| 499 |
+ 'notnull' => false, |
|
| 500 |
+ 'default' => '', |
|
| 501 |
+ ]); |
|
| 502 |
+ $table->addColumn('flr_groups_allowed', Types::TEXT, [
|
|
| 503 |
+ 'notnull' => false, |
|
| 504 |
+ 'default' => '', |
|
| 505 |
+ ]); |
|
| 506 |
+ $table->addColumn('flr_users_allowed', Types::TEXT, [
|
|
| 507 |
+ 'notnull' => false, |
|
| 508 |
+ 'default' => '', |
|
| 509 |
+ ]); |
|
| 510 |
+ $table->addColumn('tnx_groups_del', Types::SMALLINT, [
|
|
| 511 |
+ 'notnull' => false, |
|
| 512 |
+ 'length' => 1, |
|
| 513 |
+ ]); |
|
| 514 |
+ $table->addColumn('tnx_users_del', Types::SMALLINT, [
|
|
| 515 |
+ 'notnull' => false, |
|
| 516 |
+ 'length' => 1, |
|
| 517 |
+ ]); |
|
| 518 |
+ $table->addColumn('plv_groups_del', Types::SMALLINT, [
|
|
| 519 |
+ 'notnull' => false, |
|
| 520 |
+ 'length' => 1, |
|
| 521 |
+ ]); |
|
| 522 |
+ $table->addColumn('plv_users_del', Types::SMALLINT, [
|
|
| 523 |
+ 'notnull' => false, |
|
| 524 |
+ 'length' => 1, |
|
| 525 |
+ ]); |
|
| 526 |
+ $table->addColumn('twl_groups_del', Types::SMALLINT, [
|
|
| 527 |
+ 'notnull' => false, |
|
| 528 |
+ 'length' => 1, |
|
| 529 |
+ ]); |
|
| 530 |
+ $table->addColumn('twl_users_del', Types::SMALLINT, [
|
|
| 531 |
+ 'notnull' => false, |
|
| 532 |
+ 'length' => 1, |
|
| 533 |
+ ]); |
|
| 534 |
+ $table->addColumn('flr_groups_del', Types::SMALLINT, [
|
|
| 535 |
+ 'notnull' => false, |
|
| 536 |
+ 'length' => 1, |
|
| 537 |
+ ]); |
|
| 538 |
+ $table->addColumn('flr_users_del', Types::SMALLINT, [
|
|
| 539 |
+ 'notnull' => false, |
|
| 540 |
+ 'length' => 1, |
|
| 541 |
+ ]); |
|
| 542 |
+ $table->setPrimaryKey(['id']); |
|
| 543 |
+ $table->addUniqueIndex(['id']); |
|
| 544 |
+ |
|
| 545 |
+ } else {
|
|
| 546 |
+ |
|
| 547 |
+ $table = $schema->getTable('sms_relent_subac');
|
|
| 548 |
+ |
|
| 549 |
+ if (!$table->hasColumn('tnx_groups_del')) {
|
|
| 550 |
+ $table->addColumn('tnx_groups_del', Types::SMALLINT, [
|
|
| 551 |
+ 'notnull' => false, |
|
| 552 |
+ 'length' => 1, |
|
| 553 |
+ ]); |
|
| 554 |
+ } |
|
| 555 |
+ if (!$table->hasColumn('tnx_users_del')) {
|
|
| 556 |
+ $table->addColumn('tnx_users_del', Types::SMALLINT, [
|
|
| 557 |
+ 'notnull' => false, |
|
| 558 |
+ 'length' => 1, |
|
| 559 |
+ ]); |
|
| 560 |
+ } |
|
| 561 |
+ if (!$table->hasColumn('plv_groups_del')) {
|
|
| 562 |
+ $table->addColumn('plv_groups_del', Types::SMALLINT, [
|
|
| 563 |
+ 'notnull' => false, |
|
| 564 |
+ 'length' => 1, |
|
| 565 |
+ ]); |
|
| 566 |
+ } |
|
| 567 |
+ if (!$table->hasColumn('plv_users_del')) {
|
|
| 568 |
+ $table->addColumn('plv_users_del', Types::SMALLINT, [
|
|
| 569 |
+ 'notnull' => false, |
|
| 570 |
+ 'length' => 1, |
|
| 571 |
+ ]); |
|
| 572 |
+ } |
|
| 573 |
+ if (!$table->hasColumn('twl_groups_del')) {
|
|
| 574 |
+ $table->addColumn('twl_groups_del', Types::SMALLINT, [
|
|
| 575 |
+ 'notnull' => false, |
|
| 576 |
+ 'length' => 1, |
|
| 577 |
+ ]); |
|
| 578 |
+ } |
|
| 579 |
+ if (!$table->hasColumn('twl_users_del')) {
|
|
| 580 |
+ $table->addColumn('twl_users_del', Types::SMALLINT, [
|
|
| 581 |
+ 'notnull' => false, |
|
| 582 |
+ 'length' => 1, |
|
| 583 |
+ ]); |
|
| 584 |
+ } |
|
| 585 |
+ if (!$table->hasColumn('flr_groups_del')) {
|
|
| 586 |
+ $table->addColumn('flr_groups_del', Types::SMALLINT, [
|
|
| 587 |
+ 'notnull' => false, |
|
| 588 |
+ 'length' => 1, |
|
| 589 |
+ ]); |
|
| 590 |
+ } |
|
| 591 |
+ if (!$table->hasColumn('flr_users_del')) {
|
|
| 592 |
+ $table->addColumn('flr_users_del', Types::SMALLINT, [
|
|
| 593 |
+ 'notnull' => false, |
|
| 594 |
+ 'length' => 1, |
|
| 595 |
+ ]); |
|
| 596 |
+ } |
|
| 597 |
+ } |
|
| 598 |
+ |
|
| 599 |
+ |
|
| 600 |
+ if (!$schema->hasTable('sms_relent_conv')) {
|
|
| 601 |
+ $table = $schema->createTable('sms_relent_conv');
|
|
| 602 |
+ $table->addColumn('id', Types::BIGINT, [
|
|
| 603 |
+ 'autoincrement' => true, |
|
| 604 |
+ 'notnull' => true, |
|
| 605 |
+ 'length' => 11, |
|
| 606 |
+ 'unsigned' => true, |
|
| 607 |
+ ]); |
|
| 608 |
+ $table->addColumn('conversation_id', Types::STRING, [
|
|
| 609 |
+ 'notnull' => false, |
|
| 610 |
+ 'length' => 255, |
|
| 611 |
+ ]); |
|
| 612 |
+ $table->addColumn('archived', Types::SMALLINT, [
|
|
| 613 |
+ 'notnull' => false, |
|
| 614 |
+ 'length' => 1, |
|
| 615 |
+ ]); |
|
| 616 |
+ $table->addColumn('last_archived', Types::DATETIME, [
|
|
| 617 |
+ 'notnull' => false, |
|
| 618 |
+ ]); |
|
| 619 |
+ $table->addColumn('last_unarchived', Types::DATETIME, [
|
|
| 620 |
+ 'notnull' => false, |
|
| 621 |
+ ]); |
|
| 622 |
+ $table->addColumn('archived_by', Types::STRING, [
|
|
| 623 |
+ 'notnull' => false, |
|
| 624 |
+ 'length' => 128, |
|
| 625 |
+ ]); |
|
| 626 |
+ $table->addColumn('unarchived_by', Types::STRING, [
|
|
| 627 |
+ 'notnull' => false, |
|
| 628 |
+ 'length' => 128, |
|
| 629 |
+ ]); |
|
| 630 |
+ $table->addColumn('last_msg_date', Types::DATETIME, [
|
|
| 631 |
+ 'notnull' => true, |
|
| 632 |
+ ]); |
|
| 633 |
+ $table->addColumn('last_msg_from', Types::STRING, [
|
|
| 634 |
+ 'notnull' => true, |
|
| 635 |
+ 'length' => 128, |
|
| 636 |
+ ]); |
|
| 637 |
+ $table->addColumn('last_msg_to', Types::STRING, [
|
|
| 638 |
+ 'notnull' => true, |
|
| 639 |
+ 'length' => 128, |
|
| 640 |
+ ]); |
|
| 641 |
+ $table->addColumn('last_message', Types::TEXT, [
|
|
| 642 |
+ 'notnull' => false, |
|
| 643 |
+ 'default' => '', |
|
| 644 |
+ ]); |
|
| 645 |
+ $table->addColumn('lastmsgdisplayname', Types::STRING, [
|
|
| 646 |
+ 'notnull' => true, |
|
| 647 |
+ 'length' => 255, |
|
| 648 |
+ ]); |
|
| 649 |
+ $table->addColumn('flagged', Types::SMALLINT, [
|
|
| 650 |
+ 'notnull' => false, |
|
| 651 |
+ 'length' => 1, |
|
| 652 |
+ ]); |
|
| 653 |
+ $table->addColumn('flagunflagby', Types::STRING, [
|
|
| 654 |
+ 'notnull' => false, |
|
| 655 |
+ 'length' => 128, |
|
| 656 |
+ ]); |
|
| 657 |
+ $table->addColumn('flagunflagdate', Types::DATETIME, [
|
|
| 658 |
+ 'notnull' => false, |
|
| 659 |
+ ]); |
|
| 660 |
+ $table->addColumn('tag', Types::STRING, [
|
|
| 661 |
+ 'notnull' => false, |
|
| 662 |
+ 'length' => 100, |
|
| 663 |
+ ]); |
|
| 664 |
+ $table->addColumn('taguntagby', Types::STRING, [
|
|
| 665 |
+ 'notnull' => false, |
|
| 666 |
+ 'length' => 128, |
|
| 667 |
+ ]); |
|
| 668 |
+ $table->addColumn('taguntagdate', Types::DATETIME, [
|
|
| 669 |
+ 'notnull' => false, |
|
| 670 |
+ ]); |
|
| 671 |
+ $table->addColumn('description', Types::TEXT, [
|
|
| 672 |
+ 'notnull' => false, |
|
| 673 |
+ 'default' => '', |
|
| 674 |
+ ]); |
|
| 675 |
+ $table->addColumn('descriptionby', Types::STRING, [
|
|
| 676 |
+ 'notnull' => false, |
|
| 677 |
+ 'length' => 128, |
|
| 678 |
+ ]); |
|
| 679 |
+ $table->addColumn('descriptiondate', Types::DATETIME, [
|
|
| 680 |
+ 'notnull' => false, |
|
| 681 |
+ ]); |
|
| 682 |
+ $table->addColumn('lastmsgprovid', Types::STRING, [
|
|
| 683 |
+ 'notnull' => false, |
|
| 684 |
+ 'length' => 512, |
|
| 685 |
+ 'default' => '', |
|
| 686 |
+ ]); |
|
| 687 |
+ $table->setPrimaryKey(['id']); |
|
| 688 |
+ $table->addUniqueIndex(['id']); |
|
| 689 |
+ |
|
| 690 |
+ } |
|
| 691 |
+ |
|
| 692 |
+ return $schema; |
|
| 693 |
+ } |
|
| 694 |
+ |
|
| 695 |
+} |