From 0f2ce057895c3c808cd504195e81f881436f845f Mon Sep 17 00:00:00 2001 From: mickael e Date: Fri, 24 Aug 2018 15:49:44 -0400 Subject: [PATCH] Apply database migration on backup restore Backups restored to a newer version of SecureDrop may introduce breakage if a migration has occurred. dpkg-reconfigure will call the postinst which will in turn apply all necessary alembic migrations to the database. --- install_files/ansible-base/roles/restore/files/restore.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/install_files/ansible-base/roles/restore/files/restore.py b/install_files/ansible-base/roles/restore/files/restore.py index c98a2dee42..7d51f7c677 100755 --- a/install_files/ansible-base/roles/restore/files/restore.py +++ b/install_files/ansible-base/roles/restore/files/restore.py @@ -45,6 +45,8 @@ def main(): # If the process exits with a non-zero return code, raises an exception. subprocess.check_call(['service', 'apache2', 'restart']) subprocess.check_call(['service', 'tor', 'reload']) + # Apply database migrations (if backed-up version < version to restore) + subprocess.check_call(['dpkg-reconfigure', 'securedrop-app-code']) if __name__ == "__main__":