danmaclean / gee_fu

An extensible Ruby on Rails web-service application and database for visualising HTGS data
18 stars 5 forks source link

rake db:migrate fails, nil popping up #30

Closed danmaclean closed 11 years ago

danmaclean commented 11 years ago

from PR #29 bundle install fine, rake db:migrate gives

== AddOrganismToGenome: migrating ============================================ -- add_column(:genomes, :organism_id, :integer) -> 0.0061s -- add_foreign_key(:genomes, :organisms) -> 0.0252s -- change_column(:genomes, :organism_id, :integer, {:null=>false}) -> 0.0073s == AddOrganismToGenome: migrated (0.1046s) ===================================

== AddLocalNameToOrganism: migrating ========================================= -- add_column(:organisms, :local_name, :string) -> 0.0012s rake aborted! An error has occurred, this and all later migrations canceled:

stack follows. Let me know if you need more.

mrship commented 11 years ago

Please gist the stack.

mrship commented 11 years ago

Also, you'll need to mention me - i.e. put @mrship somewhere in the issue - if you want me to see issues automatically. Otherwise it'll only be when I review the list, hence the delay in responding! :)

danmaclean commented 11 years ago

D'oh stack at https://gist.github.com/danmaclean/5425098 @mrship

mrship commented 11 years ago

OK, I'm guessing a bit here as this appears to be a fairly random error, but try changing organism.rb from validates :local_name, presence: true, uniqueness: { message: "The local name of the organism must be unique." } to validates :local_name, presence: true validates_uniqueness_of :local_name, message: "The local name of the organism must be unique." And re-run the migration. I'm working a little blind as it doesn't fail on my setup. Let me know if that works.

danmaclean commented 11 years ago

Smashing! all good! n95829:gee_fu-experimental-6 macleand$ rake db:migrate DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /Users/macleand/Downloads/gee_fu-experimental-6/Rakefile:7) == AddLocalNameToOrganism: migrating ========================================= -- add_column(:organisms, :local_name, :string) -> 0.0039s -- change_column(:organisms, :local_name, :string, {:null=>false}) -> 0.0017s == AddLocalNameToOrganism: migrated (0.1216s) ================================