mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Fixed error when removing an index from a table name values, which is a reserved word, with test.
Signed-off-by: José Valim <jose.valim@gmail.com>
This commit is contained in:
committed by
José Valim
parent
af6ec607fa
commit
ff22b9d451
@@ -365,7 +365,7 @@ module ActiveRecord
|
||||
end
|
||||
|
||||
def remove_index!(table_name, index_name) #:nodoc:
|
||||
execute "DROP INDEX #{quote_column_name(index_name)} ON #{table_name}"
|
||||
execute "DROP INDEX #{quote_column_name(index_name)} ON #{quote_table_name(table_name)}"
|
||||
end
|
||||
|
||||
# Rename an index.
|
||||
|
||||
@@ -1621,6 +1621,22 @@ if ActiveRecord::Base.connection.supports_migrations?
|
||||
end
|
||||
end
|
||||
|
||||
class ReservedWordsMigrationTest < ActiveRecord::TestCase
|
||||
def test_drop_index_from_table_named_values
|
||||
connection = Person.connection
|
||||
connection.create_table :values, :force => true do |t|
|
||||
t.integer :value
|
||||
end
|
||||
connection.add_index :values, :value
|
||||
|
||||
# Just remove the index, it should not raise an exception
|
||||
connection.remove_index :values, :column => :value
|
||||
|
||||
connection.drop_table :values rescue nil
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
class ChangeTableMigrationsTest < ActiveRecord::TestCase
|
||||
def setup
|
||||
@connection = Person.connection
|
||||
|
||||
Reference in New Issue
Block a user