I was assuming that I was using a deprecated methodology from an old
tutorial and that "rake db:migrate_plugins" was the correct way to run the
migration of an engine. Since I know now its not, I'm still stumped as to
why this doesn't work. When I use "script/generate plugin_migration", it
generates the file 087_project_rank_to_version_1.rb, which in turn runs the
migration for the "project_rank" plugin. However if I do the following
rake db:migrate VERSION=86
it doesn't drop my table, and my code for my single migration in my plugin
is
def self.down
drop_table :project_ranks
end
I don't understand why its not dropping the table, I don't receive an error,
even in verbose mode, but nothing happens with the table, it just outputs
that its being reverted. If I manually delete the table, then run
rake db:migrate
after rolling back to version 86, I would expect it to create the table.
However, it does not create the table, and it doesn't give me any warnings.
It just displays a message that my plugin has been migrated. I thought my
migration was pretty straight forward, but it just doesn't work. Has anyone
else had this problem? I've included my migration script below in case I've
done something wrong I'm missing.
Thanks,
Todd
class CreateProjectRankTable < ActiveRecord::Migration
def self.up
create_table :project_ranks, :force => true do |t|
t.column "rank", :integer
t.column "project_id", :integer
end
add_index "project_ranks", ["project_id"], :name =>
"project_ranks_project_id"
add_index "project_ranks", ["rank"], :name => "project_ranks_rank"
end
def self.down
drop_table :project_ranks
end
end
On Wed, Mar 5, 2008 at 9:06 PM, James Adam <[EMAIL PROTECTED]> wrote:
> What error (if any) do you see? Is there any reason you're using the
> db:migrate_plugins task rather than script/generate plugin_migration?
>
>
>
> On 5 Mar 2008, at 04:15, "Todd Nine" <[EMAIL PROTECTED]>
> wrote:
>
> > Hi all,
> > I've added quite a bit of default data population to a migration
> > script on an engine I'm working on. When I try to revert to a
> > previous version, it doesn't work as I expected it to. With rails
> > app migrations I can do "rake db:migrate VERSION=0" to drop all the
> > tables. When I run "rake db:migrate_plugins VERSION=0", I can't
> > roll back the migration, so I'm unable to test my updated migration
> > script. I tried deleting the table, but now I'm stuck, I can't re-
> > create my table with migrations. Any advice?
> >
> > Thanks,
> > Todd
> > _______________________________________________
> > Engine-Developers mailing list
> > [email protected]
> >
> http://lists.rails-engines.org/listinfo.cgi/engine-developers-rails-engines.org
> _______________________________________________
> Engine-Developers mailing list
> [email protected]
>
> http://lists.rails-engines.org/listinfo.cgi/engine-developers-rails-engines.org
>
_______________________________________________
Engine-Developers mailing list
[email protected]
http://lists.rails-engines.org/listinfo.cgi/engine-developers-rails-engines.org