#!/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, 'sqlalchemy_utils.functions.database_exists', 'database_exists', False, 'from sqlalchemy_utils.functions import database_exists, create_database, drop_database\n'), (12, 'sqlalchemy_utils.functions.create_database', 'create_database', False, 'from sqlalchemy_utils.functions import database_exists, create_database, drop_database\n'), (15, 'flunkybot.db.base.metadata.drop_all', 'base.metadata.drop_all', False, 'from flunkybot.db import engine, base\n'), (16, 'flunkybot.db.base.metadata.create_all', 'base.metadata.create_all', False, 'from flunkybot.db import engine, base\n'), (11, 'sqlalchemy_utils.functions.drop_database', 'drop_database', False, 'from sqlalchemy_utils.functions import database_exists, create_database, drop_database\n')]