Permalink
Browse files

reserve less chars for internal sqlite3 operations

  • Loading branch information...
1 parent cca4352 commit 72ca2d7ff668c121d15bb247d7dcb608fc8e34c8 @senny senny committed Dec 28, 2012
Showing with 7 additions and 7 deletions.
  1. +7 −7 activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
View
14 activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
@@ -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 }

0 comments on commit 72ca2d7

Please sign in to comment.