kitloong/laravel-migrations-generator
Generate Laravel migration files from an existing database, including columns, indexes, and foreign keys. Supports MariaDB, MySQL, PostgreSQL, SQL Server, and SQLite. Run artisan migrate:generate to scaffold migrations for all or selected tables.
Schema::create, Blueprint).php artisan migrate:generate), reducing learning curve for teams familiar with Laravel.--template-path) for non-standard migration formats.database/migrations).db:seed or data migration tools.Schema changes).jsonb, SQL Server FILESTREAM)?--with-has-table) to prevent duplicate runs?Schema builder changes (e.g., bigIncrements() vs. id()).--connection flag to target specific databases.SERIAL vs. MySQL AUTO_INCREMENT).--path to direct migrations to module-specific folders (e.g., modules/auth/migrations).logs, sessions).users, posts), then expand.--tables to exclude complex schemas (e.g., audit tables with triggers).php artisan migrate:fresh + db:seed).Schema assertions.migrate.| Feature | Compatibility | Mitigation |
|---|---|---|
| Foreign Keys | Works but requires all referenced tables to exist. | Generate in dependency order or use --squash. |
| Indexes | Supports basic indexes; custom names may conflict. | Use --default-index-names. |
| Views/Stored Procs | Optional; may need manual review. | Skip with --skip-views/--skip-proc. |
| Custom Collations | Limited support (use --use-db-collation). |
Document exceptions. |
| Laravel 11+ | Untested; may need template overrides. | Monitor Laravel deprecations. |
| Windows Paths | CLI path handling may vary. | Use absolute paths in --path. |
php artisan migrate:generate --tables="users,posts" --path="database/migrations/core"
php artisan migrate:generate --connection="secondary" --squash
php artisan migrate in a clean environment.git diff hooks).--with-has-table to add checks.php artisan migrate:fresh).Schema::table usage).--tables includes all dependencies.NOW() vs. current_timestamp()) may need manual fixes.--log-with-batch to split runs.--log-with-batch=0 to trace generation steps.jsonb columns are not validated").--log-with-batch to split migrations into chunks.users and products tables concurrently).memory_limit in php.ini.meld for diffing migration files).| Failure Scenario | Impact | Recovery |
|---|---|---|
| **In |
How can I help you explore Laravel packages today?