redis-om-python/aredis_om/model/cli/migrate.py

19 lines
443 B
Python
Raw Normal View History

import click
2021-11-10 00:59:10 +01:00
from aredis_om.model.migrations.migrator import Migrator
@click.command()
2021-11-10 00:59:10 +01:00
@click.option("--module", default="aredis_om")
def migrate(module):
migrator = Migrator(module)
2021-11-25 03:12:27 +01:00
migrator.detect_migrations()
if migrator.migrations:
print("Pending migrations:")
for migration in migrator.migrations:
print(migration)
if input("Run migrations? (y/n) ") == "y":
migrator.run()