msia-database

Standardize PostgreSQL database patterns with SQLAlchemy models and Alembic migrations.

Updated Jan 7, 2026
One-click install
npx skills add https://github.com/pepeccz/msi-a --skill msia-database
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: msia-database
Source: https://github.com/pepeccz/msi-a/tree/main/skills/msia-database
Command: npx skills add https://github.com/pepeccz/msi-a --skill msia-database

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

MSI-a database component provides a complete PostgreSQL schema with 32 models, Alembic migrations, and a sophisticated seed system for tariff/element data.

Core Features & Use Cases

  • 32 SQLAlchemy Models: Complete schema for users, tariffs, RAG, cases, admin, monitoring
  • Fully Async: AsyncPG engine with connection pooling
  • Dual Warning System: Inline warnings with element_warning_associations
  • Deterministic UUID Seeding: UUID v5 for idempotent seeds
  • Tier Inheritance: TierElementInclusion and self-referential hierarchies
  • Self-Referential Hierarchy: Element parent-child relationships and variants
  • Conditional Fields: ElementRequiredField with conditional logic
  • Alembic Migrations: 34 migrations with rollback support
  • Seeds Architecture: Deterministic, idempotent seed data for tariffs/elements

Quick Start

Run the Alembic migrations and seeders to initialize the MSI-a database schema.

Frequently Asked Questions about msia-database

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

FAQPage Schema
How do I structure SQLAlchemy models and Alembic migrations for a complex PostgreSQL schema?

Structure SQLAlchemy models and Alembic migrations by standardizing 32 models with AsyncPG pooling, 34 migrations with rollback, and deterministic UUID v5 seeds to ensure idempotent data initialization across projects.

How do deterministic UUID seeds work for idempotent database migrations?

Deterministic UUID seeds use UUID v5 generation to create idempotent seed data, ensuring that running tariff and element seeders repeatedly produces identical database records without duplication or conflicts.

Do I need Alembic and AsyncPG installed to use this database schema component?

Yes, you need Alembic, SQLAlchemy, and AsyncPG installed in your codebase to run the async engine, apply the 34 migrations, and execute the deterministic seed workflows for the MSI-a database.

What is the best way to model self-referential hierarchies and tier inheritance in SQLAlchemy?

Model self-referential hierarchies and tier inheritance by using Element parent-child relationships with variants, TierElementInclusion, and conditional ElementRequiredField logic to manage complex tariff structures.

How do you implement a dual warning system with element warning associations in PostgreSQL?

Implement a dual warning system using inline warnings paired with element_warning_associations across the SQLAlchemy models, enabling consistent alert tracking and validation for tariff elements within the database.

Can I roll back Alembic migrations if a database schema update fails?

Yes, you can roll back Alembic migrations because the 34 migration scripts include rollback support, allowing you to safely revert the PostgreSQL schema changes if an update fails or introduces inconsistencies.