mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Namely create_db.py,db_shell.py, and manage_db.py. Move duplicated code into lib/galaxy/model/orm/scripts.py - add unit tests. PEP-8 clean up of all 4 files. Add incoherent incoherent comment at top of manage_db.py. As a result of the code de-duplication create_db.py should be usable with the tool shed now. Will be refactoring lib/galaxy/model/orm/scripts.py to work with new tool shed install database - it will be good to have a place to test these and allow manage_db.py and clean_db.py to work immediately.
32 lines
789 B
Python
32 lines
789 B
Python
""" This script parses Galaxy or Tool Shed config file for database connection
|
|
and then delegates to sqlalchemy_migrate shell main function in
|
|
migrate.versioning.shell. """
|
|
import sys
|
|
import os.path
|
|
|
|
new_path = [ os.path.join( os.getcwd(), "lib" ) ]
|
|
new_path.extend( sys.path[1:] ) # remove scripts/ from the path
|
|
sys.path = new_path
|
|
|
|
from galaxy import eggs
|
|
|
|
eggs.require( "decorator" )
|
|
eggs.require( "Tempita" )
|
|
eggs.require( "SQLAlchemy" )
|
|
eggs.require( "sqlalchemy_migrate" )
|
|
|
|
from migrate.versioning.shell import main
|
|
|
|
from galaxy.model.orm.scripts import get_config
|
|
|
|
|
|
def invoke_migrate_main():
|
|
config = get_config( sys.argv )
|
|
db_url = config['db_url']
|
|
repo = config['repo']
|
|
|
|
main( repository=repo, url=db_url )
|
|
|
|
if __name__ == "__main__":
|
|
invoke_migrate_main()
|