db-migration

Automate multi-tenant database migrations with tenant isolation and rollbacks.

Updated Nov 17, 2025
One-click install
npx skills add https://github.com/Valynt/ValueOS --skill db-migration-valynt
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: db-migration
Source: https://github.com/Valynt/ValueOS/tree/main/.windsurf/skills/db-migration
Command: npx skills add https://github.com/Valynt/ValueOS --skill db-migration-valynt

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Migrations for multi-tenant databases are error-prone without standardized templates, tenant-scoped access controls, and safe rollback mechanisms. This Skill provides a structured workflow and templates to enforce consistent migration patterns, RLS policies, and type updates across infra/supabase migrations.

Core Features & Use Cases

  • Standardizes the migration workflow with timestamped file naming and rollback scaffolding.
  • Enforces tenant isolation via RLS policies and explicit organization_id constraints.
  • Guides TypeScript type updates and integration steps for related backend services.
  • Use Case: Deploy schema changes, access policy updates, and data migrations across tenants with auditable rollback.

Quick Start

Create a new migration file using the timestamped format and provide a matching rollback using the templates in references/migration-template.sql and references/rollback-template.sql

Frequently Asked Questions about db-migration

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

FAQPage Schema
How do I automate multi-tenant database migrations with proper rollback?

Automate multi-tenant database migrations by using timestamped migration files, matching rollback scaffolding, and explicit organization_id constraints. This enforces tenant isolation and provides auditable rollback planning across schema changes and access policies.

How do I enforce tenant isolation in PostgreSQL migrations?

Enforce tenant isolation in PostgreSQL migrations by applying Row Level Security (RLS) policies and explicit organization_id constraints. This ensures access controls remain scoped to individual tenants during schema and data updates.

What is the best way to manage Supabase migrations across multiple tenants?

The best way to manage Supabase migrations across tenants is standardizing the workflow with timestamped file naming and rollback templates. This enforces consistent migration patterns, RLS policies, and TypeScript type updates.

Can I update TypeScript types automatically when applying database schema changes?

Yes, you can update TypeScript types when applying database schema changes. The migration workflow guides explicit type updates and integration steps for related backend services, ensuring type safety after schema modifications.

Why do I need a rollback file for my database migration?

You need a rollback file for your database migration because the workflow enforces safe rollback mechanisms by requiring matching rollback scaffolding. This provides auditable recovery options for schema changes, access policy updates, and data migrations.

Does this migration workflow require lint checks and validation steps?

Yes, the migration workflow requires lint checks and validation steps. It enforces workflow rules by validating timestamped migration files, rollback scaffolding, and explicit dependency or type updates before applying changes.