#!/bin/env python
"""Drop and create a new database with schema."""

from sqlalchemy_utils.functions import database_exists, create_database, drop_database
from flunkybot.db import engine, base
from flunkybot.models import * # noqa


db_url = engine.url
if database_exists(db_url):
    drop_database(db_url)
create_database(db_url)


base.metadata.drop_all()
base.metadata.create_all()

[((10, 3, 10, 26), 'sqlalchemy_utils.functions.database_exists', 'database_exists', ({(10, 19, 10, 25): 'db_url'}, {}), '(db_url)', False, 'from sqlalchemy_utils.functions import database_exists, create_database, drop_database\n'), ((12, 0, 12, 23), 'sqlalchemy_utils.functions.create_database', 'create_database', ({(12, 16, 12, 22): 'db_url'}, {}), '(db_url)', False, 'from sqlalchemy_utils.functions import database_exists, create_database, drop_database\n'), ((15, 0, 15, 24), 'flunkybot.db.base.metadata.drop_all', 'base.metadata.drop_all', ({}, {}), '()', False, 'from flunkybot.db import engine, base\n'), ((16, 0, 16, 26), 'flunkybot.db.base.metadata.create_all', 'base.metadata.create_all', ({}, {}), '()', False, 'from flunkybot.db import engine, base\n'), ((11, 4, 11, 25), 'sqlalchemy_utils.functions.drop_database', 'drop_database', ({(11, 18, 11, 24): 'db_url'}, {}), '(db_url)', False, 'from sqlalchemy_utils.functions import database_exists, create_database, drop_database\n')]