-
Notifications
You must be signed in to change notification settings - Fork 1
/
cli.py
47 lines (39 loc) · 1.19 KB
/
cli.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import click
from migrator import migrate, rollback
@click.group()
def cli():
pass
@click.command()
@click.option("--url", prompt="Qdrant URL", help="The URL of the Qdrant instance.")
@click.option(
"--api-key", prompt="API Key", help="The API key for the Qdrant instance."
)
@click.option(
"--migration-folder",
prompt="Migration Folder",
help="The folder containing migration scripts.",
)
def migrate_cmd(url, api_key, migration_folder):
migrate(url, api_key, migration_folder)
@click.command()
@click.option("--url", prompt="Qdrant URL", help="The URL of the Qdrant instance.")
@click.option(
"--api-key", prompt="API Key", help="The API key for the Qdrant instance."
)
@click.option(
"--migration-folder",
prompt="Migration Folder",
help="The folder containing migration scripts.",
)
@click.option(
"--target-version",
prompt="Target Version",
type=int,
help="The target version to rollback to.",
)
def rollback_cmd(url, api_key, migration_folder, target_version):
rollback(url, api_key, migration_folder, target_version)
cli.add_command(migrate_cmd, name="migrate")
cli.add_command(rollback_cmd, name="rollback")
if __name__ == "__main__":
cli()