# Path: app/db_model/base.py
# def init_engine(db_uri):
# def init_db():
# def create_default_users():
# def create_default_views():
# def __add_column(name, view, link=""):
# def __add_sort_by(name, view, order=""):
# def __add_group_by(name, view):
# def clear_db():


import imp
from migrate.versioning import api
from  app.db_model.base import db_session, Base
from config import SQLALCHEMY_DATABASE_URI
from config import SQLALCHEMY_MIGRATE_REPO
migration = SQLALCHEMY_MIGRATE_REPO + '/versions/%03d_migration.py' % (api.db_version(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO) + 1)
tmp_module = imp.new_module('old_model')
old_model = api.create_model(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
exec old_model in tmp_module.__dict__

# Path: app/db_model/base.py
# def init_engine(db_uri):
# def init_db():
# def create_default_users():
# def create_default_views():
# def __add_column(name, view, link=""):
# def __add_sort_by(name, view, order=""):
# def __add_group_by(name, view):
# def clear_db():


# Path: db_migrate.py
import imp
from migrate.versioning import api
from  app.db_model.base import db_session, Base
from config import SQLALCHEMY_DATABASE_URI
from config import SQLALCHEMY_MIGRATE_REPO

migration = SQLALCHEMY_MIGRATE_REPO + '/versions/%03d_migration.py' % (api.db_version(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO) + 1)
tmp_module = imp.new_module('old_model')
old_model = api.create_model(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
exec old_model in tmp_module.__dict__

script = api.make_update_script_for_model(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO, tmp_module.meta, Base.metadata)