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:
parent
af6ec607fa
commit
ff22b9d451
@ -365,7 +365,7 @@ def remove_index(table_name, options = {})
|
||||
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 @@ def test_migrator_interleaved_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
|
||||
|
Loading…
Reference in New Issue
Block a user