Skip to content

Commit

Permalink
Merge pull request #18202 from jdavcs/240_ts_db_script
Browse files Browse the repository at this point in the history
[24.0] Remove legacy code, reference to sqlalchemy migrate
  • Loading branch information
jdavcs authored May 22, 2024
2 parents eef864a + 04e77ef commit 89b07fa
Showing 1 changed file with 3 additions and 20 deletions.
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()

0 comments on commit 89b07fa

Please sign in to comment.