migration-patterns

Create Rails database migrations with UUID primary keys and account scoping.

Updated Jun 9, 2026
One-click install
npx skills add https://github.com/arthun01/achados-uesc --skill migration-patterns-arthun01
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: migration-patterns
Source: https://github.com/arthun01/achados-uesc/tree/main/.opencode/skills/migration-patterns
Command: npx skills add https://github.com/arthun01/achados-uesc --skill migration-patterns-arthun01

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides a comprehensive guide to creating efficient database migrations in Rails, focusing on UUIDs, account scoping, and avoiding foreign key constraints.

Core Features & Use Cases

  • UUID-based Migrations: Utilizes UUIDs for primary keys, ensuring non-sequential IDs and global uniqueness.
  • Account Scoping: Adds account_id to multi-tenant tables for data isolation and query performance.
  • No Foreign Key Constraints: Offers patterns for migrations without foreign key constraints, enhancing flexibility.
  • Use Case: Ideal for developers and database architects looking to streamline the migration process in Rails applications, especially for large-scale or complex schemas.

Quick Start

Generate a new migration to create a 'cards' table with UUID primary keys and account scoping using the migration pattern skill.

Frequently Asked Questions about migration-patterns

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

FAQPage Schema
How do I create Rails database migrations using UUIDs as primary keys?▼

To create Rails database migrations with UUIDs, you use specific patterns that set UUIDs as primary keys, ensuring non-sequential IDs and global uniqueness for your application tables.

What is the best way to add account scoping to multi-tenant Rails tables?▼

Account scoping in multi-tenant Rails tables involves adding an account_id column to isolate data and improve query performance without relying on foreign key constraints.

Can I build Rails migrations for multi-tenant applications without foreign key constraints?▼

Yes, you can build Rails migrations without foreign key constraints by applying specific patterns that enhance flexibility, which is particularly useful for complex schemas in multi-tenant applications.

When do I need UUIDs and account scoping in Rails database migrations?▼

You need UUIDs and account scoping in Rails database migrations when building large-scale multi-tenant applications that require global uniqueness, data isolation, and efficient queries across complex schemas.

Does avoiding foreign key constraints in Rails migrations affect multi-tenancy?▼

Avoiding foreign key constraints in Rails migrations enhances schema flexibility while maintaining multi-tenancy through account_id scoping, allowing complex multi-tenant applications to manage data isolation efficiently.