summaryrefslogtreecommitdiffstats
path: root/core/Migrations
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2020-11-12 15:03:21 +0100
committerRobin Appelman <robin@icewind.nl>2020-11-12 15:03:21 +0100
commit6b8078a00914a31ac6d08546f6d106e9bfa300dc (patch)
tree7c1c67ac57c36dee2e95a071f4ab533c41c79abd /core/Migrations
parent2f678e0aadb4bd637c53a6051a20d11ae3c96a9e (diff)
downloadnextcloud-server-6b8078a00914a31ac6d08546f6d106e9bfa300dc.tar.gz
nextcloud-server-6b8078a00914a31ac6d08546f6d106e9bfa300dc.zip
fix migration of oc_credentials table
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'core/Migrations')
-rw-r--r--core/Migrations/Version20000Date20201109081918.php48
1 files changed, 25 insertions, 23 deletions
diff --git a/core/Migrations/Version20000Date20201109081918.php b/core/Migrations/Version20000Date20201109081918.php
index cea71148bc1..49bbd79b67d 100644
--- a/core/Migrations/Version20000Date20201109081918.php
+++ b/core/Migrations/Version20000Date20201109081918.php
@@ -52,26 +52,28 @@ class Version20000Date20201109081918 extends SimpleMigrationStep {
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();
- $table = $schema->createTable('storages_credentials');
- $table->addColumn('id', Type::BIGINT, [
- 'autoincrement' => true,
- 'notnull' => true,
- 'length' => 64,
- ]);
- $table->addColumn('user', Type::STRING, [
- 'notnull' => false,
- 'length' => 64,
- ]);
- $table->addColumn('identifier', Type::STRING, [
- 'notnull' => true,
- 'length' => 64,
- ]);
- $table->addColumn('credentials', Type::TEXT, [
- 'notnull' => false,
- ]);
- $table->setPrimaryKey(['id']);
- $table->addUniqueIndex(['user', 'identifier'], 'stocred_ui');
- $table->addIndex(['user'], 'stocred_user');
+ if (!$schema->hasTable('storages_credentials')) {
+ $table = $schema->createTable('storages_credentials');
+ $table->addColumn('id', Type::BIGINT, [
+ 'autoincrement' => true,
+ 'notnull' => true,
+ 'length' => 64,
+ ]);
+ $table->addColumn('user', Type::STRING, [
+ 'notnull' => false,
+ 'length' => 64,
+ ]);
+ $table->addColumn('identifier', Type::STRING, [
+ 'notnull' => true,
+ 'length' => 64,
+ ]);
+ $table->addColumn('credentials', Type::TEXT, [
+ 'notnull' => false,
+ ]);
+ $table->setPrimaryKey(['id']);
+ $table->addUniqueIndex(['user', 'identifier'], 'stocred_ui');
+ $table->addIndex(['user'], 'stocred_user');
+ }
return $schema;
}
@@ -92,9 +94,9 @@ class Version20000Date20201109081918 extends SimpleMigrationStep {
$insert = $this->connection->getQueryBuilder();
$insert->insert('storages_credentials')
- ->setValue('user', $insert->createNamedParameter('user'))
- ->setValue('identifier', $insert->createNamedParameter('identifier'))
- ->setValue('credentials', $insert->createNamedParameter('credentials'));
+ ->setValue('user', $insert->createParameter('user'))
+ ->setValue('identifier', $insert->createParameter('identifier'))
+ ->setValue('credentials', $insert->createParameter('credentials'));
$result = $query->execute();
while ($row = $result->fetch()) {