Skip to main content

Changelog

All notable changes to Laravel Migration Linter are documented here.
This project follows Semantic Versioning.


๐Ÿš€ [v2.1.1] โ€” 2026-03-03โ€‹

๐Ÿ› Fixedโ€‹

  • migrate:lint no longer tries to write HTML report by default

    • Fixed --html option parsing so plain php artisan migrate:lint does not attempt report generation.
    • Prevents invalid ? path writes on Windows environments (Git Bash / Laragon / XAMPP users).
  • Safer HTML path resolution when --html is provided

    • --html now generates to default path storage/app/migration-lint-report.html when no custom path is supplied.
    • Custom --html=your/path/report.html behavior remains unchanged.

๐Ÿงช Developerโ€‹

  • Added regression tests to prevent future --html option handling breakage.
  • Removed hardcoded package version from composer.json so Packagist versioning is fully tag-driven.

๐Ÿš€ [v2.1.0] โ€” 2025-12-24โ€‹

๐Ÿ†• Addedโ€‹

  • New Rule: RenamingColumnWithoutIndex โ€” Detects column rename operations that can cause table locks and downtime

    • Warns when using $table->renameColumn() on large tables
    • Provides 3-phase zero-downtime migration strategy
    • Configurable to check large tables only or all tables
    • Supports safe comment bypass: // safe rename
  • New Rule: ChangeColumnTypeOnLargeTable โ€” Detects column type changes that can cause table locks

    • Detects 25+ column type methods with ->change() modifier (string, integer, decimal, text, datetime, boolean, enum, etc.)
    • Default severity: error (high impact operation)
    • Provides 3 migration strategies: zero-downtime, maintenance window, pt-online-schema-change
    • Supports safe comment bypass: // safe change, // maintenance window
  • New Flag: --no-suggestions โ€” Hide migration suggestions for cleaner output

    • Useful when you only want to see the warnings table
    • Can be combined with --summary for minimal output
  • New Flag: --html= โ€” Generate interactive HTML reports

    • Beautiful, responsive HTML reports with charts and visualizations
    • Searchable and filterable issue table
    • Grouped suggestions organized by rule type
    • Rule breakdown with statistics
    • Perfect for sharing with team members and CI/CD artifacts
    • Example: php artisan migrate:lint --html=storage/report.html

โš™๏ธ Improvedโ€‹

  • Enhanced MigrationParser โ€” Now properly skips commented-out lines

    • Lines starting with // or /* are ignored during parsing
    • Prevents false positives from commented code
    • Tracks previous line context for safe comment detection
  • Better Safe Comment Detection โ€” Comments on line above operations are now recognized

    • // safe rename on line before operation works correctly
    • /* safe rename */ before operation works correctly
    • Inline comments continue to work: $table->renameColumn(...); // safe rename
  • Improved Suggestion Output Formatting โ€” Cleaner, more organized display

    • Suggestions now grouped by rule type instead of repeated for each occurrence
    • Added visual hierarchy with section headers and separators
    • Shows occurrence count per rule (e.g., "3 occurrences")
    • Better indentation and color coding for readability
    • Professional CLI output with proper spacing

๐Ÿงฐ Developerโ€‹

  • Added 13 comprehensive unit tests for RenamingColumnWithoutIndex rule
  • Added 16 comprehensive unit tests for ChangeColumnTypeOnLargeTable rule
  • Added 12 comprehensive unit tests for HtmlReporter class
  • Total: 84 tests passing (200 assertions)
  • Parser improvements benefit all existing rules
  • Enhanced rawCode context includes previous line for better analysis
  • New HtmlReporter class for generating interactive reports

๐Ÿš€ [1.0.0] โ€” 2025-10-15โ€‹

๐Ÿ†• Addedโ€‹

  • Core Artisan command:
    php artisan migrate:lint

Base rules:

  • AddNonNullableColumnWithoutDefault
    • MissingIndexOnForeignKey
    • Config publishing (php artisan vendor:publish --tag="migration-linter-config")
  • Baseline file support (--generate-baseline, --baseline=path)
  • JSON output mode (--json)
  • Compact report output for smaller terminals.

๐Ÿงฉ [1.1.0] โ€” 2025-10-21โ€‹

๐Ÿ†• Addedโ€‹

  • DropColumnWithoutBackup rule โ€” warns when columns are dropped without confirmation or backup.
  • AddUniqueConstraintOnNonEmptyColumn rule โ€” warns when adding unique constraints that might fail on existing data.
  • FloatColumnForMoney rule โ€” warns when using float() for monetary fields; recommends decimal(10,2) instead.

โš™๏ธ Improvedโ€‹

  • Enhanced output formatting for compact mode (--compact) on smaller terminals.
  • Configuration system now supports custom rules from any namespace (e.g., App\MigrationRules).

๐Ÿงฐ Developerโ€‹

  • Added rule discovery improvements in RuleEngine.
  • Documentation updates (rules.md, writing-custom-rules.md, and configuration.md).

New Rulesโ€‹

Initial public release with baseline rule set:

  • AddNonNullableColumnWithoutDefault
  • MissingIndexOnForeignKey
  • DropColumnWithoutBackup
  • AddUniqueConstraintOnNonEmptyColumn
  • FloatColumnForMoney

[v1.2.0] โ€” 2025-10-30โ€‹

โœจ Addedโ€‹

  • AddNonNullableColumnWithoutDefault
    • Detects .change() on existing columns.
    • Skips Schema::create() (safe for new tables).
  • MissingIndexOnForeignKey
    • Detects foreignId() without ->constrained().
    • Detects morphs() / nullableMorphs() without ->index().
    • Detects composite foreign([...]) without matching index([...]).
  • DropColumnWithoutBackup
    • Detects multiple column drops.
    • Supports safe comment whitelist (// safe drop or /* safe-drop */).
  • AddUniqueConstraintOnNonEmptyColumn
    • Detects composite unique constraints.
    • Detects inline ->unique() and ->unique()->change().
    • Configurable check_composite flag.
  • FloatColumnForMoney
    • Detects float(), double(), and real() for money-like columns.
    • Smarter pattern matching (price, amount, total, tax, etc.).
    • Configurable toggles: check_double and check_real.

๐Ÿงฐ Improvedโ€‹

  • Unified severity handling via config.
  • More informative lint messages for each rule.
  • Enhanced documentation and configuration examples.

๐Ÿ› Fixedโ€‹

  • Config overrides now correctly respect enabled = false.
  • RuleEngine dynamically skips disabled rules during lint runs.


๐Ÿ› ๏ธ [2.0.0] โ€” 2025-11-20โ€‹

โœจ Added (SOLID Principles Refactoring)โ€‹

  • 8 Core Interfaces โ€” Dependency injection contracts
    • ConfigInterface, FormatterInterface, ParserInterface, RuleInterface, RuleEngineInterface
    • SeverityResolverInterface, ReporterInterface, BaselineInterface
  • 3 Service Classes โ€” Reusable business logic
    • LaravelConfigProvider โ€” Bridges Laravel config to contracts
    • SeverityResolver โ€” Priority-based severity determination
    • LintService โ€” Orchestrates entire linting workflow
  • 5 Formatter Classes โ€” Modular output system
    • TableFormatter โ€” Console table format (with Symfony Table component)
    • JsonFormatter โ€” JSON output for CI/CD
    • CompactFormatter โ€” Single-line compact format
    • SummaryFormatter โ€” Table + statistics
    • BaseFormatter โ€” Shared utilities for all formatters

๐Ÿ”ง Improvedโ€‹

  • SOLID Principles throughout:
    • Single Responsibility โ€” Each formatter, service, rule has one job
    • Open/Closed โ€” Add new formatters/services without modifying existing code
    • Liskov Substitution โ€” All formatters interchangeable via interface
    • Interface Segregation โ€” Small, focused contracts
    • Dependency Inversion โ€” Depend on interfaces, not implementations
  • Table Formatting โ€” Fixed color code alignment
    • Switched to Symfony's native Table component
    • Perfect column alignment regardless of content
    • Proper text wrapping and spacing
  • Dependency Injection โ€” Service provider auto-wiring
    • Laravel container bindings for all services
    • Automatic resolver injection into rules
    • Testable with mocked interfaces

โœ… Qualityโ€‹

  • 144 tests passing (259 assertions)
  • 100% backward compatible (zero breaking changes)
  • ~95% code coverage (excellent test quality)

๐Ÿ”„ Migrationโ€‹

All commands work identically โ€” no breaking changes:

php artisan migrate:lint              # Still works
php artisan migrate:lint --json # Still works
php artisan migrate:lint --compact # Still works
php artisan migrate:lint --summary # Still works
php artisan migrate:lint --rules # Still works

๐ŸŽฏ [1.4.0] โ€” 2025-11-15โ€‹

โœจ Added (Phase 3: UX Improvements + New Rule)โ€‹

  • Actionable Suggestions โ€” Every issue now includes suggestion field with fix recommendations
    • Suggestions appear in CLI output after the lint table with [Suggestion #N] headers
    • Suggestions included in JSON output as suggestion field for tool integration
    • Each suggestion provides clear, actionable next steps
  • Documentation Links โ€” Issues now include optional docsUrl field
    • Links appear in CLI with ๐Ÿ“– icon and full URL
    • JSON output includes docs_url field for programmatic access
    • All built-in rules updated with relevant documentation links
  • New Rule: SoftDeletesOnProduction โ€” Warns about soft deletes on large tables
    • Detects softDeletes() on tables in large_table_names config
    • Provides 3 alternatives: archive, hard delete, or add index on deleted_at
    • Includes suggestions and documentation links
  • Enhanced AbstractRule.warn() โ€” Signature extended to accept $suggestion and $docsUrl parameters
    • Fully backward compatible (optional parameters)
    • Enables custom rule authors to provide rich feedback

๐Ÿงฐ Improvedโ€‹

  • Reporter System: Enhanced renderTable() and renderJson() to display/include suggestions
  • Built-in Rules Updated: AddNonNullableColumnWithoutDefault and MissingIndexOnForeignKey now include actionable suggestions
  • Documentation: Updated usage.md, rules.md, writing-custom-rules.md, ci-cd.md with new features and rules
  • Developer Experience: Custom rule authors can now provide suggestions via warn() method

๐Ÿ“Š Example Outputโ€‹

[warning] SoftDeletesOnProduction  
โ†’ Using soft deletes on the 'users' table may impact query performance over time.

[Suggestion #1] SoftDeletesOnProduction:
Option 1: Archive old data to a separate table
Option 2: Use hard deletes if retention isn't required
Option 3: Add an index on 'deleted_at' to improve query performance
๐Ÿ“– Learn more: https://docs.example.com/rules#-softdeletesonproduction

โœจ Overviewโ€‹

  • Changes fully backward compatible with v1.3.x
  • Total rule count: 6 rules (5 original + 1 new)

๐Ÿง  Tip: You can always check your installed version via Composer:

composer show sufyandev/laravel-migration-linter

Or compare changes on GitHub:
๐Ÿ‘‰ muhammad-sufyan5/sufyan-laravel-migration-lint-package