Browse code

added appinfo/info.xml appinfo/signature.json CHANGELOG.txt img/sms_relentless.svg img/sms_relentless_dark.svg img/sms_relentless_grey.svg lib/Migration/Version100Date20211106192148.php lib/Migration/Version106Date20220813144231.php lib/Migration/Version108Date20220823132408.php lib/Migration/Version114Date20221202011625.php

DoubleBastionAdmin authored on 01/12/2022 21:42:31
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,268 @@
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\Migration\IOutput;
32
+use OCP\Migration\SimpleMigrationStep;
33
+
34
+
35
+class Version106Date20220813144231 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): ?ISchemaWrapper {
43
+		/** @var ISchemaWrapper $schema */
44
+		$schema = $schemaClosure();
45
+
46
+		if (!$schema->hasTable('sms_relent_settings')) {
47
+			$table = $schema->createTable('sms_relent_settings');
48
+			$table->addColumn('id', Types::BIGINT, [
49
+				'autoincrement' => true,
50
+				'notnull' => true,
51
+                                'length' => 11,
52
+                                'unsigned' => true,
53
+			]);
54
+			$table->addColumn('user_id', Types::STRING, [
55
+				'notnull' => true,
56
+				'length' => 128,
57
+			]);
58
+			$table->addColumn('telapi_key', Types::STRING, [
59
+				'notnull' => true,
60
+				'length' => 512,
61
+			]);
62
+			$table->addColumn('tel_pub_key', Types::STRING, [
63
+				'notnull' => true,
64
+				'length' => 512,
65
+			]);
66
+			$table->addColumn('telapi_url_rec', Types::STRING, [
67
+				'notnull' => true,
68
+				'length' => 512,
69
+			]);
70
+			$table->addColumn('telapi_url', Types::STRING, [
71
+				'notnull' => true,
72
+				'length' => 512,
73
+			]);
74
+			$table->addColumn('messaging_profile_id', Types::STRING, [
75
+				'notnull' => true,
76
+				'length' => 512,
77
+			]);
78
+			$table->addColumn('nexapi_key', Types::STRING, [
79
+				'notnull' => true,
80
+				'length' => 512,
81
+			]);
82
+			$table->addColumn('nexapi_secret', Types::STRING, [
83
+				'notnull' => true,
84
+				'length' => 512,
85
+			]);
86
+			$table->addColumn('nexapi_url_rec', Types::STRING, [
87
+				'notnull' => true,
88
+				'length' => 512,
89
+			]);
90
+			$table->addColumn('nexapi_url', Types::STRING, [
91
+				'notnull' => true,
92
+				'length' => 512,
93
+			]);
94
+			$table->addColumn('twilapi_key', Types::STRING, [
95
+				'notnull' => true,
96
+				'length' => 512,
97
+			]);
98
+			$table->addColumn('twilapi_secret', Types::STRING, [
99
+				'notnull' => true,
100
+				'length' => 512,
101
+			]);
102
+			$table->addColumn('twilapi_url_rec', Types::STRING, [
103
+				'notnull' => true,
104
+				'length' => 512,
105
+			]);
106
+			$table->addColumn('twilapi_url', Types::STRING, [
107
+				'notnull' => true,
108
+				'length' => 512,
109
+			]);
110
+			$table->addColumn('tel_sender_name', Types::STRING, [
111
+				'notnull' => false,
112
+				'length' => 48,
113
+				'default' => '',
114
+			]);
115
+			$table->addColumn('nex_sender_name', Types::STRING, [
116
+				'notnull' => false,
117
+				'length' => 48,
118
+				'default' => '',
119
+			]);
120
+			$table->addColumn('twil_sender_name', Types::STRING, [
121
+				'notnull' => false,
122
+				'length' => 48,
123
+				'default' => '',
124
+			]);
125
+			$table->addColumn('messagesperpage', Types::INTEGER, [
126
+				'notnull' => false,
127
+				'length' => 11,
128
+                                'unsigned' => true,
129
+			]);
130
+			$table->addColumn('get_notify', Types::SMALLINT, [
131
+				'notnull' => false,
132
+				'length' => 1,
133
+			]);
134
+			$table->addColumn('notification_email', Types::STRING, [
135
+				'notnull' => false,
136
+				'length' => 512,
137
+				'default' => '',
138
+			]);
139
+			$table->addColumn('getsmsinemail', Types::SMALLINT, [
140
+				'notnull' => false,
141
+				'length' => 1,
142
+			]);
143
+                        $table->setPrimaryKey(['id']);
144
+                        $table->addUniqueIndex(['id']);
145
+
146
+		} else {
147
+
148
+                        $table = $schema->getTable('sms_relent_settings');
149
+
150
+			$table->addColumn('twilapi_key', Types::STRING, [
151
+				'notnull' => true,
152
+				'length' => 512,
153
+			]);
154
+			$table->addColumn('twilapi_secret', Types::STRING, [
155
+				'notnull' => true,
156
+				'length' => 512,
157
+			]);
158
+			$table->addColumn('twilapi_url_rec', Types::STRING, [
159
+				'notnull' => true,
160
+				'length' => 512,
161
+			]);
162
+			$table->addColumn('twilapi_url', Types::STRING, [
163
+				'notnull' => true,
164
+				'length' => 512,
165
+			]);
166
+			$table->addColumn('twil_sender_name', Types::STRING, [
167
+				'notnull' => false,
168
+				'length' => 48,
169
+				'default' => '',
170
+			]);
171
+
172
+                }
173
+
174
+		if (!$schema->hasTable('sms_relent_received')) {
175
+			$table = $schema->createTable('sms_relent_received');
176
+			$table->addColumn('id', Types::BIGINT, [
177
+				'autoincrement' => true,
178
+				'notnull' => true,
179
+                                'length' => 11,
180
+                                'unsigned' => true,
181
+			]);
182
+			$table->addColumn('user_id', Types::STRING, [
183
+				'notnull' => true,
184
+				'length' => 64,
185
+			]);
186
+			$table->addColumn('message_id', Types::STRING, [
187
+				'notnull' => true,
188
+				'length' => 512,
189
+			]);
190
+			$table->addColumn('date', Types::DATETIME, [
191
+				'notnull' => true,
192
+			]);
193
+			$table->addColumn('from', Types::STRING, [
194
+				'notnull' => true,
195
+				'length' => 128,
196
+			]);
197
+			$table->addColumn('to', Types::STRING, [
198
+				'notnull' => true,
199
+				'length' => 128,
200
+			]);
201
+			$table->addColumn('message', Types::TEXT, [
202
+				'notnull' => false,
203
+				'default' => '',
204
+			]);
205
+                        $table->setPrimaryKey(['id']);
206
+                        $table->addUniqueIndex(['id']);
207
+
208
+		}
209
+
210
+		if (!$schema->hasTable('sms_relent_sent')) {
211
+			$table = $schema->createTable('sms_relent_sent');
212
+			$table->addColumn('id', Types::BIGINT, [
213
+				'autoincrement' => true,
214
+				'notnull' => true,
215
+                                'length' => 11,
216
+                                'unsigned' => true,
217
+			]);
218
+			$table->addColumn('user_id', Types::STRING, [
219
+				'notnull' => true,
220
+				'length' => 64,
221
+			]);
222
+			$table->addColumn('message_id', Types::STRING, [
223
+				'notnull' => true,
224
+				'length' => 512,
225
+			]);
226
+			$table->addColumn('date', Types::DATETIME, [
227
+				'notnull' => true,
228
+			]);
229
+			$table->addColumn('from', Types::STRING, [
230
+				'notnull' => true,
231
+				'length' => 128,
232
+			]);
233
+			$table->addColumn('to', Types::STRING, [
234
+				'notnull' => true,
235
+				'length' => 128,
236
+			]);
237
+			$table->addColumn('network ', Types::STRING, [
238
+				'notnull' => false,
239
+				'length' => 64,
240
+				'default' => '',
241
+			]);
242
+			$table->addColumn('price', Types::STRING, [
243
+				'notnull' => false,
244
+				'length' => 64,
245
+				'default' => '',
246
+			]);
247
+			$table->addColumn('status', Types::STRING, [
248
+				'notnull' => false,
249
+				'length' => 512,
250
+				'default' => '',
251
+			]);
252
+			$table->addColumn('deliveryreceipt', Types::STRING, [
253
+				'notnull' => false,
254
+				'length' => 64,
255
+				'default' => '',
256
+			]);
257
+			$table->addColumn('message', Types::TEXT, [
258
+				'notnull' => false,
259
+                                'default' => '',
260
+			]);
261
+                        $table->setPrimaryKey(['id']);
262
+                        $table->addUniqueIndex(['id']);
263
+
264
+		}
265
+
266
+		return $schema;
267
+	}
268
+}
Browse code

removed appinfo/info.xml appinfo/signature.json CHANGELOG.txt img/sms_relentless.svg img/sms_relentless_dark.svg img/sms_relentless_grey.svg lib/Migration/Version100Date20211106192148.php lib/Migration/Version105Date20220509201842.php lib/Migration/Version106Date20220813144231.php lib/Migration/Version108Date20220823132408.php lib/Migration/Version113Date20221201044315.php

DoubleBastionAdmin authored on 01/12/2022 21:35:11
Showing 1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,351 +0,0 @@
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 Doctrine\DBAL\Types\Type;
31
-use OCP\DB\ISchemaWrapper;
32
-use OCP\Migration\IOutput;
33
-use OCP\Migration\SimpleMigrationStep;
34
-
35
-
36
-class Version106Date20220813144231 extends SimpleMigrationStep {
37
-	/**
38
-	 * @param IOutput $output
39
-	 * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
40
-	 * @param array $options
41
-	 * @return null|ISchemaWrapper
42
-	 */
43
-	public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
44
-		/** @var ISchemaWrapper $schema */
45
-		$schema = $schemaClosure();
46
-
47
-		if (!$schema->hasTable('sms_relent_settings')) {
48
-			$table = $schema->createTable('sms_relent_settings');
49
-			$table->addColumn('id', 'bigint', [
50
-				'autoincrement' => true,
51
-				'notnull' => true,
52
-                                'length' => 11,
53
-                                'unsigned' => true,
54
-			]);
55
-			$table->addColumn('user_id', 'string', [
56
-				'notnull' => true,
57
-				'length' => 128,
58
-			]);
59
-			$table->addColumn('telapi_key', 'string', [
60
-				'notnull' => true,
61
-				'length' => 512,
62
-			]);
63
-			$table->addColumn('tel_pub_key', 'string', [
64
-				'notnull' => true,
65
-				'length' => 512,
66
-			]);
67
-			$table->addColumn('telapi_url_rec', 'string', [
68
-				'notnull' => true,
69
-				'length' => 512,
70
-			]);
71
-			$table->addColumn('telapi_url', 'string', [
72
-				'notnull' => true,
73
-				'length' => 512,
74
-			]);
75
-			$table->addColumn('messaging_profile_id', 'string', [
76
-				'notnull' => true,
77
-				'length' => 512,
78
-			]);
79
-			$table->addColumn('nexapi_key', 'string', [
80
-				'notnull' => true,
81
-				'length' => 512,
82
-			]);
83
-			$table->addColumn('nexapi_secret', 'string', [
84
-				'notnull' => true,
85
-				'length' => 512,
86
-			]);
87
-			$table->addColumn('nexapi_url_rec', 'string', [
88
-				'notnull' => true,
89
-				'length' => 512,
90
-			]);
91
-			$table->addColumn('nexapi_url', 'string', [
92
-				'notnull' => true,
93
-				'length' => 512,
94
-			]);
95
-			$table->addColumn('twilapi_key', 'string', [
96
-				'notnull' => true,
97
-				'length' => 512,
98
-			]);
99
-			$table->addColumn('twilapi_secret', 'string', [
100
-				'notnull' => true,
101
-				'length' => 512,
102
-			]);
103
-			$table->addColumn('twilapi_url_rec', 'string', [
104
-				'notnull' => true,
105
-				'length' => 512,
106
-			]);
107
-			$table->addColumn('twilapi_url', 'string', [
108
-				'notnull' => true,
109
-				'length' => 512,
110
-			]);
111
-			$table->addColumn('tel_sender_name', 'string', [
112
-				'notnull' => false,
113
-				'length' => 48,
114
-				'default' => '',
115
-			]);
116
-			$table->addColumn('nex_sender_name', 'string', [
117
-				'notnull' => false,
118
-				'length' => 48,
119
-				'default' => '',
120
-			]);
121
-			$table->addColumn('twil_sender_name', 'string', [
122
-				'notnull' => false,
123
-				'length' => 48,
124
-				'default' => '',
125
-			]);
126
-			$table->addColumn('messagesperpage', 'integer', [
127
-				'notnull' => false,
128
-				'length' => 11,
129
-                                'unsigned' => true,
130
-			]);
131
-			$table->addColumn('get_notify', 'smallint', [
132
-				'notnull' => false,
133
-				'length' => 1,
134
-			]);
135
-			$table->addColumn('notification_email', 'string', [
136
-				'notnull' => false,
137
-				'length' => 512,
138
-				'default' => '',
139
-			]);
140
-			$table->addColumn('getsmsinemail', 'smallint', [
141
-				'notnull' => false,
142
-				'length' => 1,
143
-			]);
144
-                        $table->setPrimaryKey(['id']);
145
-                        $table->addUniqueIndex(['id']);
146
-
147
-		} else {
148
-
149
-                        $table = $schema->getTable('sms_relent_settings');
150
-
151
-			$table->changeColumn('telapi_key', [
152
-				'notnull' => true,
153
-                                'length' => 512,
154
-			]);
155
-			$table->changeColumn('tel_pub_key', [
156
-				'notnull' => true,
157
-                                'length' => 512,
158
-			]);
159
-			$table->changeColumn('telapi_url_rec', [
160
-				'notnull' => true,
161
-                                'length' => 512,
162
-			]);
163
-			$table->changeColumn('telapi_url', [
164
-				'notnull' => true,
165
-                                'length' => 512,
166
-			]);
167
-			$table->changeColumn('messaging_profile_id', [
168
-				'notnull' => true,
169
-                                'length' => 512,
170
-			]);
171
-			$table->changeColumn('nexapi_key', [
172
-				'notnull' => true,
173
-                                'length' => 512,
174
-			]);
175
-			$table->changeColumn('nexapi_secret', [
176
-				'notnull' => true,
177
-                                'length' => 512,
178
-			]);
179
-			$table->changeColumn('nexapi_url_rec', [
180
-				'notnull' => true,
181
-                                'length' => 512,
182
-			]);
183
-			$table->changeColumn('nexapi_url', [
184
-				'notnull' => true,
185
-                                'length' => 512,
186
-			]);
187
-			$table->changeColumn('tel_sender_name', [
188
-				'notnull' => false,
189
-                                'length' => 48,
190
-				'default' => '',
191
-			]);
192
-			$table->changeColumn('nex_sender_name', [
193
-				'notnull' => false,
194
-                                'length' => 48,
195
-				'default' => '',
196
-			]);
197
-			$table->changeColumn('notification_email', [
198
-				'notnull' => false,
199
-                                'length' => 512,
200
-				'default' => '',
201
-			]);
202
-			$table->addColumn('twilapi_key', 'string', [
203
-				'notnull' => true,
204
-				'length' => 512,
205
-			]);
206
-			$table->addColumn('twilapi_secret', 'string', [
207
-				'notnull' => true,
208
-				'length' => 512,
209
-			]);
210
-			$table->addColumn('twilapi_url_rec', 'string', [
211
-				'notnull' => true,
212
-				'length' => 512,
213
-			]);
214
-			$table->addColumn('twilapi_url', 'string', [
215
-				'notnull' => true,
216
-				'length' => 512,
217
-			]);
218
-			$table->addColumn('twil_sender_name', 'string', [
219
-				'notnull' => false,
220
-				'length' => 48,
221
-				'default' => '',
222
-			]);
223
-
224
-                }
225
-
226
-		if (!$schema->hasTable('sms_relent_received')) {
227
-			$table = $schema->createTable('sms_relent_received');
228
-			$table->addColumn('id', 'bigint', [
229
-				'autoincrement' => true,
230
-				'notnull' => true,
231
-                                'length' => 11,
232
-                                'unsigned' => true,
233
-			]);
234
-			$table->addColumn('user_id', 'string', [
235
-				'notnull' => true,
236
-				'length' => 64,
237
-			]);
238
-			$table->addColumn('message_id', 'string', [
239
-				'notnull' => true,
240
-				'length' => 512,
241
-			]);
242
-			$table->addColumn('date', 'datetime', [
243
-				'notnull' => true,
244
-			]);
245
-			$table->addColumn('from', 'string', [
246
-				'notnull' => true,
247
-				'length' => 128,
248
-			]);
249
-			$table->addColumn('to', 'string', [
250
-				'notnull' => true,
251
-				'length' => 128,
252
-			]);
253
-			$table->addColumn('message', 'text', [
254
-				'notnull' => false,
255
-				'default' => '',
256
-			]);
257
-                        $table->setPrimaryKey(['id']);
258
-                        $table->addUniqueIndex(['id']);
259
-
260
-		} else {
261
-
262
-			$table = $schema->getTable('sms_relent_received');
263
-
264
-			$column = $table->getColumn('message');
265
-			$column->setType(Type::getType('text'));
266
-			$column->setNotnull(false);
267
-			$column->setDefault('');
268
-
269
-			$table->changeColumn('message_id', [
270
-				'notnull' => true,
271
-				'length' => 512,
272
-                        ]);
273
-		}
274
-
275
-		if (!$schema->hasTable('sms_relent_sent')) {
276
-			$table = $schema->createTable('sms_relent_sent');
277
-			$table->addColumn('id', 'bigint', [
278
-				'autoincrement' => true,
279
-				'notnull' => true,
280
-                                'length' => 11,
281
-                                'unsigned' => true,
282
-			]);
283
-			$table->addColumn('user_id', 'string', [
284
-				'notnull' => true,
285
-				'length' => 64,
286
-			]);
287
-			$table->addColumn('message_id', 'string', [
288
-				'notnull' => true,
289
-				'length' => 512,
290
-			]);
291
-			$table->addColumn('date', 'datetime', [
292
-				'notnull' => true,
293
-			]);
294
-			$table->addColumn('from', 'string', [
295
-				'notnull' => true,
296
-				'length' => 128,
297
-			]);
298
-			$table->addColumn('to', 'string', [
299
-				'notnull' => true,
300
-				'length' => 128,
301
-			]);
302
-			$table->addColumn('network ', 'string', [
303
-				'notnull' => false,
304
-				'length' => 64,
305
-				'default' => '',
306
-			]);
307
-			$table->addColumn('price', 'string', [
308
-				'notnull' => false,
309
-				'length' => 64,
310
-				'default' => '',
311
-			]);
312
-			$table->addColumn('status', 'string', [
313
-				'notnull' => false,
314
-				'length' => 512,
315
-				'default' => '',
316
-			]);
317
-			$table->addColumn('deliveryreceipt', 'string', [
318
-				'notnull' => false,
319
-				'length' => 64,
320
-				'default' => '',
321
-			]);
322
-			$table->addColumn('message', 'text', [
323
-				'notnull' => false,
324
-                                'default' => '',
325
-			]);
326
-                        $table->setPrimaryKey(['id']);
327
-                        $table->addUniqueIndex(['id']);
328
-
329
-		} else {
330
-
331
-			$table = $schema->getTable('sms_relent_sent');
332
-
333
-			$column = $table->getColumn('message');
334
-			$column->setType(Type::getType('text'));
335
-			$column->setNotnull(false);
336
-			$column->setDefault('');
337
-
338
-			$table->changeColumn('message_id', [
339
-				'notnull' => true,
340
-				'length' => 512,
341
-                        ]);
342
-			$table->changeColumn('status', [
343
-				'notnull' => false,
344
-				'length' => 512,
345
-				'default' => '',
346
-                        ]);
347
-		}
348
-
349
-		return $schema;
350
-	}
351
-}
Browse code

added CHANGELOG.txt README.md appinfo/info.xml appinfo/routes.php appinfo/signature.json css/style.css js/sendsms.js js/settings.js lib/AppInfo/Application.php lib/Controller/AuthorApiController.php lib/Controller/SmsrelentlessController.php lib/Service/SmsrelentlessService.php img/sms_relentless_screenshot.png lib/Migration/Version106Date20220813144231.php

DoubleBastionAdmin authored on 13/08/2022 12:43:51
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,351 @@
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 Doctrine\DBAL\Types\Type;
31
+use OCP\DB\ISchemaWrapper;
32
+use OCP\Migration\IOutput;
33
+use OCP\Migration\SimpleMigrationStep;
34
+
35
+
36
+class Version106Date20220813144231 extends SimpleMigrationStep {
37
+	/**
38
+	 * @param IOutput $output
39
+	 * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
40
+	 * @param array $options
41
+	 * @return null|ISchemaWrapper
42
+	 */
43
+	public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
44
+		/** @var ISchemaWrapper $schema */
45
+		$schema = $schemaClosure();
46
+
47
+		if (!$schema->hasTable('sms_relent_settings')) {
48
+			$table = $schema->createTable('sms_relent_settings');
49
+			$table->addColumn('id', 'bigint', [
50
+				'autoincrement' => true,
51
+				'notnull' => true,
52
+                                'length' => 11,
53
+                                'unsigned' => true,
54
+			]);
55
+			$table->addColumn('user_id', 'string', [
56
+				'notnull' => true,
57
+				'length' => 128,
58
+			]);
59
+			$table->addColumn('telapi_key', 'string', [
60
+				'notnull' => true,
61
+				'length' => 512,
62
+			]);
63
+			$table->addColumn('tel_pub_key', 'string', [
64
+				'notnull' => true,
65
+				'length' => 512,
66
+			]);
67
+			$table->addColumn('telapi_url_rec', 'string', [
68
+				'notnull' => true,
69
+				'length' => 512,
70
+			]);
71
+			$table->addColumn('telapi_url', 'string', [
72
+				'notnull' => true,
73
+				'length' => 512,
74
+			]);
75
+			$table->addColumn('messaging_profile_id', 'string', [
76
+				'notnull' => true,
77
+				'length' => 512,
78
+			]);
79
+			$table->addColumn('nexapi_key', 'string', [
80
+				'notnull' => true,
81
+				'length' => 512,
82
+			]);
83
+			$table->addColumn('nexapi_secret', 'string', [
84
+				'notnull' => true,
85
+				'length' => 512,
86
+			]);
87
+			$table->addColumn('nexapi_url_rec', 'string', [
88
+				'notnull' => true,
89
+				'length' => 512,
90
+			]);
91
+			$table->addColumn('nexapi_url', 'string', [
92
+				'notnull' => true,
93
+				'length' => 512,
94
+			]);
95
+			$table->addColumn('twilapi_key', 'string', [
96
+				'notnull' => true,
97
+				'length' => 512,
98
+			]);
99
+			$table->addColumn('twilapi_secret', 'string', [
100
+				'notnull' => true,
101
+				'length' => 512,
102
+			]);
103
+			$table->addColumn('twilapi_url_rec', 'string', [
104
+				'notnull' => true,
105
+				'length' => 512,
106
+			]);
107
+			$table->addColumn('twilapi_url', 'string', [
108
+				'notnull' => true,
109
+				'length' => 512,
110
+			]);
111
+			$table->addColumn('tel_sender_name', 'string', [
112
+				'notnull' => false,
113
+				'length' => 48,
114
+				'default' => '',
115
+			]);
116
+			$table->addColumn('nex_sender_name', 'string', [
117
+				'notnull' => false,
118
+				'length' => 48,
119
+				'default' => '',
120
+			]);
121
+			$table->addColumn('twil_sender_name', 'string', [
122
+				'notnull' => false,
123
+				'length' => 48,
124
+				'default' => '',
125
+			]);
126
+			$table->addColumn('messagesperpage', 'integer', [
127
+				'notnull' => false,
128
+				'length' => 11,
129
+                                'unsigned' => true,
130
+			]);
131
+			$table->addColumn('get_notify', 'smallint', [
132
+				'notnull' => false,
133
+				'length' => 1,
134
+			]);
135
+			$table->addColumn('notification_email', 'string', [
136
+				'notnull' => false,
137
+				'length' => 512,
138
+				'default' => '',
139
+			]);
140
+			$table->addColumn('getsmsinemail', 'smallint', [
141
+				'notnull' => false,
142
+				'length' => 1,
143
+			]);
144
+                        $table->setPrimaryKey(['id']);
145
+                        $table->addUniqueIndex(['id']);
146
+
147
+		} else {
148
+
149
+                        $table = $schema->getTable('sms_relent_settings');
150
+
151
+			$table->changeColumn('telapi_key', [
152
+				'notnull' => true,
153
+                                'length' => 512,
154
+			]);
155
+			$table->changeColumn('tel_pub_key', [
156
+				'notnull' => true,
157
+                                'length' => 512,
158
+			]);
159
+			$table->changeColumn('telapi_url_rec', [
160
+				'notnull' => true,
161
+                                'length' => 512,
162
+			]);
163
+			$table->changeColumn('telapi_url', [
164
+				'notnull' => true,
165
+                                'length' => 512,
166
+			]);
167
+			$table->changeColumn('messaging_profile_id', [
168
+				'notnull' => true,
169
+                                'length' => 512,
170
+			]);
171
+			$table->changeColumn('nexapi_key', [
172
+				'notnull' => true,
173
+                                'length' => 512,
174
+			]);
175
+			$table->changeColumn('nexapi_secret', [
176
+				'notnull' => true,
177
+                                'length' => 512,
178
+			]);
179
+			$table->changeColumn('nexapi_url_rec', [
180
+				'notnull' => true,
181
+                                'length' => 512,
182
+			]);
183
+			$table->changeColumn('nexapi_url', [
184
+				'notnull' => true,
185
+                                'length' => 512,
186
+			]);
187
+			$table->changeColumn('tel_sender_name', [
188
+				'notnull' => false,
189
+                                'length' => 48,
190
+				'default' => '',
191
+			]);
192
+			$table->changeColumn('nex_sender_name', [
193
+				'notnull' => false,
194
+                                'length' => 48,
195
+				'default' => '',
196
+			]);
197
+			$table->changeColumn('notification_email', [
198
+				'notnull' => false,
199
+                                'length' => 512,
200
+				'default' => '',
201
+			]);
202
+			$table->addColumn('twilapi_key', 'string', [
203
+				'notnull' => true,
204
+				'length' => 512,
205
+			]);
206
+			$table->addColumn('twilapi_secret', 'string', [
207
+				'notnull' => true,
208
+				'length' => 512,
209
+			]);
210
+			$table->addColumn('twilapi_url_rec', 'string', [
211
+				'notnull' => true,
212
+				'length' => 512,
213
+			]);
214
+			$table->addColumn('twilapi_url', 'string', [
215
+				'notnull' => true,
216
+				'length' => 512,
217
+			]);
218
+			$table->addColumn('twil_sender_name', 'string', [
219
+				'notnull' => false,
220
+				'length' => 48,
221
+				'default' => '',
222
+			]);
223
+
224
+                }
225
+
226
+		if (!$schema->hasTable('sms_relent_received')) {
227
+			$table = $schema->createTable('sms_relent_received');
228
+			$table->addColumn('id', 'bigint', [
229
+				'autoincrement' => true,
230
+				'notnull' => true,
231
+                                'length' => 11,
232
+                                'unsigned' => true,
233
+			]);
234
+			$table->addColumn('user_id', 'string', [
235
+				'notnull' => true,
236
+				'length' => 64,
237
+			]);
238
+			$table->addColumn('message_id', 'string', [
239
+				'notnull' => true,
240
+				'length' => 512,
241
+			]);
242
+			$table->addColumn('date', 'datetime', [
243
+				'notnull' => true,
244
+			]);
245
+			$table->addColumn('from', 'string', [
246
+				'notnull' => true,
247
+				'length' => 128,
248
+			]);
249
+			$table->addColumn('to', 'string', [
250
+				'notnull' => true,
251
+				'length' => 128,
252
+			]);
253
+			$table->addColumn('message', 'text', [
254
+				'notnull' => false,
255
+				'default' => '',
256
+			]);
257
+                        $table->setPrimaryKey(['id']);
258
+                        $table->addUniqueIndex(['id']);
259
+
260
+		} else {
261
+
262
+			$table = $schema->getTable('sms_relent_received');
263
+
264
+			$column = $table->getColumn('message');
265
+			$column->setType(Type::getType('text'));
266
+			$column->setNotnull(false);
267
+			$column->setDefault('');
268
+
269
+			$table->changeColumn('message_id', [
270
+				'notnull' => true,
271
+				'length' => 512,
272
+                        ]);
273
+		}
274
+
275
+		if (!$schema->hasTable('sms_relent_sent')) {
276
+			$table = $schema->createTable('sms_relent_sent');
277
+			$table->addColumn('id', 'bigint', [
278
+				'autoincrement' => true,
279
+				'notnull' => true,
280
+                                'length' => 11,
281
+                                'unsigned' => true,
282
+			]);
283
+			$table->addColumn('user_id', 'string', [
284
+				'notnull' => true,
285
+				'length' => 64,
286
+			]);
287
+			$table->addColumn('message_id', 'string', [
288
+				'notnull' => true,
289
+				'length' => 512,
290
+			]);
291
+			$table->addColumn('date', 'datetime', [
292
+				'notnull' => true,
293
+			]);
294
+			$table->addColumn('from', 'string', [
295
+				'notnull' => true,
296
+				'length' => 128,
297
+			]);
298
+			$table->addColumn('to', 'string', [
299
+				'notnull' => true,
300
+				'length' => 128,
301
+			]);
302
+			$table->addColumn('network ', 'string', [
303
+				'notnull' => false,
304
+				'length' => 64,
305
+				'default' => '',
306
+			]);
307
+			$table->addColumn('price', 'string', [
308
+				'notnull' => false,
309
+				'length' => 64,
310
+				'default' => '',
311
+			]);
312
+			$table->addColumn('status', 'string', [
313
+				'notnull' => false,
314
+				'length' => 512,
315
+				'default' => '',
316
+			]);
317
+			$table->addColumn('deliveryreceipt', 'string', [
318
+				'notnull' => false,
319
+				'length' => 64,
320
+				'default' => '',
321
+			]);
322
+			$table->addColumn('message', 'text', [
323
+				'notnull' => false,
324
+                                'default' => '',
325
+			]);
326
+                        $table->setPrimaryKey(['id']);
327
+                        $table->addUniqueIndex(['id']);
328
+
329
+		} else {
330
+
331
+			$table = $schema->getTable('sms_relent_sent');
332
+
333
+			$column = $table->getColumn('message');
334
+			$column->setType(Type::getType('text'));
335
+			$column->setNotnull(false);
336
+			$column->setDefault('');
337
+
338
+			$table->changeColumn('message_id', [
339
+				'notnull' => true,
340
+				'length' => 512,
341
+                        ]);
342
+			$table->changeColumn('status', [
343
+				'notnull' => false,
344
+				'length' => 512,
345
+				'default' => '',
346
+                        ]);
347
+		}
348
+
349
+		return $schema;
350
+	}
351
+}