Esempio n. 1
0
def init_dev():
    """Initialize database, migrate, upgrade, and perform initial inserts."""
    from flask.ext.migrate import upgrade, init, migrate
    from app.models import GroupRole, Role, User

    init()
    migrate()
    upgrade()

    # create user roles
    GroupRole.insert_roles()
    Role.insert_roles()

    u = User(username='******', email='*****@*****.**', confirmed=True)
    u.password = '******'
    db.session.add(u)
Esempio n. 2
0
def reset_db_danger():
    """Reset db migration and delete all related files."""
    from flask.ext.migrate import init, migrate
    # Remove the migration folder if exist
    if os.path.exists('migrations'):
        shutil.rmtree('migrations')

    # Remove the sqlite database files if exist
    for fl in glob.glob('*.sqlite'):
        os.remove(fl)

    # Reset Migration Database
    init()

    # migrate database to latest revision
    migrate(message='init')
Esempio n. 3
0
def deploy():
    """Run deployment tasks."""
    from flask.ext.migrate import upgrade, migrate, init
    from app.models import User, Role, Permission

    print "Migrating models to database"
    init()
    migrate()
    upgrade()
    migrate()

    print "Models migrated to database"

    print "Migrating meta data to tables"
    migrate_meta()
    print "Meta tables migrated"

    print "Initial migration of our current version of database..."
    # migrate_comadre()
    migrate_all()
Esempio n. 4
0
def deploy_dev():
    ''' deploy in development(using faked data)'''
    from flask.ext.migrate import init, migrate, upgrade
    from sured.models import Role, User, Post, Comment

    #migrade database
    init()
    migrate()
    upgrade()

    # create roles
    Role.insert_roles()

    # fake users
    User.generate_fake()

    # fake questions
    Post.generate_fake()

    # fake answers
    Comment.generate_fake()
Esempio n. 5
0
def db_init_migrations(c, dir=None):
    """
    Update the project to support migrations.
    """
    with app.app_context():
        migrate.init(dir)
Esempio n. 6
0
def init(ctx):
    """Init migrations system"""
    app = factory(ctx.obj['CONFIG'])
    with app.app_context():
        print(app.extensions['migrate'].directory)
        migrate_extension.init()
Esempio n. 7
0
def init(ctx):
    """Init migrations system"""
    app = factory(ctx.obj['CONFIG'])
    with app.app_context():
        migrate_extension.init()
Esempio n. 8
0
def db_init_migrations(c, dir=None):
    with app.app_context():
        migrate.init(dir)