fastmodel cli

FastSQLModel CLI for initializing and managing Alembic migrations

Helper function to process templates during initialization


process_templates

 process_templates (template_dir:pathlib.Path, target_dir:pathlib.Path,
                    script_location:str)

Process and copy template files with proper configuration

Initialize Alembic with custom FastSQLModel templates


init

 init (directory:str=<typer.models.OptionInfo object at 0x7fa5e5620d60>)

*Initialize a new Alembic environment with FastSQLModel templates.

This will create: - alembic.ini in the root directory - migrations/ directory with: - env.py - README - script.py.mako - versions/ directory*

Generate new Alembic migration


migrations

 migrations (message:str=<typer.models.OptionInfo object at
             0x7fa5e5623c10>, autogenerate:bool=<typer.models.OptionInfo
             object at 0x7fa5e5623e20>)

*Generate a new Alembic migration file.

Examples: fsm migrations -m “Add user table” fsm migrations –no-autogenerate -m “Custom migration”*

Apply pending Alembic migrations


migrate

 migrate (revision:str=<typer.models.OptionInfo object at 0x7fa5e5623fa0>)

*Apply all pending database migrations.

Examples: fsm migrate # Upgrade to latest version fsm migrate -r +1 # Upgrade one revision fsm migrate -r -1 # Downgrade one revision fsm migrate -r base # Downgrade all migrations*