preferences-schema-versioning

Manage declarative schema versioning and generate type-safe data models for PostgreSQL and DuckDB.

14|Updated May 28, 2024
One-click install
npx skills add https://github.com/cameronraysmith/vanixiets --skill preferences-schema-versioning
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: preferences-schema-versioning
Source: https://github.com/cameronraysmith/vanixiets/tree/main/modules/home/ai/skills/src/core/preferences-schema-versioning
Command: npx skills add https://github.com/cameronraysmith/vanixiets --skill preferences-schema-versioning

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the challenge of evolving data schemas over time without disrupting existing applications or data integrity, ensuring smooth transitions during development and deployment.

Core Features & Use Cases

  • Declarative Migrations: Manages database schema changes using declarative SQL files.
  • Cross-Database Compatibility: Supports PostgreSQL and DuckDB through transpilation.
  • Type-Safe Code Generation: Generates language-specific data models and query functions (Python, TypeScript, Go) from schema definitions.
  • Use Case: When adding a new field to a users table, this Skill helps you safely migrate the existing database, generate updated Pydantic models for your Python application, and ensure all new queries are type-checked against the new schema.

Quick Start

Use the preferences-schema-versioning skill to generate type-safe Python models from the database migrations in the migrations/ directory.

Frequently Asked Questions about preferences-schema-versioning

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I manage PostgreSQL and DuckDB schema migrations safely?

To manage schema migrations safely, use declarative SQL files to handle database schema changes. This approach ensures cross-database compatibility between PostgreSQL and DuckDB through SQLMesh transpilation.

How do I generate type-safe Python models from database schema migrations?

You can generate type-safe Python models from database schema migrations by processing your declarative SQL files. This Skill uses Atlas and sqlc to produce language-specific data models and query functions.

What is declarative schema versioning for evolving data schemas?

Declarative schema versioning is the process of evolving data schemas over time using declarative SQL files. It prevents disrupting existing applications or data integrity during development and deployment transitions.

Does SQLMesh work with PostgreSQL and DuckDB for cross-database compatibility?

Yes, SQLMesh works with PostgreSQL and DuckDB by providing transpilation capabilities. This allows your declarative schema migrations to maintain cross-database compatibility across both database systems.

Can I generate TypeScript and Go data models from SQL schema definitions?

Yes, you can generate TypeScript and Go data models from SQL schema definitions. The type-safe code generation feature produces language-specific data models and query functions for Python, TypeScript, and Go.

What is the best way to add a new field to a database table without breaking type safety?

The best way to add a new field without breaking type safety is using declarative schema versioning. It safely migrates the database, generates updated data models, and ensures queries are type-checked against the new schema.