Forcing migration order

11 views
Skip to first unread message

Sam Whited

unread,
Jan 5, 2013, 11:02:03 PM1/5/13
to Radiant CMS: Dev
Hi all:

I'm working on an extension for Radiant that adds some functionality
to another extension. Part of this includes running a migration that
adds a few new columns to an existing table. Unfortunately when adding
both gems (my extension and the extension it modifies) to a Radiant
project's Gemfile and running `bundle exec rake db:bootstrap' it runs
my migration first (which fails because there is no table for it to
modify yet).

Is there a standard way to fix this from within the new extension
(changing the load order in every project which includes the two gems
or changing the migration name feels hackish at best)?

—Sam

--
Sam Whited
pub 4096R/EC2C9934
https://samwhited.com/contact

Jim Gay

unread,
Jan 10, 2013, 10:14:16 AM1/10/13
to radiant...@googlegroups.com
Have you tried setting the extension load order in config/environment.rb?

config.extensions = [:first, :second, :all]

Jim Gay

unread,
Jan 10, 2013, 10:16:01 AM1/10/13
to radiant...@googlegroups.com
Argh! I just reread your question and saw that you were asking about doing this from the extension.
I'm not sure if we have a way to do that. Have you made one extension depend on the other in it's gemspec?

Sam Whited

unread,
Jan 10, 2013, 10:24:22 AM1/10/13
to Radiant CMS: Dev
On Thu, Jan 10, 2013 at 10:16 AM, Jim Gay <j...@saturnflyer.com> wrote:
> I'm not sure if we have a way to do that. Have you made one extension depend
> on the other in it's gemspec?
>

Ah, too bad. I've got the dependency set up in the gemspec, but that
doesn't stop the migrations from happening in the wrong order.
Maybe (if, as always, I can find the time) I'll work on improving this.

Thanks,
Reply all
Reply to author
Forward
0 new messages