def dropdb(): db.create_all() if os.path.exists(SQLALCHEMY_MIGRATE_REPO): shutil.rmtree(SQLALCHEMY_MIGRATE_REPO) db.drop_all() if os.path.exists(os.path.join(basedir, 'app.db')): remove(os.path.join(basedir, 'app.db'))
def createdb(): sqlite3.connect(os.path.join(basedir, 'app.db')) db.create_all() if not os.path.exists(SQLALCHEMY_MIGRATE_REPO): api.create(SQLALCHEMY_MIGRATE_REPO, 'database repository') api.version_control(DATABASE_URI, SQLALCHEMY_MIGRATE_REPO) else: api.version_control(DATABASE_URI, SQLALCHEMY_MIGRATE_REPO, api.version(SQLALCHEMY_MIGRATE_REPO))
from web_app.app import db # db.drop_all() db.create_all()