def reset_db(): from app.database import create_tables, drop_tables drop_tables() create_tables()
def drop_db(): from app.database import drop_tables drop_tables()
def droptable(module, name): model = importlib.import_module(f"common.models.{module}") cls = getattr(model, name) database.drop_tables([cls], safe=True) database.create_tables([cls], safe=False)
def tearDown(self): db.session.close() drop_tables()
def dbclear(): dropModels = [] for m in app.config.get('INSTALL_MODELS', []): modules = importlib.import_module(f"common.models.{m}") dropModels += getAllmodel(modules) database.drop_tables(dropModels, safe=False)