in ec2stack/__init__.py [0:0]
def _load_database():
"""
Checks that the user's database exists and returns its uri.
@return: The uri to the user's database.
"""
database_file = os.path.join(
os.path.expanduser('~'),
'.ec2stack/ec2stack.sqlite'
)
if not os.path.exists(database_file):
directory = os.path.join(os.path.dirname(__file__), '../migrations')
config = AlembicConfig(os.path.join(
directory,
'alembic.ini'
))
config.set_main_option('script_location', directory)
command.upgrade(config, 'head', sql=False, tag=None)
return 'sqlite:///' + database_file