提交 77b003fb 编写于 作者: T Tarmo Tänav 提交者: Jeremy Kemper

Use DECIMAL instead of INTEGER when casting as mysql doesn't work with just...

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: NJeremy Kemper <jeremy@bitsweat.net>
上级 3d2ac918
......@@ -407,9 +407,14 @@ def schema_migrations_table_name
end
def current_version
Base.connection.select_value(
"SELECT MAX(CAST(version AS integer)) FROM #{schema_migrations_table_name}"
).to_i rescue 0
sm_table = schema_migrations_table_name
if Base.connection.table_exists?(sm_table)
Base.connection.select_value(
"SELECT MAX(CAST(version AS DECIMAL)) FROM #{sm_table}"
).to_i
else
0
end
end
def proper_table_name(name)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册