MySQL Workbench schema to Laravel Migration

Updated Jul 17, 2020・1 minute read Post By Bahaaeddine Chennouf
MySQL Workbench schema to Laravel Migration

MySQL Workbench is visual tool for databases modelling, sql queries and database administration, we will learn today how to create a database, and export it to laravel migration.

First, You need to have MySQL Workbench already installed, if not, feel free to download it from official website:

once installed, create your first database schema by going to File -> new Model

we need to setup two sections: Database global settings, and creation of all required tables:

1- Setting up the database

when Mysql Workbench creates a new database, it comes with a default name "mydb", to change it, we need to double click on the tab that contains the db icon and name, a new window will appear containing database settings:

2- creating tables

to create a new table, click on Add table under tables tab:

that will show a windows containing all table settings:

once you create all your tables, now we need to export them to Laravel migrations, to do that, download MySQL Workbench Export Laravel 5 Migrations Plugin from GitHub

once downloaded, go to:  Scripting -> Install Plugin/Module

browse to downloaded folder, and chose file: and click OK, the module will be installed.

to export created database schema to Laravel migrations, go to: Tools -> Catalog -> Export Laravel 5 Migrations

a review window will appear showing migrations in edit mode:

once you reviewed your migrations, click on Save Migration(s) to Folder to export migrations to .php files.

© 2020 DevDojo LLC. All rights reserved.