提交 72ca2d7f 编写于 作者: Y Yves Senn

reserve less chars for internal sqlite3 operations

上级 cca43528
......@@ -187,11 +187,11 @@ def supports_index_sort_order?
true
end
# Returns 51. SQLite supports index names up to 64
# Returns 62. SQLite supports index names up to 64
# characters. The rest is used by rails internally to perform
# temporary rename operations
def allowed_index_name_length
index_name_length - 13
index_name_length - 2
end
def native_database_types #:nodoc:
......@@ -509,7 +509,7 @@ def table_structure(table_name)
end
def alter_table(table_name, options = {}) #:nodoc:
altered_table_name = "altered_#{table_name}"
altered_table_name = "a#{table_name}"
caller = lambda {|definition| yield definition if block_given?}
transaction do
......@@ -553,10 +553,10 @@ def copy_table(from, to, options = {}) #:nodoc:
def copy_table_indexes(from, to, rename = {}) #:nodoc:
indexes(from).each do |index|
name = index.name
if to == "altered_#{from}"
name = "temp_#{name}"
elsif from == "altered_#{to}"
name = name[5..-1]
if to == "a#{from}"
name = "t#{name}"
elsif from == "a#{to}"
name = name[1..-1]
end
to_column_names = columns(to).map { |c| c.name }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册