1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Use DECIMAL instead of INTEGER when casting as mysql doesn't work with just "INTEGER" and other databases don't like "UNSIGNED" which mysql requires

And don't mask exceptions.

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
This commit is contained in:
Tarmo Tänav 2008-08-26 09:14:12 +03:00 committed by Jeremy Kemper
parent 3d2ac918b9
commit 77b003fb61

View file

@ -407,9 +407,14 @@ module ActiveRecord
end
def current_version
sm_table = schema_migrations_table_name
if Base.connection.table_exists?(sm_table)
Base.connection.select_value(
"SELECT MAX(CAST(version AS integer)) FROM #{schema_migrations_table_name}"
).to_i rescue 0
"SELECT MAX(CAST(version AS DECIMAL)) FROM #{sm_table}"
).to_i
else
0
end
end
def proper_table_name(name)