data.schema.diff

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

Schema diff — compare two SchemaSnapshots and produce Operations.

Schema diff — compare two SchemaSnapshots and produce Operations.

data.schema.diff

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

_canonical_type
function
def _canonical_type(type_str: str) -> str

Normalize a column type for comparison across introspect vs parse.

Strips length/precision (VARCHAR(255) -> VARCHAR) and maps known backend aliases to a shared canonical name so an in-sync schema does not register a spurious type change.

Parameters

Name Type Default Description
type_str str
diff_schemas
function
def diff_schemas(current: SchemaSnapshot, desired: SchemaSnapshot) -> list[Operation]

Compare current and desired schemas, returning operations to migrate.

Operations are ordered: drops first, then creates, then alters.

Parameters

Name Type Default Description
current SchemaSnapshot
desired SchemaSnapshot

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