Example #1
0
def db(app):
    _db.app = app
    _db.create_all()

    yield _db

    _db.drop_all()
Example #2
0
def clean():
    # Carefull this will delete the content of the databases
    db.drop_all()
    db.create_all()
    db.session.commit()
Example #3
0
def create_db():
    db.create_all()
    db.session.commit()
Example #4
0
def register_models(app: Flask) -> None:
    with app.app_context():
        db.create_all()
Example #5
0
 def setUp(self):
     db.create_all()
     db.session.commit()
Example #6
0
from app import create_app

from core.extensions import db

import core.models as core_models

app = create_app()
with app.app_context():
    db.session.commit()
    db.drop_all()
    db.create_all()
    db.session.commit()

    count = core_models.Counter(name='My first counter', count=10)
    db.session.add(count)
    db.session.commit()