Schema facade or act as a pre-migration validation layer.Artisan commands or ServiceProvider hooks out of the box).// In a custom Artisan command or service provider
$schema = new \RowcastSchema\Schema();
$diff = $schema->diff($liveDb, $targetSchema);
$migrationGenerator = new \RowcastSchema\MigrationGenerator();
$migration = $migrationGenerator->generate($diff);
DatabaseSeeder for schema-aware seeding.Schema facade or Migrations table.php artisan migrate in pipelines (e.g., for schema validation)?rowcast-schema diff before migrate).// app/Console/Commands/ValidateSchema.php
use RowcastSchema\Schema;
use PDO;
public function handle() {
$pdo = new PDO(env('DB_DSN'));
$schema = new Schema();
$diff = $schema->diff($pdo, $this->getTargetSchema());
if (!$diff->isEmpty()) {
throw new \RuntimeException("Schema mismatch detected!");
}
}
Schema facade wrapper to unify RowcastSchema with Laravel’s migrations.// app/Providers/RowcastSchemaServiceProvider.php
public function boot() {
Schema::extend('rowcast', function ($connection) {
return new RowcastSchema\Laravel\LaravelSchemaBuilder($connection);
});
}
down() methods.| Laravel Feature | Compatibility | Workaround |
|---|---|---|
| PDO Connections | ✅ Works with any PDO connection (including Laravel’s DB::connection()). |
Use DB::connection()->getPdo() to pass to RowcastSchema. |
| Transactions | ⚠️ Manual handling required (RowcastSchema doesn’t auto-commit). | Wrap in DB::transaction(). |
| Migration Table | ❌ No native support for Laravel’s migrations table. |
Use a custom table or ignore (for validation-only use). |
| Artisan Commands | ❌ No built-in commands. | Create custom commands (e.g., php artisan schema:diff). |
| Eloquent/Rowcast Models | ✅ Works with Rowcast; ⚠️ May conflict with Eloquent if both are used. | Stick to one ORM or create adapters. |
| Schema Builder Extensions | ❌ No Laravel-specific extensions (e.g., foreignId()). |
Post-process generated SQL or use Laravel’s builder for complex cases. |
create_table) with generated ones.How can I help you explore Laravel packages today?