« Row Version Migrations | Main | They say we go through three career changes but really... »

Schema Defining Plugin

Listen to this articleListen to this article

Just a quick update on my plugins. Two of them—Foreign Key Migrations and Row Version Migrations—needed to know if they were being run as part of ActiveRecord::Schema.define() so I extracted the common code into yet another plugin: Schema Defining. This new plugin provides a class method—ActiveRecord::Schema.defining?—that returns true if ActiveRecord::Schema.define() is currently running; false otherwise. Probably not a hugely useful plugin in the main but certainly a must have if, like me, you have a number of migration plugins that need to alter their behaviour accordingly.

Comments

Way to make it DRY :-)

Post a comment