summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2024-03-05 13:05:05 +0100
committerJoas Schilling <coding@schilljs.com>2024-03-06 13:19:57 +0100
commitf495741e621665f27b9ac456532d92461f8c484f (patch)
tree23081dea5a83acaa46f9e105fc4bd66df6cb342f /lib
parentb57567526893538f15f24c0bcc58b1f293ac9309 (diff)
feat(federation): Add columns to save the creation datetime and meta data
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/Migration/Version19000Date20240305115243.php63
1 files changed, 63 insertions, 0 deletions
diff --git a/lib/Migration/Version19000Date20240305115243.php b/lib/Migration/Version19000Date20240305115243.php
new file mode 100644
index 000000000..58545a26b
--- /dev/null
+++ b/lib/Migration/Version19000Date20240305115243.php
@@ -0,0 +1,63 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * @copyright Copyright (c) 2024 Joas Schilling <coding@schilljs.com>
+ *
+ * @author Joas Schilling <coding@schilljs.com>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCA\Talk\Migration;
+
+use Closure;
+use OCP\DB\ISchemaWrapper;
+use OCP\DB\Types;
+use OCP\Migration\IOutput;
+use OCP\Migration\SimpleMigrationStep;
+
+/**
+ * Add creation datetime and meta-data columns to the proxy cache
+ */
+class Version19000Date20240305115243 extends SimpleMigrationStep {
+ /**
+ * @param IOutput $output
+ * @param Closure(): ISchemaWrapper $schemaClosure
+ * @param array $options
+ * @return null|ISchemaWrapper
+ */
+ public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
+ /** @var ISchemaWrapper $schema */
+ $schema = $schemaClosure();
+
+ $table = $schema->getTable('talk_proxy_messages');
+ if (!$table->hasColumn('creation_datetime')) {
+ $table->addColumn('creation_datetime', Types::DATETIME, [
+ 'notnull' => false,
+ ]);
+ $table->addColumn('meta_data', Types::TEXT, [
+ 'notnull' => false,
+ ]);
+
+ return $schema;
+ }
+
+ return null;
+ }
+}