Jump to content

The ultimate community for Ruby on Rails developers.


Can two Rails versions use one database?

  • Please log in to reply
3 replies to this topic

#1 dast



  • Members
  • 2 posts

Posted 30 January 2014 - 10:04 PM

I'm working on a Rails 1 application. We'd like to upgrade it to Rails 3 or 4, but Rails 1 is so old that we think it would take a total rewrite to upgrade. There are management and budget issues with a total rewrite. We wouldn't be able to deliver anything until the entire rewritten application was finished.

So, we are searching for creative solutions to the upgrade problem. One idea is to start rewriting the application in Rails 4 and run it alongside the Rails 1 application. As features are added to the Rails 4 version, the same feature in the Rails 1 version could be taken offline. Users would see a mix of the two versions. Some pages would be served by Rails 1 and others by Rails 4.
This would require both the Rails 1 and Rails 4 versions to use the same database.
So my question is, will this work? What problems with this approach should we be anticipating? We know it isn't a perfect solution, but we're hoping it's good enough to drive the project forward.

#2 james



  • Members
  • 223 posts
  • LocationLeeds, U.K.

Posted 01 February 2014 - 01:10 PM

You are certainly correct as regards to re-write vs upgrade. The task to upgrade a Rails version 1 app would probably be greater than starting from scratch with a Rails 4 site.

The main issue I see you having with mixing the two together is the version of Ruby that Rails would need to work with version 1.8.xx whereas version 4 of Rails works best with Ruby 2.x

To cater for this you will need to ensure your gemsets remain separate. so you should be looking to use RVM or Rubyenv Both options are well documented and there are various railscasts on them at http://railscasts.com/


I see no issues with both apps hooking into the same database but in the process of developing the new site you may wish to make changes/enhancements to the DB structure that ay upset the original app. This needs very careful planning and I would advise a full design of the new app before making this decision.


The only other downside I can se is the potential for more resources needed on your web server. This will be down to the need to serve multiple apps from the same server. You may also wish to take advantage of the newer server options available to you (nginx and Unicorn are a fantastic combination) again this may upset your existing app. So think carefully about your hosting options.


Rails 1 was very buggy, there are a host of new features available in Rails 4 that would probably greatly benefit your app in terms of both functionality and development time.


If it was me making this decision, I would host a separate app on a separate server, start from scratch and I would set up redirects for new features as they come on line, bearing in mind that there may not be a direct page for page replacement in all circumstances. Then I would set up a process to enable the databases to keep in sync with each other.



I have no idea on the budget involved, or the complexities of the existing app or the requirement to re-write. I would be sceptical of any answer to this question (including mine) that is missing this information.


Hope it goes someway to helping you make your decision.

Programming is just about problem solving!

#3 dast



  • Members
  • 2 posts

Posted 05 February 2014 - 04:56 PM

Thanks James. I think all of your arguments are sound, although we may try and serve both apps from the same webserver. Also, we will probably not design the new app much in advance. It will mostly be a feature-for-feature reimplementation of the current app, although we'll try and sneak in cosmetic and performance improvements. The warnings about Ruby versions and DB schema updates are sensible.

#4 renoldscott



  • Members
  • 6 posts
  • LocationUSA, NY

Posted 07 March 2014 - 06:46 AM

I agree with james

From User Interface Design and Coding Services at whitepaperit.com

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users