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:
parent
3d2ac918b9
commit
77b003fb61
1 changed files with 8 additions and 3 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue