Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Override SQLAlchemy drop_all() to call drop_alembic_version_table() #98

Open
ntarocco opened this issue Oct 20, 2017 · 0 comments
Open

Comments

@ntarocco
Copy link
Contributor

ntarocco commented Oct 20, 2017

As spotted by @dinosk in this troubleshooting, the call to db.drop_all() will NOT delete the alembic table alembic_version.

This can lead to several unpredictable issues.
The drop_all() method should drop ALL tables, and not left something behind.
A workaround has been provided with the method invenio_db.utils.drop_alembic_version_table().

Proposed solution
Override the SQLAlchemy db.drop_all() method to (pseudo-code):

def def drop_all():
    super()
    drop_alembic_version_table()

WARNING: this modification can potentially break other modules' tests. Moreover, whenever the function drop_alembic_version_table() is used after a drop_all(), it should be cleaned up.

@lnielsen lnielsen added this to the someday milestone Mar 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants