Skip to content

AirModel 0.4.0: Auto-migration for new model fields

Choose a tag to compare

@audreyfeldroy audreyfeldroy released this 20 Mar 08:47
· 6 commits to main since this release
v0.4.0
a3892a3

Add a field to your model, call create_tables(), and the column appears in PostgreSQL. No manual ALTER TABLE, no migration tool for the common case of adding fields to an existing model.

uv add --upgrade AirModel

What's new

  • create_tables() migrates existing tables. After running CREATE TABLE IF NOT EXISTS, AirModel checks information_schema.columns and runs ALTER TABLE ADD COLUMN for any model fields not yet in the database. Non-destructive: never drops columns, never changes types. New columns are added without NOT NULL so existing rows stay intact, while Pydantic still enforces requirements at the app layer.

What's better

  • Documentation for create_tables() updated across the README and usage guide to describe the migration behavior.
  • README leads with project links (GitHub, PyPI, docs) for faster navigation.
  • Latest patterns pulled from Cookiecutter PyPackage.

Contributors

@audreyfeldroy (Audrey M. Roy Greenfeld) designed and built this release: the auto-migration feature, its test coverage, and the documentation updates.