laravel-migrations_skill

This skill helps you design and manage Laravel migrations with Schema Builder, foreign keys, indexes, and seeders across tables.
  • TypeScript

2

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill fusengine/agents --skill laravel-migrations

  • SKILL.md5.5 KB

Overview

This skill provides concise, practical guidance for Laravel 12 database migrations using the Schema Builder, column types, indexes, foreign keys, and seeders. It codifies common migration patterns, critical rules, and command examples to design and manage schema changes safely. The goal is predictable, reversible migrations and performant schemas that follow Laravel best practices.

How this skill works

The skill inspects migration needs and maps them to the right migration type (create, add, modify, index, seeder). It recommends concrete Schema Builder patterns—column methods, foreignId()->constrained(), index strategies, and cascade options—and includes rollback and testing advice. It also provides quick command examples and templates to speed implementation and validation.

When to use it

  • Creating a new table or pivot table
  • Adding or modifying columns on an existing table
  • Adding indexes or foreign key constraints for performance and integrity
  • Seeding initial or test data after schema changes
  • Preparing migrations for deployment with rollback testing

Best practices

  • Always implement a reversible down() method and test rollbacks before deploy
  • Use foreignId()->constrained() instead of raw unsignedBigInteger for foreign keys
  • Add indexes on foreign keys and frequently queried column combinations
  • Never modify migrations already deployed to production; create new migrations instead
  • Use --pretend to preview generated SQL and migrate:fresh --seed for safe local refreshes

Example use cases

  • Create posts table with id(), foreignId('user_id')->constrained()->cascadeOnDelete(), timestamps, softDeletes(), and a composite index on user_id and status
  • Add a unique slug column: make:migration add_slug_to_posts_table and in up() add string('slug')->after('title')->unique()
  • Modify an existing column type using a dedicated modify migration and appropriate DB driver support
  • Add an index migration to improve query performance on a frequently filtered column set
  • Create a seeder to populate reference data and run with migrate:fresh --seed for local tests

FAQ

Without a proper down() method rollbacks will fail or be incomplete; always implement and test down() locally with migrate:rollback or migrate:fresh to ensure reversibility.

Can I edit a migration already deployed to production?

No. Editing deployed migrations breaks reproducibility. Create a new migration that applies the required changes and keeps history intact.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational
laravel-migrations skill by fusengine/agents | VeilStrat