analyseether/ether_sql

Cannot use alembic functions if using cli outside the ether_sql folder.

Closed this issue · 0 comments

Describe the bug
Cannot use alembic functions if using CLI outside the ether_sql folder.
This is because the directory address is not set relative to the ether_sql address.

To Reproduce

$ ether_sql sql drop_tables

[2018-06-10 12:19:37,751][INFO][ether_sql.session] Connected to the db ether_sql
[2018-06-10 12:19:37,752][INFO][ether_sql.session] Connected to Infura node
[2018-06-10 12:19:37,752][INFO][ether_sql.globals] Pushing the session DefaultSettings in local thread
Traceback (most recent call last):
  File "/home/ankit/ether_sql/venv/bin/ether_sql", line 11, in <module>
    load_entry_point('ether-sql', 'console_scripts', 'ether_sql')()
  File "/home/ankit/ether_sql/venv/lib/python3.6/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/ankit/ether_sql/venv/lib/python3.6/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/ankit/ether_sql/venv/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/ankit/ether_sql/venv/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/ankit/ether_sql/venv/lib/python3.6/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/ankit/ether_sql/venv/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/ankit/ether_sql/venv/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/ankit/ether_sql/ether_sql/cli/sql.py", line 35, in drop_tables
    revision='base', sql=False, tag=None)
  File "/home/ankit/ether_sql/venv/lib/python3.6/site-packages/alembic/command.py", line 272, in downgrade
    script = ScriptDirectory.from_config(config)
  File "/home/ankit/ether_sql/venv/lib/python3.6/site-packages/alembic/script/base.py", line 134, in from_config
    timezone=config.get_main_option("timezone")
  File "/home/ankit/ether_sql/venv/lib/python3.6/site-packages/alembic/script/base.py", line 60, in __init__
    "scripts folder." % dir)
alembic.util.exc.CommandError: Path doesn't exist: 'ether_sql/migrations'.  Please use the 'init' command to create a new scripts folder.

Expected behavior
The command should execute normally.