mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-21 13:50:20 +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.
40 lines
1.2 KiB
Python
Executable File
40 lines
1.2 KiB
Python
Executable File
"""
|
|
Creates the initial galaxy database schema using the settings defined in
|
|
universe_wsgi.ini.
|
|
|
|
This script is also wrapped by create_db.sh.
|
|
|
|
.. note: pass '-c /location/to/your_config.ini' for non-standard ini file
|
|
locations.
|
|
|
|
.. note: if no database_connection is set in universe_wsgi.ini, the default,
|
|
sqlite database will be constructed.
|
|
Using the database_file setting in universe_wsgi.ini will create the file
|
|
at the settings location (??)
|
|
|
|
.. seealso: universe_wsgi.ini, specifically the settings: database_connection
|
|
and database file
|
|
"""
|
|
|
|
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.model.orm.scripts import get_config
|
|
from galaxy.model.migrate.check import create_or_verify_database as create_db
|
|
from galaxy.webapps.tool_shed.model.migrate.check import create_or_verify_database as create_tool_shed_db
|
|
|
|
|
|
def invoke_create():
|
|
config = get_config(sys.argv)
|
|
if config['database'] == 'galaxy':
|
|
create_db(config['db_url'], config['config_file'])
|
|
elif config['database'] == 'tool_shed':
|
|
create_tool_shed_db(config['db_url'])
|
|
|
|
if __name__ == "__main__":
|
|
invoke_create()
|