Forum: Ruby on Rails How to get database schema version manually?

Posted by Dmitry Vakulenko (n0dwis)
on 2012-11-10 21:05
Hello!

I try to make automatic migrations directly from ruby script without
using rake and console commands.
But I can't retrieve current database schema version.

I have tried to use ActiveRecord::Migration.version and @version
property in a child of ActiveRecord::Migration. The result was nil at
both cases.

How can I do this?

Thank you.
Posted by Dmitry Vakulenko (n0dwis)
on 2012-11-10 21:28
I have found the solution, but only by looking source code of
activerecord gem.

It's simple :)
ActiveRecord::Migrator.current_version
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.