Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for existence of creation time when running migrations #40991

Merged
merged 3 commits into from Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelog/unreleased/40991
@@ -0,0 +1,5 @@
Bugfix: Check if account creation time exists for migrations

In some rare scenarios it could have happened that the migration responsible for adding the creation time in the oc_accounts table was not correctly inserted into oc_migrations with the consequence that it was reattempted i.e. when upgrading apps, even if the column was already present. This has been now fixed.

https://github.com/owncloud/core/pull/40991
14 changes: 8 additions & 6 deletions core/Migrations/Version20230120101715.php
Expand Up @@ -32,11 +32,13 @@ class Version20230120101715 implements ISchemaMigration {
public function changeSchema(Schema $schema, array $options) {
$prefix = $options['tablePrefix'];
$accountsTable = $schema->getTable("${prefix}accounts");

$accountsTable->addColumn('creation_time', Type::INTEGER, [
'notnull' => true,
'length' => 32,
'default' => 0,
]);

if (!$accountsTable->hasColumn('creation_time')) {
$accountsTable->addColumn('creation_time', Type::INTEGER, [
'notnull' => true,
'length' => 32,
'default' => 0,
]);
}
}
}