aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fietsboek/alembic/versions/20221214_c939800af428.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/fietsboek/alembic/versions/20221214_c939800af428.py b/fietsboek/alembic/versions/20221214_c939800af428.py
index 79ec899..4b07983 100644
--- a/fietsboek/alembic/versions/20221214_c939800af428.py
+++ b/fietsboek/alembic/versions/20221214_c939800af428.py
@@ -20,14 +20,15 @@ def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
try:
op.drop_column('tracks', 'gpx')
- except sa.exc.OperationalError:
+ except sa.exc.OperationalError as exc:
# sqlite < 3.35.0 does not know "ALTER TABLE DROP COLUMN", in which
# case we probably don't want to break the DB. Instead, we simply
# "drop" the column by setting it empty, which should still help in
# saving some space.
logging.getLogger(__name__).warning(
"Your database does not support dropping a column. "
- "We're setting the content to zero instead."
+ "We're setting the content to zero instead (%s).",
+ exc,
)
op.execute("UPDATE tracks SET gpx = '';")
# ### end Alembic commands ###
@@ -36,6 +37,9 @@ def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
try:
op.add_column('tracks', sa.Column('gpx', sa.BLOB(), nullable=True))
- except sa.exc.OperationalError:
- logging.getLogger(__name__).warning("The column already exists.")
+ except sa.exc.OperationalError as exc:
+ logging.getLogger(__name__).warning(
+ "The column already exists - doing nothing (%s).",
+ exc,
+ )
# ### end Alembic commands ###