Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[24.0] Remove legacy code, reference to sqlalchemy migrate #18202

Merged
merged 1 commit into from
May 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 3 additions & 20 deletions scripts/manage_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@


def run():
"""
If the target database is 'tool_shed', delegate to sqlalchemy migrate.
Otherwise, handle with Alembic.
"""
if sys.argv[-1] == "tool_shed":
_run_sqlalchemy_migrate_on_toolshed()
raise Exception(
"Please use the `manage_toolshed_db.sh` script (or `scripts/toolshed_db.py` if running Ansible)."
)
else:
arg = _get_command_argument()
lmdb = LegacyManageDb()
Expand All @@ -46,20 +44,5 @@ def _get_command_argument():
raise Exception("Invalid command argument; should be: 'version', 'db_version', or 'upgrade'")


def _run_sqlalchemy_migrate_on_toolshed():
# This is the only case when we use SQLAlchemy Migrate.
# This intentionally duplicates the code in `migrate_toolshed_db.py`.
# The dependency on `migrate` should be removed prior to the move to SQLAlchemy 2.0.
from migrate.versioning.shell import main

from galaxy.model.orm.scripts import get_config

config = get_config(sys.argv, use_argparse=False, cwd=os.getcwd())
db_url = config["db_url"]
repo = config["repo"]

main(repository=repo, url=db_url)


if __name__ == "__main__":
run()
Loading