<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -407,9 +407,14 @@ module ActiveRecord
       end
 
       def current_version
-        Base.connection.select_value(
-          &quot;SELECT MAX(CAST(version AS integer)) FROM #{schema_migrations_table_name}&quot;
-        ).to_i rescue 0
+        sm_table = schema_migrations_table_name
+        if Base.connection.table_exists?(sm_table)
+          Base.connection.select_value(
+            &quot;SELECT MAX(CAST(version AS DECIMAL)) FROM #{sm_table}&quot;
+          ).to_i
+        else
+          0
+        end
       end
 
       def proper_table_name(name)</diff>
      <filename>activerecord/lib/active_record/migration.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>3d2ac918b987ef0cff34f6a7fdd20926b7a9e5d9</id>
    </parent>
  </parents>
  <author>
    <name>Tarmo T&#228;nav</name>
    <email>tarmo@itech.ee</email>
  </author>
  <url>http://github.com/rails/rails/commit/77b003fb615a1a0b197af9fbb9066622bf489b57</url>
  <id>77b003fb615a1a0b197af9fbb9066622bf489b57</id>
  <committed-date>2008-08-25T23:23:34-07:00</committed-date>
  <authored-date>2008-08-25T23:14:12-07:00</authored-date>
  <message>Use DECIMAL instead of INTEGER when casting as mysql doesn't work with just &quot;INTEGER&quot; and other databases don't like &quot;UNSIGNED&quot; which mysql requires

And don't mask exceptions.

Signed-off-by: Jeremy Kemper &lt;jeremy@bitsweat.net&gt;</message>
  <tree>bdef1e65031ff67d7d83147fdd95c69d54932e37</tree>
  <committer>
    <name>Jeremy Kemper</name>
    <email>jeremy@bitsweat.net</email>
  </committer>
</commit>
