Skip to content

Commit 06b7dfe

Browse files
authored
Merge pull request #36468 from nextcloud/backport/36407/stable23
[stable23] add a safeguard for Version23000Date20210721100600.php
2 parents 2da9062 + 006ed2f commit 06b7dfe

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

core/Migrations/Version23000Date20210721100600.php

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,24 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
4141
/** @var ISchemaWrapper $schema */
4242
$schema = $schemaClosure();
4343

44-
$table = $schema->createTable('authorized_groups');
45-
$table->addColumn('id', 'integer', [
46-
'autoincrement' => true,
47-
'notnull' => true,
48-
]);
49-
$table->addColumn('group_id', 'string', [
50-
'notnull' => true,
51-
'length' => 200
52-
]);
53-
$table->addColumn('class', 'string', [
54-
'notnull' => true,
55-
'length' => 200,
56-
]);
57-
58-
$table->setPrimaryKey(['id']);
59-
$table->addIndex(['group_id'], 'admindel_groupid_idx');
60-
return $schema;
44+
if (!$schema->hasTable('authorized_groups')) {
45+
$table = $schema->createTable('authorized_groups');
46+
$table->addColumn('id', 'integer', [
47+
'autoincrement' => true,
48+
'notnull' => true,
49+
]);
50+
$table->addColumn('group_id', 'string', [
51+
'notnull' => true,
52+
'length' => 200
53+
]);
54+
$table->addColumn('class', 'string', [
55+
'notnull' => true,
56+
'length' => 200,
57+
]);
58+
59+
$table->setPrimaryKey(['id']);
60+
$table->addIndex(['group_id'], 'admindel_groupid_idx');
61+
return $schema;
62+
}
6163
}
6264
}

0 commit comments

Comments
 (0)