Skip to content

Commit

Permalink
Fix mypy error due to alembic 1.11.0
Browse files Browse the repository at this point in the history
Alembic 1.11.0 made the `table_name` argument of `op.drop_index()`
keyword-only, causing the following failure in the
test_galaxy_packages build (where alembic is not pinned):

```
galaxy/model/migrations/util.py:30: error: Too many positional arguments for
"drop_index"  [misc]
            op.drop_index(index_name, table_name)
            ^
```

xref: sqlalchemy/alembic#1243

Also drop the unused `columns` parameter from our wrapper method,
as done already in the dev branch.
nsoranzo committed May 17, 2023

Verified

This commit was signed with the committer’s verified signature. The key has expired.
nsoranzo Nicola Soranzo
1 parent 19605ce commit c736ef5
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -26,4 +26,4 @@ def upgrade():


def downgrade():
drop_index(index_name, table_name, columns)
drop_index(index_name, table_name)
Original file line number Diff line number Diff line change
@@ -27,4 +27,4 @@ def upgrade():


def downgrade():
drop_index(index_name, table_name, columns)
drop_index(index_name, table_name)
4 changes: 2 additions & 2 deletions lib/galaxy/model/migrations/util.py
Original file line number Diff line number Diff line change
@@ -25,9 +25,9 @@ def create_index(index_name, table_name, columns):
op.create_index(index_name, table_name, columns)


def drop_index(index_name, table_name, columns):
def drop_index(index_name, table_name) -> None:
if index_exists(index_name, table_name):
op.drop_index(index_name, table_name)
op.drop_index(index_name, table_name=table_name)


def column_exists(table_name, column_name):

0 comments on commit c736ef5

Please sign in to comment.