Laravel Schema Designer - prepare your database visually

Laravel has a great mechanism of migrations, but what if you want to visualize your DB schema to see all in one place - to discuss with colleagues, for example. There is a great tool for that - here's a brief overview of Laravel Schema Designer.

Created by Thomas Roelens back in 2013, it still remains an active project - in 2015 it was updated for Laravel 5 version.
In short, LaravelSD is a place where you can create your database schema just by playing with tables/columns/relationships, and then - most important - generate your migration files from the visual schema.

Basically, you register (takes 30 seconds), then go to the main page, enter your database name and start creating a schema.

1231_laraveldaily_laravelsd_01

You start from a clear canvas and can add elements by clicking buttons on the top.

1231_laraveldaily_laravelsd_02

When you click Add Table, you get a popup to fill table name and other parameters.

1231_laraveldaily_laravelsd_03

You fill them in and here's the result - table appears on our canvas, with a lot of buttons to change, basically, anything you want: table, columns, order etc.
As you can see, there are Laravel increments and timestamps already prepared for you.

1231_laraveldaily_laravelsd_04

You can also drag-drop fields to change the order.
Let's add another column title. Again, as you can see - a lot of options, related to Laravel functionality.

1231_laraveldaily_laravelsd_05

And another important feature - foreign keys and relationships between tables. Let's create another table called clients and then link those two together.
First - we create an unsigned integer column with foreign key.

1231_laraveldaily_laravelsd_061

Then - create a relationship: there is a first button on the top.

1231_laraveldaily_laravelsd_06

And here we have also quite a lot of things to choose from. All related to good old Laravel. Really impressive.

1231_laraveldaily_laravelsd_07

And ta-daaa! The result:

1231_laraveldaily_laravelsd_08

So this way you create tables, columns and relationships one-by-one, and here comes the most important/impressive part: as soon as you're ready, you can export the schema. And not only schema - there are a lot of things to export on the menu:

1231_laraveldaily_laravelsd_09

Let's take a schema import as an example - you just get a ZIP archive, which has database/migrations folder with these files in it:

1231_laraveldaily_laravelsd_10

With a real Laravel code:

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateProjectsTable extends Migration {

  public function up() {
    Schema::create('projects', function(Blueprint $table) {
      $table->increments('id');
      $table->timestamps();
      $table->string('title', 255);
      $table->integer('client_id')->unsigned();
    });
  }

  public function down() {
    Schema::drop('projects');
  }
}

So huge respect to the author again for such a tool - there are more functions to explore, so feel free to play with it and use for your projects.
A link once again: LaravelSD.com - Laravel Schema Designer

No comments or questions yet...

Like our articles?

Become a Premium Member for $129/year or $29/month
What else you will get:
  • 67 courses (1172 lessons, total 43 h 18 min)
  • 89 long-form tutorials (one new every week)
  • access to project repositories
  • access to private Discord

Recent New Courses