redis-om-python/redis_developer/orm/cli/migrate.py
2021-09-15 17:41:45 -07:00

17 lines
432 B
Python

import click
from redis_developer.orm.migrations.migrator import Migrator
@click.command()
@click.option("--module", default="redis_developer")
def migrate(module):
migrator = Migrator(module)
if migrator.migrations:
print("Pending migrations:")
for migration in migrator.migrations:
print(migration)
if input(f"Run migrations? (y/n) ") == "y":
migrator.run()