Trigger Happy

I've just released "Trigger Happy", a rails plugin that adds support for triggers in your Active Record Migrations. To install the plugin just do this:

script/plugin install svn://rubyforge.org/var/svn/artriggers/trunk/trigger_happy

To add a trigger do this:

add_trigger "ai_people",
  :on         => 'people',
  :timing     => 'after',
  :event      => 'insert',
  :statement  => 'INSERT INTO log (id, timestamp) VALUES (NEW.id, NOW())'

To drop a trigger do this:

drop_trigger "ai_people"

It only supports mysql for now, but I plan on having other database supported in the future.

Posted by Aaron PattersonPermalinkLeave your Comment »

2 Comments for “Trigger Happy”

  1. kamal says:

    would that be :event => ‘insert’ ?

    Thursday, 1 March 2007 @ 5:52pm

  2. Aaron Patterson says:

    You are correct. I’ll fix that. Thanks!

    Thursday, 1 March 2007 @ 6:04pm

Leave your Respond

Check Spelling
Activate Spell Check while Typing

RSS Feed for this EntryTrackBack URL