locomotivecms / engine

A platform to create, publish and edit sites
http://www.locomotivecms.com
Other
2.31k stars 626 forks source link

Error running migrations after upgrade from 2.4.x to 2.5.6 #1021

Closed dyerc closed 9 years ago

dyerc commented 9 years ago

Yesterday I upgraded my version of the Locomotive gem to 2.5.6. I didn't rerun the migrations at the time, but everything worked perfectly. Today I setup a new site and attempted to add a new domain to that particular site. Every time this would generate a 500 error.

So I thought since I hadn't run the migrations (as the guide on the site states) that should be my next step.

After running bundle exec rake db:mongoid:migration:install RAILS_ENV=production

Then bundle exec rake db:mongoid:migrate RAILS_ENV=production

It fails with the following stack trace:

bundle exec rake db:mongoid:migrate RAILS_ENV=production
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.19/lib/active_support/values/time_zone.rb:270: warning: circular argument reference - now
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/mongoid-3.1.6/lib/mongoid/persistence/atomic/operation.rb:74: warning: circular argument reference - field
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/locomotive_liquid-2.4.2/lib/liquid/htmltags.rb:43: warning: duplicated key at line 46 ignored: "index0"
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/fog-1.12.1/lib/fog/aws/compute.rb:200: warning: duplicated key at line 208 ignored: :internet_gateways
Digest::Digest is deprecated; use Digest
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/fog-1.12.1/lib/fog/rackspace/mock_data.rb:41: warning: duplicated key at line 79 ignored: "name"
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/compass-core-1.0.1/lib/compass/core/caniuse.rb:72: warning: circular argument reference - browsers
==  GenerateChecksumForThemeAssets: migrating =================================
rake aborted!
An error has occurred, all later migrations canceled:

undefined method `body' for nil:NilClass/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/carrierwave-0.9.0/lib/carrierwave/storage/fog.rb:227:in `read'
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/carrierwave-0.9.0/lib/carrierwave/uploader/proxy.rb:46:in `read'
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/locomotive_cms-2.5.6/app/models/locomotive/theme_asset.rb:190:in `calculate_checksum'
/home/deployer/cd_cms/releases/20150105175159/mongodb/migrate/20150107201707_generate_checksum_for_theme_assets.locomotive.rb:5:in `block in up'
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/mongoid-3.1.6/lib/mongoid/contextual/mongo.rb:640:in `yield_document'
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/mongoid-3.1.6/lib/mongoid/contextual/mongo.rb:123:in `block (2 levels) in each'
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/moped-1.5.2/lib/moped/query.rb:77:in `block in each'
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/moped-1.5.2/lib/moped/cursor.rb:26:in `block in each'
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/moped-1.5.2/lib/moped/cursor.rb:26:in `each'
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/moped-1.5.2/lib/moped/cursor.rb:26:in `each'
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/moped-1.5.2/lib/moped/query.rb:76:in `each'
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/moped-1.5.2/lib/moped/query.rb:76:in `each'
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/mongoid-3.1.6/lib/mongoid/contextual/mongo.rb:122:in `block in each'
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/mongoid-3.1.6/lib/mongoid/contextual/mongo.rb:619:in `selecting'
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/mongoid-3.1.6/lib/mongoid/contextual/mongo.rb:121:in `each'
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/mongoid-3.1.6/lib/mongoid/contextual.rb:19:in `each'
/home/deployer/cd_cms/releases/20150105175159/mongodb/migrate/20150107201707_generate_checksum_for_theme_assets.locomotive.rb:4:in `up'
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/mongoid_migration-0.0.8/lib/mongoid_migration/migration.rb:131:in `block in migrate'
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/mongoid_migration-0.0.8/lib/mongoid_migration/migration.rb:131:in `migrate'
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/mongoid_migration-0.0.8/lib/mongoid_migration/migration.rb:44:in `migrate'
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/mongoid_migration-0.0.8/lib/mongoid_migration/migration.rb:303:in `block in migrate'
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/mongoid_migration-0.0.8/lib/mongoid_migration/migration.rb:290:in `each'
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/mongoid_migration-0.0.8/lib/mongoid_migration/migration.rb:290:in `migrate'
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/mongoid_migration-0.0.8/lib/mongoid_migration/migration.rb:217:in `up'
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/mongoid_migration-0.0.8/lib/mongoid_migration/migration.rb:199:in `migrate'
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/mongoid_migration-0.0.8/lib/tasks/mongoid_migration_tasks.rake:78:in `block (3 levels) in <top (required)>'
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/rake-10.0.4/lib/rake/task.rb:246:in `call'
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/rake-10.0.4/lib/rake/task.rb:246:in `block in execute'
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/rake-10.0.4/lib/rake/task.rb:241:in `each'
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/rake-10.0.4/lib/rake/task.rb:241:in `execute'
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/rake-10.0.4/lib/rake/task.rb:184:in `block in invoke_with_call_chain'
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/rake-10.0.4/lib/rake/task.rb:170:in `invoke'
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/rake-10.0.4/lib/rake/application.rb:143:in `invoke_task'
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/rake-10.0.4/lib/rake/application.rb:101:in `block (2 levels) in top_level'
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/rake-10.0.4/lib/rake/application.rb:101:in `each'
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/rake-10.0.4/lib/rake/application.rb:101:in `block in top_level'
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/rake-10.0.4/lib/rake/application.rb:110:in `run_with_threads'
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/rake-10.0.4/lib/rake/application.rb:95:in `top_level'
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/rake-10.0.4/lib/rake/application.rb:73:in `block in run'
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'
/home/deployer/cd_cms/shared/bundle/ruby/2.2.0/gems/rake-10.0.4/lib/rake/application.rb:70:in `run'

Any support you can offer would be greatly appreciated.

dyerc commented 9 years ago

I deleted failing migration (GenerateChecksumForThemeAssets) to see if the other ones would correctly work, which they did.

However after the upgrade all of my editable_text regions are gone. I have a backup from before the upgrade and when I compare the dumps exported as json (from before the upgrade and migration) to after, the dates have changed.

Before:

"created_at" : { "$date" : "2014-08-15T12:06:50.855+0100" }

After:

"created_at" : { "$date" : 1408100810855 }

Is this more of a MongoDB issue, which version is correct? Why the change?

dyerc commented 9 years ago

All issues with running migrations and saving any of the account screens was related to running 2.5.6 with Ruby 2.2.0. Everything works perfectly with 2.1.5.