Skip to content

Commit

Permalink
fix: system info revision raises an error on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
smotornyuk committed Jun 7, 2024
1 parent 770243e commit 680d70a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ckanext/editable_config/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import datetime
import logging
from typing import Any, Collection, Iterable

import sqlalchemy as sa
from typing_extensions import TypedDict

import ckan.plugins.toolkit as tk
Expand Down Expand Up @@ -84,6 +84,10 @@ def convert_core_overrides(names: Iterable[str]):
log.debug("Do not convert core overrides because plugin is not loaded yet")
return

inspector = sa.inspect(model.meta.engine)
if inspector.has_table("system_info_revision"):
model.Session.execute(sa.delete(sa.table("system_info_revision")))

q = model.Session.query(model.SystemInfo).filter(
model.SystemInfo.key.in_(names),
)
Expand All @@ -97,7 +101,6 @@ def convert_core_overrides(names: Iterable[str]):
"options": options,
},
)

q.delete()
model.Session.commit()

Expand Down

0 comments on commit 680d70a

Please sign in to comment.