diff options
author | Micke Nordin <kano@sunet.se> | 2025-03-14 09:53:16 +0100 |
---|---|---|
committer | Micke Nordin <mickenordin@users.noreply.github.com> | 2025-03-25 16:07:12 +0100 |
commit | 9e09cddf9bfe2a75e39a90d5fe02576a4240aade (patch) | |
tree | bb0e5c403e67cde7608ab940d1bd82d96e6fa5df | |
parent | 652b0cc9ab8672928e9d728c35016e4657b62f90 (diff) | |
download | nextcloud-server-9e09cddf9bfe2a75e39a90d5fe02576a4240aade.tar.gz nextcloud-server-9e09cddf9bfe2a75e39a90d5fe02576a4240aade.zip |
feat(OCM-invites): Add database table federated_invites.
Co-authored-by: Navid Shokri <navid.pdp11@gmail.com>
Signed-off-by: Micke Nordin <kano@sunet.se>
-rw-r--r-- | apps/cloud_federation_api/lib/Migration/Version0001Date202502262004.php | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/apps/cloud_federation_api/lib/Migration/Version0001Date202502262004.php b/apps/cloud_federation_api/lib/Migration/Version0001Date202502262004.php new file mode 100644 index 00000000000..c79f0ca75ea --- /dev/null +++ b/apps/cloud_federation_api/lib/Migration/Version0001Date202502262004.php @@ -0,0 +1,82 @@ +<?php + +declare(strict_types=1); + +/** + * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +namespace OCA\CloudFederationAPI\Migration; + +use Closure; +use OCP\DB\ISchemaWrapper; +use OCP\Migration\IOutput; +use OCP\Migration\SimpleMigrationStep; + +class Version0001Date202502262004 extends SimpleMigrationStep +{ + + /** + * @param IOutput $output + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` + * @param array $options + * @return null|ISchemaWrapper + */ + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) + { + /** @var ISchemaWrapper $schema */ + + + $schema = $schemaClosure(); + $table_name = 'federated_invites'; + + if (! $schema->hasTable($table_name)) { + + $table = $schema->createTable($table_name); + $table->addColumn('id', 'bigint', [ + 'autoincrement' => true, + 'notnull' => true, + 'length' => 20, + 'unsigned' => true, + ]); + + $table->addColumn('user_id', 'bigint', [ + 'notnull' => false, + 'length' => 20, + 'unsigned' => true, + + ]); + + + $table->addColumn('token', 'string', [ + 'notnull' => true, + 'length' => 60, + ]); + $table->addColumn('email', 'string', [ + 'notnull' => true, + 'length' => 256, + ]); + $table->addColumn('accepted', 'boolean', [ + 'notnull' => false, + 'default' => false + ]); + $table->addColumn('createdAt', 'datetime', [ + 'notnull' => true, + ]); + + $table->addColumn('expiredAt', 'datetime', [ + 'notnull' => false, + ]); + + $table->addColumn('acceptedAt', 'datetime', [ + 'notnull' => false, + ]); + + + $table->setPrimaryKey(['id']); + } + + return $schema; + } +} |