MySQL Workbench To Laravel Migration

in Laravel

We all have our favourite database GUIs, some work with PHPMyAdmin others use tools such as MySQL Workbench. I tend to use MySQL Workbench more than any database GUI tool.

MySQL Workbench is a cross-platform GPL app that allows you to fully design and document your databases through the app.

MySQL Workbench

Recently I've discovered this plugin for workbench that allows you to export a table into Laravel Migration classes.

MySQL Workbench Export Laravel 5 Migrations Plugin

A MySQL Workbench plugin that allows for exporting a model to Laravel 5 migrations that follow PSR-2 coding standards. When exported, each migration is generated and saved in it's own, properly named, migration file.

Installation

  • MySQL Workbench > Scripting > Install Plugin/Module
  • Select the plugin file
  • Click Open

laravel-migrations2

Usage

  • Open a model in MySQL Workbench
  • Tools > Catalog > Export Laravel 5 Migration

laravel-migration

Now you can copy this migration file into your Laravel project, this allows you to build up your database in MySQL workbench and when you're done export the database into your Laravel migration files.

Subscribe To Newsletter

Get weekly updates to your email