redis-om-python/redis_om/model/cli/migrate.py
2021-10-22 06:36:15 -07:00

18 lines
408 B
Python

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