Download the PHP package grazulex/laravel-strongmigrations without Composer
On this page you can find all versions of the php package grazulex/laravel-strongmigrations. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download grazulex/laravel-strongmigrations
More information about grazulex/laravel-strongmigrations
Files in grazulex/laravel-strongmigrations
Package laravel-strongmigrations
Short Description Detect dangerous migrations before they break production. Catch unsafe operations, get guided alternatives, and keep your database safe.
License MIT
Homepage https://github.com/grazulex/laravel-strongmigrations
Informations about the package laravel-strongmigrations
Laravel Strong Migrations
Detect dangerous migrations before they hit production. Inspired by the Rails strong_migrations gem.
Laravel Strong Migrations analyzes your migration files using AST parsing (nikic/php-parser) and warns you about operations that could cause downtime, data loss, or lock contention on large tables.
Features
- 16+ built-in rules covering common dangerous operations
- Database-aware — version-specific rules for MySQL, MariaDB, and PostgreSQL
- Two modes —
block(prevents migration) orwarn(displays warning) - AST-based analysis — no migration execution required
- CI/CD ready — JSON and GitHub Actions output formats
- Customizable — disable rules, add custom checks, bypass with
safetyAssured - Multilingual — English and French translations included
Installation
Publish the configuration:
How It Works
Strong Migrations listens to Laravel's MigrationStarted event. When you run php artisan migrate, each migration is parsed and checked against the rule engine before it executes.
If a dangerous operation is detected:
- In block mode (default): an exception is thrown with a safe alternative
- In warn mode: a warning is displayed, migration proceeds
Rules
Common Rules (All Databases)
| Rule ID | Detects | Severity |
|---|---|---|
remove_column |
Dropping a column | High |
rename_column |
Renaming a column | High |
rename_table |
Renaming a table | High |
create_table_force |
dropIfExists before create |
High |
backfill_in_migration |
Data + schema changes in same migration | Medium |
add_auto_increment |
Adding auto-increment columns | Medium |
raw_sql |
Raw SQL statements | Warning |
wide_index |
Index with > 3 columns | Low |
MySQL / MariaDB Rules
| Rule ID | Detects | Severity |
|---|---|---|
add_column_with_default |
Adding NOT NULL column with default (< MySQL 8.0.12 / MariaDB 10.3.2) | High |
change_column_type |
Changing column type (table rewrite) | High |
set_not_null_mysql |
Setting NOT NULL constraint | Medium |
PostgreSQL Rules
| Rule ID | Detects | Severity |
|---|---|---|
add_index_non_concurrent |
Adding index without CONCURRENTLY | High |
add_foreign_key |
Adding foreign key (locks both tables) | High |
add_check_constraint |
Adding check constraint | Medium |
add_unique_constraint |
Adding unique constraint | Medium |
json_column |
Using json instead of jsonb |
Low |
set_not_null_pgsql |
Setting NOT NULL (full table scan) | Medium |
Usage
Automatic Protection
Once installed, Strong Migrations automatically checks all migrations during php artisan migrate:
Artisan Commands
Check all migrations
Analyze a specific migration
Bypassing Checks
When you've verified a migration is safe, wrap it in safetyAssured:
Custom Checks
Add custom rules in a service provider:
Custom Messages
Override the default message for the next violation:
Configuration
CI/CD Integration
GitHub Actions
This outputs annotations that appear directly on pull request diffs.
Generic CI
Returns exit code 1 if any violations are found.
Supported Databases
| Database | Version | Notes |
|---|---|---|
| MySQL | 5.7+ | Version-aware rules (8.0.12+ allows instant ADD COLUMN) |
| MariaDB | 10.2+ | Version-aware rules (10.3.2+ allows instant ADD COLUMN) |
| PostgreSQL | 12+ | CONCURRENTLY, foreign key, and constraint rules |
| SQLite | Any | Reduced rule set (safe for development) |
Requirements
- PHP 8.2+
- Laravel 11.x or 12.x
Testing
Code Quality
Contributing
Please see CONTRIBUTING.md for details.
Security
If you discover a security vulnerability, please see SECURITY.md.
License
The MIT License (MIT). Please see LICENSE.md for more information.
All versions of laravel-strongmigrations with dependencies
illuminate/support Version ^12.0|^13.0
illuminate/database Version ^12.0|^13.0
illuminate/console Version ^12.0|^13.0
nikic/php-parser Version ^5.0