draw/entity-migrator
Laravel package for migrating and transforming entities between data sources. Helps map fields, move records safely, and run repeatable migration workflows with configurable steps for imports, upgrades, and refactors.
spatie/laravel-messenger can act as a compatibility layer, but message serialization (e.g., Doctrine entities vs. Eloquent models) may require custom handlers.MessageBus expects PSR-15 messages; Laravel’s queues use serializable payloads. A message adapter (e.g., SymfonyMessageToLaravelQueue) is needed.Schema builder and DBAL can coexist if migrations are partitioned (e.g., use Schema for DDL, DBAL for DML via the package).Schema migrations lock the database during execution, while this package supports concurrent, locked operations—conflicts may arise in mixed workflows.spatie/laravel-state-machines) could replace Symfony’s Workflow, but transition hooks (e.g., "migration approved") would need custom event listeners.Schema or all EntityMigrator) per project phase.Schema.down() methods are schema-focused.Migration::down() or database backups for critical data.Migration Strategy:
EntityMigrator for legacy data cleanup but Schema for new feature migrations.Symfony Ecosystem Adoption:
spatie/laravel-messenger + custom workflow logic)?Data Consistency:
Schema) vs. data transformations (EntityMigrator) in the same migration?Schema::table() and EntityMigrator in parallel on the same table.Performance Tradeoffs:
Testing Strategy:
Queue::fake() + Symfony’s WorkflowTester.| Laravel Feature | EntityMigrator Integration | Adapter/Tool Needed |
|---|---|---|
| Artisan Commands | Replace php artisan migrate |
Custom EntityMigrateCommand extending MigrateCommand |
| Database Schema | Use Doctrine DBAL for DDL/DML | doctrine/dbal + custom Schema facade |
| Queues | Async migration steps via Messenger | spatie/laravel-messenger + message adapter |
| Events | Workflow transitions as Laravel events | Event listeners mapping Symfony → Laravel |
| Migrations | Versioned entity migrations | Custom MigratorServiceProvider |
| Testing | Test migrations with draw/tester |
Laravel PHPUnit extensions for workflows |
Phase 1: Schema-Only Migrations (Low Risk)
Schema for all DDL changes (no EntityMigrator).Phase 2: Data Migrations (Medium Risk)
doctrine/dbal to composer.json.use Draw\EntityMigrator\Migration;
use Illuminate\Database\Schema\Blueprint;
class UserDataMigration extends Migration
{
public function up()
{
// Schema changes (Laravel)
Schema::table('users', function (Blueprint $table) {
$table->string('new_column')->nullable();
});
// Data changes (EntityMigrator)
$this->updateField('users', 'old_column', 'new_column');
}
}
spatie/laravel-messenger to bridge Symfony Messenger.Phase 3: Workflow Migrations (High Risk)
Workflow with Laravel events:
// app/Providers/EventServiceProvider.php
protected $listen = [
'workflow.transition' => [
\App\Listeners\LogMigrationStep::class,
],
];
$this->bus->dispatch(new MigrateDataMessage($entity, $data));
Phase 4: Full Replacement (Critical Risk)
Schema to prevent conflicts.down() methods.EntityMigrator::down() or database transactions with manual undo logic.Pre-Migration:
Migration Execution:
Lock component to prevent concurrent migrations on the same table.Post-Migration:
draw/tester to verify data integrity.symfony/messenger or workflow may break Laravel integrations.SchemaHow can I help you explore Laravel packages today?