Mar 9, 2008
Generic-user-small Mark Lane 1 post

Topic: Advanced Rails Recipes / Check_pending_migrations code (p.379) issues

Aloha everyone,

I have noticed some odd behavior from the check_pending_migrations code while watching the terminal window. The check_pending_migrations code results in this query being run 41 times when I start my application:

(1) (0.000086)   SELECT version FROM schema_info

I have 39 tables including schema_info and 43 migrations.

This also happens right before the 41 queries above:

(0) (0.000000)   Mysql::Error: Table 'schema_info' already exists: CREATE TABLE `schema_info` (version int(11))
   vendor/plugins/query_stats/lib/active_record/connection_adapters/query_stats.rb:41:in `execute'
   vendor/plugins/query_stats/lib/active_record/connection_adapters/query_stats.rb:40:in `execute'
   config/initializers/check_pending_migrations.rb:5:in `new'
   config/initializers/check_pending_migrations.rb:5
   config/environment.rb:13

Does anyone have any ideas about what might be causing this and how to fix it? I like the code, but I am not going to use it if it adds 41 queries to each startup.

Thanks,

DrMark

1 post