Project

General

Profile

"rake db:migrate_plugins" cannot be runned twice

Added by Jean-Baptiste Barth over 14 years ago

Hello,

I try to write redmine plugins and I am not able to run this script twice, it freezes and never run again.. Here is the requested infos and a complete (I hope) description. Has anybody encountered the same problem ? Is this normal, or is it a bug ? From Redmine, Engines, Rails, me ? Please let me know if I should submit a new ticket.

- Operating system : Debian etch
- Ruby-aware server used: Mongrel (but not useful for this issue imho)
- Redmine r1977
$ ruby script/about
About your application's environment
Ruby version              1.8.7 (i486-linux)
RubyGems version          1.2.0
Rails version             2.1.0
Active Record version     2.1.0
Action Pack version       2.1.0
Active Resource version   2.1.0
Action Mailer version     2.1.0
Active Support version    2.1.0
Application root          /home/salvor/rails/redmine
Environment               development
Database adapter          sqlite3
Database schema version   97

When running "rake db:migrate_plugins", everything is OK, my just created migration file is taken.
But if I run "rake db:migrate_plugins" just after that, it freezes on my plugin, nothing happens (even with "--trace"). Then I have to ^C to escape.

Example (tested on a new install from trunk, configured for sqlite3 or mysql5.0):

ruby script/generate redmine_plugin yellowpage
ruby script/generate redmine_plugin_model yellowpage person name:string age:integer
rake db:migrate_plugins
=> ok
rake db:migrate_plugins
=> freezes after "Migrating redmine_yellowpage..." 

Same problem on Debian etch, ruby 1.8.7, but Mysql 5.0 instead of Sqlite3.
Same problem on Win XP, ruby 1.8.6, sqlite3.
Same problem if I add a model (+migration) between the twho db:migrate_plugins.

Maybe it's a Engine's bug ? It's not very clear for me what comes from Rails, Engines, or Redmine in these scripts and commands.

Thanks for your help !


Replies (4)

RE: "rake db:migrate_plugins" cannot be runned twice - Added by Jean-Baptiste Barth over 14 years ago

Oops, pasted the bad "script/about", my database schema version is the good one for r1977 after a db:migrate, i.e. "99"...
Sorry.

RE: "rake db:migrate_plugins" cannot be runned twice - Added by Eric Davis over 14 years ago

I think I ran into this a few weeks ago when I started to use the plugin generator. By any chance, are your migrations the UTC timestamp style (e.g. 20081103050902_...)? Try renaming the file to the old style of 001_..., 002_... and rerun your migrations. You might have to undo the changes to your database schema first.

Eric

RE: "rake db:migrate_plugins" cannot be runned twice - Added by Jean-Baptiste Barth over 14 years ago

Thanks, it worked !

Maybe it's an Engine's bug with timestamped migrations : through a "ruby script/console", I ran "Rails.plugins[<my_plugin_id>].migrate", and the trace after a ^C led me to "/my/path/to/redmine/vendor/plugins/engines/lib/engines/plugin/migrator.rb:61:in `migrated'".

This method searchs the current version of a plugin, puts the number into a "current" variable, and returns "current ? (1..current).to_a : []". I suppose such a big array cannot be handled easily (in a reasonnable time), but that's just a supposition..

RE: "rake db:migrate_plugins" cannot be runned twice - Added by Dan Frost about 12 years ago

I'm getting this as well on rails2.

It only happens if my plugin has a migration in it, even if the methods in the migration are empty. I've tried the timestamp migrations and the 001..002... numbering and it still hangs.

./script/about gives:

 $ ./script/about 
About your application's environment
Ruby version              1.8.7 (i686-darwin10.6.0)
RubyGems version          1.4.2
Rails version             2.1.2
Active Record version     2.1.2
Action Pack version       2.1.2
Active Resource version   2.1.2
Action Mailer version     2.1.2
Active Support version    2.1.2
Application root          /Users/dan/Work/Redmine/source
Environment               development
Database adapter          mysql
Database schema version   101

About your Redmine plugins
Git Sha1 workflow for issues   0.0.1

Any ideas?

    (1-4/4)