fix migration of oc_credentials table
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
d09a22069f
commit
388b3107eb
|
@ -52,26 +52,28 @@ class Version20000Date20201109081918 extends SimpleMigrationStep {
|
||||||
/** @var ISchemaWrapper $schema */
|
/** @var ISchemaWrapper $schema */
|
||||||
$schema = $schemaClosure();
|
$schema = $schemaClosure();
|
||||||
|
|
||||||
$table = $schema->createTable('storages_credentials');
|
if (!$schema->hasTable('storages_credentials')) {
|
||||||
$table->addColumn('id', Type::BIGINT, [
|
$table = $schema->createTable('storages_credentials');
|
||||||
'autoincrement' => true,
|
$table->addColumn('id', Type::BIGINT, [
|
||||||
'notnull' => true,
|
'autoincrement' => true,
|
||||||
'length' => 64,
|
'notnull' => true,
|
||||||
]);
|
'length' => 64,
|
||||||
$table->addColumn('user', Type::STRING, [
|
]);
|
||||||
'notnull' => false,
|
$table->addColumn('user', Type::STRING, [
|
||||||
'length' => 64,
|
'notnull' => false,
|
||||||
]);
|
'length' => 64,
|
||||||
$table->addColumn('identifier', Type::STRING, [
|
]);
|
||||||
'notnull' => true,
|
$table->addColumn('identifier', Type::STRING, [
|
||||||
'length' => 64,
|
'notnull' => true,
|
||||||
]);
|
'length' => 64,
|
||||||
$table->addColumn('credentials', Type::TEXT, [
|
]);
|
||||||
'notnull' => false,
|
$table->addColumn('credentials', Type::TEXT, [
|
||||||
]);
|
'notnull' => false,
|
||||||
$table->setPrimaryKey(['id']);
|
]);
|
||||||
$table->addUniqueIndex(['user', 'identifier'], 'stocred_ui');
|
$table->setPrimaryKey(['id']);
|
||||||
$table->addIndex(['user'], 'stocred_user');
|
$table->addUniqueIndex(['user', 'identifier'], 'stocred_ui');
|
||||||
|
$table->addIndex(['user'], 'stocred_user');
|
||||||
|
}
|
||||||
|
|
||||||
return $schema;
|
return $schema;
|
||||||
}
|
}
|
||||||
|
@ -92,9 +94,9 @@ class Version20000Date20201109081918 extends SimpleMigrationStep {
|
||||||
|
|
||||||
$insert = $this->connection->getQueryBuilder();
|
$insert = $this->connection->getQueryBuilder();
|
||||||
$insert->insert('storages_credentials')
|
$insert->insert('storages_credentials')
|
||||||
->setValue('user', $insert->createNamedParameter('user'))
|
->setValue('user', $insert->createParameter('user'))
|
||||||
->setValue('identifier', $insert->createNamedParameter('identifier'))
|
->setValue('identifier', $insert->createParameter('identifier'))
|
||||||
->setValue('credentials', $insert->createNamedParameter('credentials'));
|
->setValue('credentials', $insert->createParameter('credentials'));
|
||||||
|
|
||||||
$result = $query->execute();
|
$result = $query->execute();
|
||||||
while ($row = $result->fetch()) {
|
while ($row = $result->fetch()) {
|
||||||
|
|
Loading…
Reference in New Issue