Last active
August 29, 2015 14:03
-
-
Save bogdangrigg/1bc69318274d854a8ad2 to your computer and use it in GitHub Desktop.
This SQLite query reverts all the pictures in a Lightroom collection the next-to-last step in their edit history
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
The following SQLite query reverts all the photos in a Lightroom collection the next-to-last step in their edit history | |
It was initially provided by Dorin Nicolaescu-Musteață | |
Execution steps: | |
1. Create a Lightroom collection named "UndoLastOperation" and add the over-edited photos | |
2. Close Lightroom and backup the catalog | |
3. Open the .lrcat file (usually from C:\Users\<User>\Pictures\Lightroom) in SQLite Administrator (http://sqliteadmin.orbmu2k.de/) | |
4. Run this file (Copy-Paste + F9) | |
5. Close SQLite Administrator | |
6. Reopen Lightroom and enjoy (you can also remove the collection "UndoLastOperation" now) | |
*/ | |
UPDATE adobe_imagedevelopsettings | |
SET text = | |
(SELECT hs1.text | |
FROM adobe_libraryimagedevelophistorystep hs1 | |
WHERE hs1.image = adobe_imagedevelopsettings.image | |
AND hs1.id_local = | |
(SELECT MAX (hs2.id_local) | |
FROM adobe_libraryimagedevelophistorystep hs2 | |
WHERE hs2.image = adobe_imagedevelopsettings.image | |
AND hs2.id_global <> | |
adobe_imagedevelopsettings.historysettingsid)), | |
historysettingsid = | |
(SELECT hs1.id_global | |
FROM adobe_libraryimagedevelophistorystep hs1 | |
WHERE hs1.image = adobe_imagedevelopsettings.image | |
AND hs1.id_local = | |
(SELECT MAX (hs2.id_local) | |
FROM adobe_libraryimagedevelophistorystep hs2 | |
WHERE hs2.image = adobe_imagedevelopsettings.image | |
AND hs2.id_global <> | |
adobe_imagedevelopsettings.historysettingsid)), | |
digest = NULL | |
WHERE image IN (SELECT ci.image | |
FROM aglibrarycollectionimage ci, aglibrarycollection c | |
WHERE c.id_local = ci.collection AND NAME LIKE 'UndoLastOperation') | |
AND (SELECT COUNT (*) | |
FROM adobe_libraryimagedevelophistorystep | |
WHERE image = adobe_imagedevelopsettings.image) > 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment