Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /aspuru-guzik-group_molar /molar /cli /commands /cmd_alembic.py
| # external | |
| from alembic import command | |
| import click | |
| from rich.prompt import Confirm | |
| from .. import alembic_utils | |
| from ..alembic_utils import get_alembic_config, GLOBAL_VERSION_PATH | |
| from ..cli_utils import CustomClickCommand | |
| def alembic(ctx): | |
| ctx.obj["alembic_config"] = get_alembic_config(ctx) | |
| pass | |
| def branches(ctx, verbose): | |
| command.branches(ctx.obj["alembic_config"], verbose) | |
| def current(ctx, verbose): | |
| command.current(ctx.obj["alembic_config"], verbose) | |
| def downgrade(ctx, revision, sql=False, tag=None): | |
| command.downgrade(ctx.obj["alembic_config"], revision, sql, tag) | |
| def edit(ctx, revision): | |
| command.edit(ctx.obj["alembic_config"], revision) | |
| def heads(ctx, verbose=False, resolve_dependancies=False): | |
| command.heads(ctx.obj["alembic_config"], verbose, resolve_dependancies) | |
| def history(ctx, revision_range, verbose, indicate_current): | |
| command.history( | |
| ctx.obj["alembic_config"], revision_range, verbose, indicate_current | |
| ) | |
| def merge(ctx, revisions, message, branch_label, revision_id): | |
| if not verify_data_dir(ctx): | |
| return | |
| version_path = ctx.obj["data_dir"].resolve() / "migrations" | |
| alembic_utils.merge( | |
| ctx.obj["alembic_config"], | |
| revisions, | |
| message, | |
| branch_label, | |
| version_path, | |
| revision_id, | |
| ) | |
| def revision( | |
| ctx, | |
| message, | |
| head, | |
| splice, | |
| branch_label, | |
| revision_id, | |
| autogenerate=True, | |
| sql=False, | |
| depends_on=None, | |
| ): | |
| if not verify_data_dir(ctx): | |
| return | |
| version_path = ctx.obj["data_dir"].resolve() / "migrations" | |
| command.revision( | |
| ctx.obj["alembic_config"], | |
| message, | |
| autogenerate, | |
| sql, | |
| head, | |
| splice, | |
| branch_label, | |
| version_path, | |
| revision_id, | |
| depends_on, | |
| ) | |
| def verify_data_dir(ctx): | |
| console = ctx.obj["console"] | |
| if "data_dir" not in ctx.obj.keys() or ctx.obj["data_dir"] is None: | |
| console.log( | |
| ( | |
| "[bold red]No data-dir has been specified![/bold red]\n" | |
| "This means the migration will be directly added to the repository.\n" | |
| "This is usually alright if you are developping Molar, " | |
| "otherwise you should consider setting a data-directory.\n" | |
| ) | |
| ) | |
| return Confirm.ask("Are you sure you want to proceed?") | |
| return True | |
| def show(ctx, revision): | |
| command.show(ctx.obj["alembic_config"], revision) | |
| def upgrade(ctx, revision, sql=False, tag=None): | |
| command.upgrade(ctx.obj["alembic_config"], revision, sql, tag) | |
Xet Storage Details
- Size:
- 4.6 kB
- Xet hash:
- 99b0065248d68292b3f6a07a0a53f60589f0a31dc93a63032df6186f90abe14f
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.