Skip to content
This repository was archived by the owner on Sep 1, 2024. It is now read-only.

Commit

Permalink
from ADO
Browse files Browse the repository at this point in the history
  • Loading branch information
dariusz-bzowka-chain-insight committed Jul 27, 2024
1 parent e4c47b8 commit 78caf50
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions neurons/validators/uptime.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ def __init__(self, db_url='sqlite:///miners.db'):
table_names = inspector.get_table_names()
for table_name in table_names:
try:
conn.execute(text(f"DROP TABLE IF EXISTS {table_name} CASCADE"))
conn.commit()
if table_name in Base.metadata.tables:
conn.execute(text(f"DROP TABLE IF EXISTS {table_name} CASCADE"))
conn.commit()
except ProgrammingError as e:
logger.error(f"Failed to drop table {table_name}: {e}")

Expand All @@ -54,11 +55,10 @@ def compare_schemas(self, engine):

existing_tables = set(metadata.tables.keys())
model_tables = set(Base.metadata.tables.keys())

logger.info("compare_schemas start")
# Compare table names
if existing_tables != model_tables:
if not model_tables <= existing_tables:
return False

inspector = inspect(engine)

for table_name in existing_tables.intersection(model_tables):
Expand Down

0 comments on commit 78caf50

Please sign in to comment.