diff --git a/appinfo/info.xml b/appinfo/info.xml index f47526f34..2e73f5125 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -9,7 +9,7 @@ Photos Your memories under your control Your memories under your control - 3.0.0 + 3.0.1 agpl John Molakvoæ Photos diff --git a/lib/Migration/Version30000Date20240417075404.php b/lib/Migration/Version30000Date20240417075404.php new file mode 100644 index 000000000..2ec038d22 --- /dev/null +++ b/lib/Migration/Version30000Date20240417075404.php @@ -0,0 +1,56 @@ +db->getQueryBuilder(); + $select->select('userid') + ->from('preferences') + ->where($select->expr()->eq('appid', $select->expr()->literal('photos'))) + ->andWhere($select->expr()->eq('configkey', $select->expr()->literal('photosSourceFolders'))); + + // Remove old entries for users who already have the new one + $delete = $this->db->getQueryBuilder(); + $delete->delete('preferences') + ->where($delete->expr()->eq('appid', $delete->expr()->literal('photos'))) + ->andWhere($delete->expr()->eq('configkey', $delete->expr()->literal('photosSourceFolder'))) + ->andWhere($delete->expr()->in('userid', $delete->createFunction($select->getSQL()))) + ->executeStatement(); + + // Update remaining old entries to new ones + $update = $this->db->getQueryBuilder(); + $update->update('preferences') + ->set('configvalue', $update->func()->concat($update->createNamedParameter('["'), 'configvalue', $update->createNamedParameter('"]'))) + ->set('configkey', $update->expr()->literal('photosSourceFolders')) + ->where($update->expr()->eq('appid', $update->expr()->literal('photos'))) + ->andWhere($update->expr()->eq('configkey', $update->expr()->literal('photosSourceFolder'))) + ->executeStatement(); + } +} diff --git a/lib/Migration/Version3000Date20240417075404.php b/lib/Migration/Version3000Date20240417075404.php deleted file mode 100644 index cb9abe508..000000000 --- a/lib/Migration/Version3000Date20240417075404.php +++ /dev/null @@ -1,41 +0,0 @@ -db->getQueryBuilder(); - $query->update('preferences') - ->set('configvalue', $query->func()->concat($query->expr()->literal('["'), 'configvalue', $query->expr()->literal('"]'))) - ->set('configkey', $query->expr()->literal('photosSourceFolders')) - ->where($query->expr()->eq('appid', $query->expr()->literal('photos'))) - ->andWhere($query->expr()->eq('configkey', $query->expr()->literal('photosSourceFolder'))) - ->executeStatement(); - } -}