mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05: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:
parent
af6ec607fa
commit
ff22b9d451
2 changed files with 17 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue