Skip to content

Commit 5772ffd

Browse files
Merge pull request #152 from nextcloud/techdebt/noid/move-to-migrations
Move to migrations
2 parents 24c9ad5 + 5185d9e commit 5772ffd

3 files changed

Lines changed: 66 additions & 59 deletions

File tree

appinfo/database.xml

Lines changed: 0 additions & 58 deletions
This file was deleted.

appinfo/info.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
1717
Read the [documentation](https://github.com/nextcloud/user_external#readme) to learn how to configure it!
1818
]]></description>
19-
<version>0.10.0</version>
19+
<version>0.10.1</version>
2020
<licence>agpl</licence>
2121
<author>Robin Appelman</author>
2222
<types>
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
/**
5+
* @copyright Copyright (c) 2020 Joas Schilling <coding@schilljs.com>
6+
*
7+
* @author Joas Schilling <coding@schilljs.com>
8+
*
9+
* @license GNU AGPL version 3 or any later version
10+
*
11+
* This program is free software: you can redistribute it and/or modify
12+
* it under the terms of the GNU Affero General Public License as
13+
* published by the Free Software Foundation, either version 3 of the
14+
* License, or (at your option) any later version.
15+
*
16+
* This program is distributed in the hope that it will be useful,
17+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
* GNU Affero General Public License for more details.
20+
*
21+
* You should have received a copy of the GNU Affero General Public License
22+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
23+
*
24+
*/
25+
26+
namespace OCA\User_external\Migration;
27+
28+
use Closure;
29+
use Doctrine\DBAL\Types\Type;
30+
use OCP\DB\ISchemaWrapper;
31+
use OCP\Migration\IOutput;
32+
use OCP\Migration\SimpleMigrationStep;
33+
34+
class Version0010Date20200630193751 extends SimpleMigrationStep {
35+
/**
36+
* @param IOutput $output
37+
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
38+
* @param array $options
39+
* @return null|ISchemaWrapper
40+
*/
41+
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
42+
/** @var ISchemaWrapper $schema */
43+
$schema = $schemaClosure();
44+
45+
if (!$schema->hasTable('users_external')) {
46+
$table = $schema->createTable('users_external');
47+
$table->addColumn('backend', Type::STRING, [
48+
'notnull' => true,
49+
'length' => 128,
50+
'default' => '',
51+
]);
52+
$table->addColumn('uid', Type::STRING, [
53+
'notnull' => true,
54+
'length' => 64,
55+
'default' => '',
56+
]);
57+
$table->addColumn('displayname', Type::STRING, [
58+
'notnull' => false,
59+
'length' => 64,
60+
]);
61+
$table->setPrimaryKey(['uid', 'backend']);
62+
}
63+
return $schema;
64+
}
65+
}

0 commit comments

Comments
 (0)