Upgrading to 3.4.x from 3.3.x

peakpg edited this page May 17, 2012 · 3 revisions
Clone this wiki locally

Prerequisites

  1. This guide assumes you are upgrading a BrowserCMS project to 3.4.x from 3.3.x. For other versions, see Upgrading BrowserCMS
  2. It assumes the project is currently running on Rails 3.0 and will be updated to Rails 3.1 as part of this process.
  3. The project being managed using Git (or other SCM)

Instructions

1. Install the new BrowserCMS Gem

Ensure you have the correct version:

$ bcms -v

Should return BrowserCMS 3.4.0 or some other 3.4.x version.

3. Run upgrade script

In your project, run the following script from the command line:

$ bcms upgrade # Type 'a' when prompted

During the update, a rake task to upgrade rails will be run (i.e. rake rails:update), and you will be prompted to overwrite some files. Enter 'a' when prompted to overwrite all the files. This will update the project to use the new version of the gem, add new migrations and seed data as needed. Then do the following:

  1. Review the following files and ensure the specified lines appear (use Git to selectively discard the changes):
config/environment/development.rb => Should contain:
  SITE_DOMAIN=localhost:3000
config/environment/production.rb => Should contain:
  SITE_DOMAIN=http://your-site-domain.com
  config.action_controller.page_cache_directory = File.join(Rails.root, 'public', 'cache')
  config.action_mailer.smtp_settings = {:address => 'mail.yourmailserver.com', :domain => "#{SITE_DOMAIN}"}
config/environment/test.rb => Should contain:
  SITE_DOMAIN=localhost:3000
  1. Run git checkout config/routes.rb to revert this file
  2. Run rake db:migrate to migrate the database
  3. Edit the db/seeds.rb to remove all the BrowserCMS specific seed data calls. It will be duplicative with what is contained in the db/browsercms.seeds.rb file.

Troubleshooting

Custom Blocks

As part of this upgrade, a new migration will be generated to 'correct' any custom blocks in your project. Ensure you review db/migrate/*_update_version_id_columns.rb to ensure it's correcting the right tables.

uninitialized constant Browsercms300::ContentTypeGroup

This issue may occur when running the rake db:migrate task, due to 'old' seed data that appears in migrations. The easiest solution is:

  1. Delete all db/migrate/_browsercms.rb files
  2. Run rake cms:install:migrations to regenerate up to date versions.

You may need to alter the timestamps of your custom CMS migrations to fix their order.

uninitialized constant SomeNamespace::ContentType

Again, while running rake db:migrate. Review your project's migrations for its custom blocks, and change any statements that look like this:

# Old
ContentType.create!(:name => "Product", :group_name => "Product")

# to This
Cms::ContentType.create!(:name => "Product", :group_name => "Product")