Exemple #1
0
def reapply(args, config):
    backend = get_backend(args, config)
    with backend.lock():
        migrations = get_migrations(args, backend)
        backend.rollback_migrations(migrations, args.force)
        migrations = backend.to_apply(migrations)
        backend.apply_migrations(migrations, args.force)
def show_migrations(args, config):
    backend = get_backend(args, config)
    with backend.lock():
        migrations = get_migrations(args, backend)

        print(tabulate(
            [(m.id, '\033[92m Yes \033[0m' if m.applied else '\033[91m No \033[0m') for m in migrations],
            headers=['Migration', 'Applied'])
        )
Exemple #3
0
def break_lock(args, config):
    backend = get_backend(args, config)
    backend.break_lock()
Exemple #4
0
def unmark(args, config):
    backend = get_backend(args, config)
    with backend.lock():
        migrations = get_migrations(args, backend)
        backend.unmark_migrations(migrations)
Exemple #5
0
def rollback(args, config):
    backend = get_backend(args, config)
    with backend.lock():
        migrations = get_migrations(args, backend)
        backend.rollback_migrations(migrations, args.force)
Exemple #6
0
def apply(args, config):
    backend = get_backend(args, config)
    with backend.lock():
        migrations = get_migrations(args, backend)
        backend.apply_migrations(migrations, args.force)