From 72ca2d7ff668c121d15bb247d7dcb608fc8e34c8 Mon Sep 17 00:00:00 2001 From: Yves Senn Date: Fri, 28 Dec 2012 13:31:02 +0100 Subject: reserve less chars for internal sqlite3 operations --- .../active_record/connection_adapters/sqlite3_adapter.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb index 1b93af5033..105ba69028 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb @@ -187,11 +187,11 @@ module ActiveRecord 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 @@ module ActiveRecord 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 @@ module ActiveRecord 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 } -- cgit v1.2.3