prisma-add-column-existing-db

Add new columns to existing Prisma models in production PostgreSQL databases.

2|Updated May 10, 2026
One-click install
npx skills add https://github.com/freedomw1987/tree_monstor --skill prisma-add-column-existing-db
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: prisma-add-column-existing-db
Source: https://github.com/freedomw1987/tree_monstor/tree/main/skills/prisma-add-column-existing-db
Command: npx skills add https://github.com/freedomw1987/tree_monstor --skill prisma-add-column-existing-db

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill solves the critical issue of adding new fields to existing Prisma models when the database is in active production, where running standard Prisma migration commands like prisma migrate dev would either fail due to existing data constraints or cause irreversible data loss from database resets.

Core Features & Use Cases

  • Non-Destructive Production Workflow: Provides a safe, step-by-step process to add new columns without resetting the production database or disrupting live services.
  • Relation Field Validation Handling: Automatically addresses Prisma's requirement for opposite relation definitions when adding relational fields to avoid schema validation errors.
  • Use Case: For example, a backend team running a production PostgreSQL database for a project management tool can use this Skill to safely add a new project relation field to the existing Attachment model without losing any existing attachment data or causing downtime.

Quick Start

Use the prisma-add-column-existing-db skill to safely add a new optional project relation field to the existing Attachment model in your production PostgreSQL database without resetting the database or losing existing attachment data.

Frequently Asked Questions about prisma-add-column-existing-db

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

FAQPage Schema
How do I add a new column to an existing Prisma model in production without losing data?

To add a new column to an existing Prisma model in production safely, you must manually synchronize Prisma schema updates with raw SQL column additions. This prevents the irreversible data loss that standard Prisma migration workflows cause by resetting the database.

Why does adding a relational field in Prisma fail on a production PostgreSQL database?

Adding a relational field in Prisma fails on a production PostgreSQL database due to missing opposite relation definitions. The schema validation process requires these opposite definitions to exist, causing standard migrations to fail when updating existing models.

What is the best way to update a Prisma schema without resetting the production database?

The best way to update a Prisma schema without resetting the production database is to use a non-destructive workflow. This involves manually applying raw SQL to add columns while synchronizing the Prisma schema to maintain consistency without downtime.

Can I use Prisma migrations to add a relation field without causing service downtime?

Yes, you can add a relation field without causing service downtime by bypassing standard Prisma migration commands. Manually adding the raw SQL column and updating the schema ensures the production PostgreSQL database remains operational during the update.

Does adding an optional relation field in Prisma require an opposite relation definition?

Yes, adding an optional relation field in Prisma requires an opposite relation definition. Without explicitly defining the opposite relation in the related model, Prisma's schema validation will fail and block the migration process.

What are the limitations of using standard Prisma migration commands for existing production databases?

Standard Prisma migration commands are limited when applied to existing production databases because they attempt to reset the database to match the schema. This causes irreversible data loss and fails when existing data constraints or missing relation definitions are encountered.