Extensions have always provided a handy generator for migrations that took care of the new model case. If you had a
foo_extension and wanted to create a
bar model you could always use:
<p>script/generate extension_model foo bar</p>
This would yield the following:
<p>exists app/models/<br /> exists spec/models/<br /> create app/models/bar.rb<br /> create spec/models/bar_spec.rb<br /> create vendor/extensions/foo/db/migrate<br /> create db/migrate/20081022232711_create_bars.rb</p>
That works most of the time but if you decide to further modify the foo table (or if you need a migration unrelated to a specific model) then you’re pretty much stuck. What would be really handy is a generator that generates additional migrations for an extension using the current timestamp that standard migrations receive.
Thanks to a brand new edge feature, this is now possible.
script/generate extension_migration foo add_foo_property
This now gives you the desired migration:
<p>exists vendor/extensions/foo/db/migrate<br /> create vendor/extensions/foo/db/migrate/20081022232740_add_foo_property.rb</p>