def evilshit(): """EVIL: Delete all data and recreate the database.""" delete_index() db.drop_all() from sqlalchemy import MetaData, inspect from sqlalchemy.dialects.postgresql import ENUM metadata = MetaData() metadata.bind = db.engine metadata.reflect() for table in metadata.sorted_tables: table.drop(checkfirst=True) for enum in inspect(db.engine).get_enums(): enum = ENUM(name=enum['name']) enum.drop(bind=db.engine, checkfirst=True) init()
def evilshit(): """Delete all data and recreate the database.""" db.drop_all() upgrade_db() delete_index() init_search()
def reset(): db.drop_all() delete_index() upgrade()