提交 89622b92 编写于 作者: J Josef Stribny

Translate new unique constraint for sqlite >= 3.8.2

上级 fee49a10
...@@ -595,7 +595,11 @@ def sqlite_version ...@@ -595,7 +595,11 @@ def sqlite_version
def translate_exception(exception, message) def translate_exception(exception, message)
case exception.message case exception.message
when /column(s)? .* (is|are) not unique/ # SQLite 3.8.2 returns a newly formatted error message:
# UNIQUE constraint failed: *table_name*.*column_name*
# Older versions of SQLite return:
# column *column_name* is not unique
when /column(s)? .* (is|are) not unique/, /UNIQUE constraint failed: .*/
RecordNotUnique.new(message, exception) RecordNotUnique.new(message, exception)
else else
super super
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册