data.schema.generate

Page actions AI-ready formats and sharing
Open LLM text
Share with AI
Ask Claude Ask ChatGPT Ask Gemini Ask Copilot

Migration file generator — Operations to numbered .sql files.

Migration file generator — Operations to numbered .sql files.

data.schema.generate

Name Type Default Description
type
qualified_name
element_type
description
source_file
line_number
is_autodoc
autodoc_element
_autodoc_template
_autodoc_url_path
_autodoc_page_type
title
doc_content_hash

Symbols on this page

operation_to_sql
function
def operation_to_sql(op: Operation) -> str

Convert a single operation to SQL.

Parameters

Name Type Default Description
op Operation
_next_migration_number
function
def _next_migration_number(migrations_dir: str) -> int

Find the next migration number by scanning existing files.

Parameters

Name Type Default Description
migrations_dir str
_slugify
function
def _slugify(ops: list[Operation]) -> str

Generate a slug from operations for the migration filename.

Parameters

Name Type Default Description
ops list[Operation]
generate_migration
function
def generate_migration(ops: list[Operation], migrations_dir: str = 'migrations') -> str | None

Generate a numbered .sql migration file from operations.

Returns the path to the generated file, or None if no operations.

Parameters

Name Type Default Description
ops list[Operation]
migrations_dir str 'migrations'

View source · /home/runner/work/chirp/chirp/site/../src/chirp/data/schema/generate.py:1