Reconstructing Database State from Migrations
In Laravel, your migrations are the single source of truth for your database schema. Geni includesGeni\SchemaReader, a migration replay engine that parses PHP migration files into an in-memory DatabaseSchema object.
Supported Blueprint Methods
SchemaReader recognizes all standard Laravel migration Blueprint methods:
Supported Migration Operations
SchemaReader tracks the chronological evolution of your schema:
- Table Creation:
Schema::create('users', function (Blueprint $table) { ... }) - Table Alteration:
Schema::table('users', function (Blueprint $table) { ... }) - Adding Columns: New columns added to existing tables
- Dropping Columns:
$table->dropColumn('legacy_field')removes the column from the in-memory schema - Renaming Columns:
$table->renameColumn('old', 'new') - Dropping Tables:
Schema::drop('posts'),Schema::dropIfExists('tags') - Renaming Tables:
Schema::rename('old_name', 'new_name') - Macros: Expands
id(),timestamps(),morphs(),nullableMorphs(),uuidMorphs(), andforeignIdFor().
Schema Overrides Escape Hatch
If your application uses raw SQL statements inside migrations (e.g.,DB::statement("ALTER TABLE ...")) or unresolvable third-party macros, you can define manual overrides in config/geni.php:
config/geni.php
schema_overrides before falling back to string.