PHP code example of migralign / laravel-migralign

1. Go to this page and download the library: Download migralign/laravel-migralign library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

migralign / laravel-migralign example snippets


return [
    'migrations_path' => database_path('migrations'),
    'ignored_tables' => [
        'migrations',
        'password_reset_tokens',
        'sessions',
        'cache',
        'cache_locks',
        'jobs',
        'job_batches',
        'failed_jobs',
    ],
    'auto_apply_safe' => true,
    'connection' => null,
];

Schema::table('users', function (Blueprint $table) {
    $table->string('phone', 20)->nullable();
});
bash
php artisan vendor:publish --tag=migralign-config
bash
php artisan migralign:sync --dry-run
bash
php artisan migralign:sync
bash
php artisan migralign:sync
bash
# Preview everything
php artisan migralign:sync --dry-run

# Sync only users table
php artisan migralign:sync --table=users

# Preview a subset of migrations
php artisan migralign:sync --dry-run --migration=2024_01_01

# Apply all including risky (no prompts; bypasses pre-check blocking)
php artisan migralign:sync --force
bash
php artisan migralign:sync --dry-run
php artisan migralign:sync
bash
php artisan migralign:sync --dry-run