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,263 @@
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 Version114Date20221202011625 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('flowapi_key', Types::STRING, [
111
+				'notnull' => true,
112
+				'length' => 512,
113
+			]);
114
+			$table->addColumn('flowapi_secret', Types::STRING, [
115
+				'notnull' => true,
116
+				'length' => 512,
117
+			]);
118
+			$table->addColumn('flowapi_url_rec', Types::STRING, [
119
+				'notnull' => true,
120
+				'length' => 512,
121
+			]);
122
+			$table->addColumn('flowapi_url', Types::STRING, [
123
+				'notnull' => true,
124
+				'length' => 512,
125
+			]);
126
+			$table->addColumn('tel_sender_name', Types::STRING, [
127
+				'notnull' => false,
128
+				'length' => 48,
129
+				'default' => '',
130
+			]);
131
+			$table->addColumn('nex_sender_name', Types::STRING, [
132
+				'notnull' => false,
133
+				'length' => 48,
134
+				'default' => '',
135
+			]);
136
+			$table->addColumn('twil_sender_name', Types::STRING, [
137
+				'notnull' => false,
138
+				'length' => 48,
139
+				'default' => '',
140
+			]);
141
+			$table->addColumn('flow_sender_name', Types::STRING, [
142
+				'notnull' => false,
143
+				'length' => 48,
144
+				'default' => '',
145
+			]);
146
+			$table->addColumn('messagesperpage', Types::INTEGER, [
147
+				'notnull' => false,
148
+				'length' => 11,
149
+                                'unsigned' => true,
150
+			]);
151
+			$table->addColumn('get_notify', Types::SMALLINT, [
152
+				'notnull' => false,
153
+				'length' => 1,
154
+			]);
155
+			$table->addColumn('notification_email', Types::STRING, [
156
+				'notnull' => false,
157
+				'length' => 512,
158
+				'default' => '',
159
+			]);
160
+			$table->addColumn('getsmsinemail', Types::SMALLINT, [
161
+				'notnull' => false,
162
+				'length' => 1,
163
+			]);
164
+                        $table->setPrimaryKey(['id']);
165
+                        $table->addUniqueIndex(['id']);
166
+
167
+		}
168
+
169
+		if (!$schema->hasTable('sms_relent_received')) {
170
+			$table = $schema->createTable('sms_relent_received');
171
+			$table->addColumn('id', Types::BIGINT, [
172
+				'autoincrement' => true,
173
+				'notnull' => true,
174
+                                'length' => 11,
175
+                                'unsigned' => true,
176
+			]);
177
+			$table->addColumn('user_id', Types::STRING, [
178
+				'notnull' => true,
179
+				'length' => 64,
180
+			]);
181
+			$table->addColumn('message_id', Types::STRING, [
182
+				'notnull' => true,
183
+				'length' => 512,
184
+			]);
185
+			$table->addColumn('date', Types::DATETIME, [
186
+				'notnull' => true,
187
+			]);
188
+			$table->addColumn('from', Types::STRING, [
189
+				'notnull' => true,
190
+				'length' => 128,
191
+			]);
192
+			$table->addColumn('to', Types::STRING, [
193
+				'notnull' => true,
194
+				'length' => 128,
195
+			]);
196
+			$table->addColumn('message', Types::TEXT, [
197
+				'notnull' => false,
198
+				'default' => '',
199
+			]);
200
+                        $table->setPrimaryKey(['id']);
201
+                        $table->addUniqueIndex(['id']);
202
+
203
+		}
204
+
205
+		if (!$schema->hasTable('sms_relent_sent')) {
206
+			$table = $schema->createTable('sms_relent_sent');
207
+			$table->addColumn('id', Types::BIGINT, [
208
+				'autoincrement' => true,
209
+				'notnull' => true,
210
+                                'length' => 11,
211
+                                'unsigned' => true,
212
+			]);
213
+			$table->addColumn('user_id', Types::STRING, [
214
+				'notnull' => true,
215
+				'length' => 64,
216
+			]);
217
+			$table->addColumn('message_id', Types::STRING, [
218
+				'notnull' => true,
219
+				'length' => 512,
220
+			]);
221
+			$table->addColumn('date', Types::DATETIME, [
222
+				'notnull' => true,
223
+			]);
224
+			$table->addColumn('from', Types::STRING, [
225
+				'notnull' => true,
226
+				'length' => 128,
227
+			]);
228
+			$table->addColumn('to', Types::STRING, [
229
+				'notnull' => true,
230
+				'length' => 128,
231
+			]);
232
+			$table->addColumn('network ', Types::STRING, [
233
+				'notnull' => false,
234
+				'length' => 64,
235
+				'default' => '',
236
+			]);
237
+			$table->addColumn('price', Types::STRING, [
238
+				'notnull' => false,
239
+				'length' => 64,
240
+				'default' => '',
241
+			]);
242
+			$table->addColumn('status', Types::STRING, [
243
+				'notnull' => false,
244
+				'length' => 512,
245
+				'default' => '',
246
+			]);
247
+			$table->addColumn('deliveryreceipt', Types::STRING, [
248
+				'notnull' => false,
249
+				'length' => 64,
250
+				'default' => '',
251
+			]);
252
+			$table->addColumn('message', Types::TEXT, [
253
+				'notnull' => false,
254
+                                'default' => '',
255
+			]);
256
+                        $table->setPrimaryKey(['id']);
257
+                        $table->addUniqueIndex(['id']);
258
+
259
+		}
260
+
261
+		return $schema;
262
+	}
263
+}