From ad1b6d19b9c1965ae47bcd5132d3a4064873746f Mon Sep 17 00:00:00 2001 From: "Waylon S. Walker" Date: Mon, 22 May 2023 08:26:44 -0500 Subject: [PATCH] add checkout --- learn_sql_model/cli/model.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/learn_sql_model/cli/model.py b/learn_sql_model/cli/model.py index 3803a6e..0fcdc6c 100644 --- a/learn_sql_model/cli/model.py +++ b/learn_sql_model/cli/model.py @@ -1,3 +1,5 @@ +import alembic +from alembic.config import Config import typer from learn_sql_model.cli.common import verbose_callback @@ -27,9 +29,6 @@ def create_revision( prompt=True, ), ): - import alembic - # python -m alembic revision --autogenerate -m "New Attribute" - from alembic.config import Config alembic_cfg = Config("alembic.ini") alembic.command.revision( @@ -37,6 +36,21 @@ def create_revision( message=message, autogenerate=True, ) + alembic.command.upgrade(config=alembic_cfg, revision="head") + + +@model_app.command() +def checkout( + verbose: bool = typer.Option( + False, + callback=verbose_callback, + help="show the log messages", + ), + revision: str = typer.Option("head"), +): + + alembic_cfg = Config("alembic.ini") + alembic.command.upgrade(config=alembic_cfg, revision="head") @model_app.command()