summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGreg Roach <greg@subaqua.co.uk>2021-02-01 11:02:29 +0000
committerGreg Roach <greg@subaqua.co.uk>2021-02-01 11:02:29 +0000
commit2289e30bb6548d44475686a72cb96d632322119b (patch)
tree74a89cdf8343e513ac955f0b4ffa2bdfd99729b9 /app
parent8155639ada601d420a9fdb23f244fc0be2786250 (diff)
downloadwebtrees-2289e30bb6548d44475686a72cb96d632322119b.tar.gz
webtrees-2289e30bb6548d44475686a72cb96d632322119b.tar.bz2
webtrees-2289e30bb6548d44475686a72cb96d632322119b.zip
Performance - only check for non-transactional tables when updating schema
Diffstat (limited to 'app')
-rw-r--r--app/Services/MigrationService.php14
1 files changed, 8 insertions, 6 deletions
diff --git a/app/Services/MigrationService.php b/app/Services/MigrationService.php
index 5e97f6fded..46e5ecab5e 100644
--- a/app/Services/MigrationService.php
+++ b/app/Services/MigrationService.php
@@ -47,18 +47,20 @@ class MigrationService
public function updateSchema($namespace, $schema_name, $target_version): bool
{
try {
- $this->transactionalTables();
- } catch (PDOException $ex) {
- // There is probably nothing we can do.
- }
-
- try {
$current_version = (int) Site::getPreference($schema_name);
} catch (PDOException $ex) {
// During initial installation, the site_preference table won’t exist.
$current_version = 0;
}
+ if ($current_version < $target_version) {
+ try {
+ $this->transactionalTables();
+ } catch (PDOException $ex) {
+ // There is probably nothing we can do.
+ }
+ }
+
$updates_applied = false;
// Update the schema, one version at a time.