Skip to content

Commit

Permalink
Use RuntimeError instead of assert statement
Browse files Browse the repository at this point in the history
  • Loading branch information
Bobronium authored Nov 1, 2024
1 parent 631a1e2 commit e1ed887
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ def upgrade() -> None:

def downgrade() -> None:
offline_mode = op.get_context().environment_context.is_offline_mode()
assert offline_mode or "TESTING" in os.environ or "test" in op.get_bind().engine.url, (
"This downgrade deletes data and should only run in a test environment."
"If you are sure you want to run it, set the TESTING environment variable."
)
if not (offline_mode or "TESTING" in os.environ or "test" in op.get_bind().engine.url):
raise RuntimeError(
"This downgrade deletes data and should only run in a test environment."
"If you are sure you want to run it, set the TESTING environment variable."
)

op.execute(
delete(Project).where(
Expand Down

0 comments on commit e1ed887

Please sign in to comment.