From 262b7d43a34af8ca6097b2e1874e6eb8ffefe185 Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Thu, 15 Dec 2022 22:44:24 +0100 Subject: actually downgrade revision on update downgrade --- fietsboek/updater/__init__.py | 2 +- fietsboek/updater/scripts/upd_30ppwg8zi4ujb46f.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/fietsboek/updater/__init__.py b/fietsboek/updater/__init__.py index 348f713..3611e9f 100644 --- a/fietsboek/updater/__init__.py +++ b/fietsboek/updater/__init__.py @@ -356,7 +356,7 @@ class UpdateScript: LOGGER.info("[down] Running pre-alembic task for %s", self.id) self.module.Down().pre_alembic(config) LOGGER.info("[down] Running alembic downgrade for %s to %s", self.id, self.alembic_version) - alembic.command.downgrade(alembic_config, self.alembic_version) + alembic.command.downgrade(alembic_config, "-1") LOGGER.info("[down] Running post-alembic task for %s", self.id) self.module.Down().post_alembic(config) diff --git a/fietsboek/updater/scripts/upd_30ppwg8zi4ujb46f.py b/fietsboek/updater/scripts/upd_30ppwg8zi4ujb46f.py index f620289..983ea45 100644 --- a/fietsboek/updater/scripts/upd_30ppwg8zi4ujb46f.py +++ b/fietsboek/updater/scripts/upd_30ppwg8zi4ujb46f.py @@ -12,6 +12,7 @@ import gzip import brotli from pathlib import Path from sqlalchemy import create_engine +from sqlalchemy.sql import text update_id = '30ppwg8zi4ujb46f' previous = [ @@ -55,7 +56,7 @@ class Down(UpdateScript): brotli_data = (track_path / "track.gpx.br").read_bytes() gzip_data = gzip.compress(brotli.decompress(brotli_data)) connection.execute( - "UPDATE tracks SET gpx = :gpx WHERE id = :id;", + text("UPDATE tracks SET gpx = :gpx WHERE id = :id;"), gpx=gzip_data, id=track_id ) -- cgit v1.2.3