Mysql Routine Migration plugin

Plugin details

A simple plugin for migrating mySql5 routines conforming to Rails migration convention. The current implementation accesses the proc table in the mysql db.

Repositoryhttp://mysql-routine-migration.googlecode.com/svn/trunk/ Author Luke Wendling LicenseUnknown

Documentation

Install the plugin:
ruby script/plugin install http://mysql-routine-migration.googlecode.com/svn/trunk/

1. Create an entry in config/database.yml named :for_migrating_stored_routines similar to this:
for_migrating_stored_routines:

  database: mysql
  username: USER
  password: PASSWORD
  adapter: mysql
  host: localhost
  port: 3306



2. Grant INSERT permission to USER for the mysql.proc table.

3. Make sure db/migrate/routines and db/migrate/routines/usp_test.sql exist after installing. The latter is for testing and for use as a template.

4. To test the stored routines you create and migrate, run mrm:test:clone_routines to copy routines from dev to test.

5. IMPORTANT: See http://www.lukewendling.com/articles/2007/01/04/mysql-procedures-and-activerecord-migrations/ for integrating sql files for use with the plugin.

6. Use the generator

The MRM generator creates a mysql routine migration template file.

The generator takes a template name as its argument. The template name may be given in CamelCase or under_score. The file extension of .sql is added for you.

The generator creates the file in db/migrate/routines.

Example:

ruby script/generate mrm InsertAuthors



This will create:
Template: db/migrate/routines/insert_authors.sql

Further Documentation

There is currently no advanced documentation for this plugin.

New documentation

Edit plugin | (0 older versions) | Last edited by: scott, about 1 year ago