Rails Exporter Plugin

Copyright © 2013 Joerg Kirschstein



You neeed an installed version of MySQL Workbench, get it here [registration required]:


Unzip the plugin file "mysql-wb-rails-exporter_V1_0_1.zip". It contains the following files:

  • readme.txt
  • mysql-wb-rails-exporter.lua [the plugin script in lua]
  • /*.mwb [several Workbench example schema files in sub folders]
  • GNU General Public License_v3.txt
  • Rails_Exporter_Logo.jpg

Start your Workbench app. Note: if you are using linux, start workbench vai console command 'mysql-workbench' to get the output messages in the console.

Chose the lua plugin file from the folder where you extracted it to. Confirm and restart workbench.

Now open or create a schema file. Go to "PLUGINS > CATALOG > Rails Exporter <VERSION>".

WINDOWS: You will see some command line windows popping up - thats when directories are created and a random seed is built from the system time milliseconds. After a few seconds, all files are built.. Wait til the final command line window appears and press a key to confirm.

LINUX/MAC: the console will show some messages, and a final read command informs you, that rails exporter has finished.

By default you will find the created rails files here:

Windows XP: {SystemDrive}:\Documents and Settings\{username}\Application Data\Rails_Exporter\

Windows 7: {SystemDrive}:\Users\{username}\AppData\Roaming\Rails_Exporter\

Linux/Mac: /{HOME}/{USER}/Rails_Exporter/

Now you can use the created files in your rails application. The following files are created by deafault: 

  • models\<MODEL_FILES>
  • db\migrate\<MIGRATION_FILES>
  • db\schema.rb
  • db\seeds.rb
  • Log_Rails_Exporter.txt [logfile]

Copy them to your corresponding rails app directories and type the following rails command on your console/command line from your rails folder to setup the DB:

rake db:setup [--trace]

All existing data will be deleted and the new database will be created, including table data with the seeds.rb file.