The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Rails: Get the schema_info version number from Rake

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Jay Fields

Posts: 765
Nickname: jayfields
Registered: Sep, 2006

Jay Fields is a software developer for ThoughtWorks
Rails: Get the schema_info version number from Rake Posted: Nov 15, 2006 4:23 AM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Jay Fields.
Original Post: Rails: Get the schema_info version number from Rake
Feed Title: Jay Fields Thoughts
Feed URL: http://blog.jayfields.com/rss.xml
Feed Description: Thoughts on Software Development
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Jay Fields
Latest Posts From Jay Fields Thoughts

Advertisement
Recently a coworker asked if there was a simple way to get the current version out of the schema_info table. Of course, one simple answer is to simply look in the database.

However, if you want to quickly pull the version from a command line, this rake task should do the trick:
namespace :db do
desc "Returns the current schema version"
task :version => :environment do
connection = ActiveRecord::Base.connection
select = 'select * from schema_info'
version_num = connection.execute(select).result.flatten.first.to_i
puts "Current version: " + version_num.to_s
end
end

Read: Rails: Get the schema_info version number from Rake

Topic: What's New in Edge Rails: I Smell Version 1.2... Previous Topic   Next Topic Topic: Talking about Ruby and RubyForge on the Technometria podcast

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use