2021-09-16 02:41:45 +02:00
|
|
|
import click
|
2021-10-20 00:06:57 +02:00
|
|
|
from redis_developer.model.migrations.migrator import Migrator
|
2021-09-16 02:41:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
@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()
|