Esempio n. 1
0
def reset_db():
    from app.database import create_tables, drop_tables
    drop_tables()
    create_tables()
Esempio n. 2
0
def drop_db():
    from app.database import drop_tables
    drop_tables()
Esempio n. 3
0
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()
Esempio n. 5
0
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)