Fix hasty and irresponsible leftover site_thumbnails in db.

There was a brief period where the thumbnail filepaths were stored
in full, now they are stored relative to the thumb directory.
But those leftover full paths need to be altered.
master
voussoir 2021-10-04 17:23:58 -07:00
parent 49fa9263b6
commit c5b3c65ea1
No known key found for this signature in database
GPG Key ID: 5F7554F8C26DACCB
1 changed files with 4 additions and 1 deletions

View File

@ -667,7 +667,10 @@ def upgrade_19_to_20(photodb):
raise Exception(f'{new.absolute_path} already has items in it.') raise Exception(f'{new.absolute_path} already has items in it.')
else: else:
os.rmdir(new.absolute_path) os.rmdir(new.absolute_path)
os.rename(old.absolute_path, new.absolute_path)
photodb.execute('UPDATE photos SET thumbnail = REPLACE(thumbnail, "/site_thumbnails/", "/thumbnails/")')
photodb.execute('UPDATE photos SET thumbnail = REPLACE(thumbnail, "\\site_thumbnails\\", "\\thumbnails\\")')
photodb.on_commit_queue.append({'action': os.rename, 'args': (old.absolute_path, new.absolute_path)})
def upgrade_all(data_directory): def upgrade_all(data_directory):
''' '''