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

reserve less chars for internal sqlite3 operations

上级 cca43528
...@@ -187,11 +187,11 @@ def supports_index_sort_order? ...@@ -187,11 +187,11 @@ def supports_index_sort_order?
true true
end 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 # characters. The rest is used by rails internally to perform
# temporary rename operations # temporary rename operations
def allowed_index_name_length def allowed_index_name_length
index_name_length - 13 index_name_length - 2
end end
def native_database_types #:nodoc: def native_database_types #:nodoc:
...@@ -509,7 +509,7 @@ def table_structure(table_name) ...@@ -509,7 +509,7 @@ def table_structure(table_name)
end end
def alter_table(table_name, options = {}) #:nodoc: 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?} caller = lambda {|definition| yield definition if block_given?}
transaction do transaction do
...@@ -553,10 +553,10 @@ def copy_table(from, to, options = {}) #:nodoc: ...@@ -553,10 +553,10 @@ def copy_table(from, to, options = {}) #:nodoc:
def copy_table_indexes(from, to, rename = {}) #:nodoc: def copy_table_indexes(from, to, rename = {}) #:nodoc:
indexes(from).each do |index| indexes(from).each do |index|
name = index.name name = index.name
if to == "altered_#{from}" if to == "a#{from}"
name = "temp_#{name}" name = "t#{name}"
elsif from == "altered_#{to}" elsif from == "a#{to}"
name = name[5..-1] name = name[1..-1]
end end
to_column_names = columns(to).map { |c| c.name } 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.
先完成此消息的编辑!
想要评论请 注册