Skip to content

Commit aba22e5

Browse files
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> Signed-off-by: Navid Shokri <navid.pdp11@gmail.com>
1 parent 11d36e7 commit aba22e5

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
7+
* SPDX-License-Identifier: AGPL-3.0-or-later
8+
*/
9+
10+
namespace OCA\CloudFederationAPI\Migration;
11+
12+
use Closure;
13+
use OCP\DB\ISchemaWrapper;
14+
use OCP\Migration\IOutput;
15+
use OCP\Migration\SimpleMigrationStep;
16+
17+
class Version0001Date202502262004 extends SimpleMigrationStep
18+
{
19+
20+
/**
21+
* @param IOutput $output
22+
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
23+
* @param array $options
24+
* @return null|ISchemaWrapper
25+
*/
26+
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options)
27+
{
28+
/** @var ISchemaWrapper $schema */
29+
30+
31+
$schema = $schemaClosure();
32+
$table_name = 'federated_invites';
33+
34+
if (! $schema->hasTable($table_name)) {
35+
36+
$table = $schema->createTable($table_name);
37+
$table->addColumn('id', 'bigint', [
38+
'autoincrement' => true,
39+
'notnull' => true,
40+
'length' => 20,
41+
'unsigned' => true,
42+
]);
43+
44+
$table->addColumn('user_id', 'bigint', [
45+
'notnull' => false,
46+
'length' => 20,
47+
'unsigned' => true,
48+
49+
]);
50+
51+
52+
$table->addColumn('token', 'string', [
53+
'notnull' => true,
54+
'length' => 60,
55+
]);
56+
$table->addColumn('email', 'string', [
57+
'notnull' => true,
58+
'length' => 256,
59+
]);
60+
$table->addColumn('accepted', 'boolean', [
61+
'notnull' => false,
62+
'default' => false
63+
]);
64+
$table->addColumn('createdAt', 'datetime', [
65+
'notnull' => true,
66+
]);
67+
68+
$table->addColumn('expiredAt', 'datetime', [
69+
'notnull' => false,
70+
]);
71+
72+
$table->addColumn('acceptedAt', 'datetime', [
73+
'notnull' => false,
74+
]);
75+
76+
77+
$table->setPrimaryKey(['id']);
78+
}
79+
80+
return $schema;
81+
}
82+
}

0 commit comments

Comments
 (0)