g4t/schema-designer

Visual database schema designer for Laravel — renders your schema from migration files as an interactive ERD and generates migrations for every change made in the UI.

Maintainers

Package info

github.com/hussein4alaa/schema-designer

pkg:composer/g4t/schema-designer

Transparency log

Statistics

Installs: 2

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

0.0.1 2026-07-27 09:07 UTC

This package is auto-updated.

Last update: 2026-07-27 10:40:03 UTC


README

g4t Schema Designer — draw your database on a canvas, ship real Laravel migrations

Packagist Laravel 8 to 13 PHP ^8.0 MIT

g4t Schema Designer

A visual database schema designer for Laravel, driven entirely by migration files — no database introspection required.

The package replays every migration's up() method against a capturing schema builder swapped in behind the Schema facade. Blueprints are recorded instead of executed and folded into an in-memory model of your final schema — rendered as an interactive ERD. Every change you make in the UI (create / edit / drop a table) generates a real migration file, shown to you for review before it is written.

How it works: migration files → blueprint capture → interactive ERD → generated migrations

Installation

composer require g4t/schema-designer

The service provider is auto-discovered. Open the designer at:

http://your-app.test/schema-designer

Features

  • ERD canvas — tables as draggable cards, foreign keys as curved colored edges, pan/zoom, auto-layout, fit-to-view, and a live filter. Card positions persist across sessions.
  • Create tables — column editor with all common Blueprint types, length/precision/enum values, nullable/unsigned/default/useCurrent modifiers, composite indexes, and foreign keys with onDelete/onUpdate. Quick-add buttons for id, uuid, timestamps, and soft deletes.
  • Edit tables — the designer diffs your changes against the parsed schema and generates an update migration: renameColumn, ->change(), dropColumn, index and FK adds/drops — ordered correctly (FK/index drops before column drops) with a best-effort down().
  • Drop tables — generates a dropIfExists migration whose down() fully recreates the table from the current parsed definition.
  • Migration awareness — tables whose source migrations haven't run yet get a pending badge, and you can run php artisan migrate right from the UI.
  • Safe parsing — raw DB::statement() / query-builder calls inside migrations run in the connection's pretend mode, so parsing never touches your database. Files that fail to parse are surfaced as warnings, never fatal.

Compatibility

Laravel 8.x, 9.x, 10.x, 11.x, 12.x, 13.x
PHP ^8.0
Databases Driver-agnostic — parsing happens at the Blueprint level, so MySQL, PostgreSQL, SQLite, and SQL Server projects all work the same.

Configuration

php artisan vendor:publish --tag=schema-designer-config
Key Default Purpose
enabled null null → available everywhere except production. Override with SCHEMA_DESIGNER_ENABLED=true/false.
path schema-designer Route prefix.
middleware ['web'] Add auth etc. to protect the UI.
migrations_path database_path('migrations') Where migrations are read from and written to.
layout_file storage/app/schema-designer/layout.json Canvas positions.

How parsing works

  1. Migration files are loaded in order (both anonymous-class and classic named-class styles).
  2. The Schema facade root is swapped for a CapturingSchemaBuilder; each Schema::create/table/drop/rename call produces a Blueprint that is recorded, not executed.
  3. Introspection calls inside migrations (Schema::hasTable(), hasColumn(), …) are answered from the aggregated state, so conditional migrations behave exactly as they would against a fully migrated database.
  4. SchemaAggregator folds columns, ->change()s, renames, drops, indexes, and foreign keys into the final schema model.

Known limits

  • Raw SQL (DB::statement('ALTER TABLE …')) can't be interpreted structurally — the statement is safely ignored and the file is listed under parse warnings when it affects schema.
  • Schema::connection('other')->… calls bypass the capture and are not represented.
  • Generated down() methods for edits are best-effort reconstructions.

Security

The UI writes files into your migrations directory and can run php artisan migrate. It is disabled in production by default — if you enable it there, put real auth middleware in front of it.

License

MIT

schema-designer