database

Generates database migrations, seed data, factories, and fixtures for schema changes.

Updated Jun 2, 2026
One-click install
npx skills add https://github.com/medispis/opencode-config --skill database-medispis
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database
Source: https://github.com/medispis/opencode-config/tree/main/skills/database
Command: npx skills add https://github.com/medispis/opencode-config --skill database-medispis

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing database migrations and seed data by hand is error-prone: missed rollback scripts, broken foreign key ordering, and destructive changes applied without review can corrupt production data. This Skill standardizes how migrations, seeds, factories, and fixtures are created across different ORMs and migration tools. ## Core Features & Use Cases - Migration Generation: Detects the project's migration tool (Prisma, Knex, Alembic, Flyway, Django, Goose) and generates forward and rollback migrations following its naming conventions. - Safety Gates: Requires explicit user confirmation before destructive operations like dropping columns, changing types, or adding NOT NULL constraints to populated tables. - Seed Data & Factories: Reads the actual schema and generates seed scripts, test factories, or fixtures that respect foreign key ordering, constraints, and enums. - Use Case: You need to add an author_id column to a posts table. The Skill produces a reversible migration, a backfill script for existing rows, and updated seed data ordered users → posts → comments. ## Quick Start Use the database skill to create a migration adding an author_id foreign key to the posts table and generate matching seed data.

Frequently Asked Questions about database

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

FAQPage Schema
How do I generate a database migration with rollback support?

The Skill detects your migration tool (Prisma, Knex, Alembic, Flyway, Django, or Goose), examines the existing schema and migration history, then generates both forward (up) and rollback (down) migration files following the tool's naming convention.

How to create seed data that respects foreign key constraints?

The Skill reads the actual schema to identify tables, relationships, and constraints, then generates seed data ordered so parent records are inserted before children. It supports seed scripts, on-demand factories, and static fixtures.

Does it work with Prisma, Django, and Rails seeding patterns?

Yes. It detects existing patterns such as prisma/seed.ts, db/seeds.rb, Django fixtures, Laravel seeders and factories, and Knex seeds directories, then extends those conventions rather than introducing new ones.

What happens before a destructive migration is applied?

Destructive operations like dropping columns or tables, changing column types, or adding NOT NULL columns to populated tables always require explicit user confirmation. High-risk operations are flagged in the output with a risk level.

How should I backfill data when adding a new column?

Add the column as nullable or with a default first, then run a separate backfill script, and finally generate a follow-up migration to add the constraint. This three-step approach avoids locking or failing on tables with existing data.