Browse files

Remove duplicated unique index name.

  • Loading branch information...
1 parent 539b69e commit 87a86449e743ee61ccb61d405e4ac2290d916c3b @kennyj kennyj committed Jul 10, 2012
Showing with 7 additions and 4 deletions.
  1. +7 −4 activerecord/lib/active_record/schema_migration.rb
View
11 activerecord/lib/active_record/schema_migration.rb
@@ -7,22 +7,25 @@ class SchemaMigration < ActiveRecord::Base
attr_accessible :version
def self.table_name
- Base.table_name_prefix + 'schema_migrations' + Base.table_name_suffix
+ "#{Base.table_name_prefix}schema_migrations#{Base.table_name_suffix}"
+ end
+
+ def self.index_name
+ "#{Base.table_name_prefix}unique_schema_migrations#{Base.table_name_suffix}"
end
def self.create_table
unless connection.table_exists?(table_name)
connection.create_table(table_name, :id => false) do |t|
t.column :version, :string, :null => false
end
- connection.add_index table_name, :version, :unique => true,
- :name => "#{Base.table_name_prefix}unique_schema_migrations#{Base.table_name_suffix}"
+ connection.add_index table_name, :version, :unique => true, :name => index_name
end
end
def self.drop_table
if connection.table_exists?(table_name)
- connection.remove_index table_name, :name => "#{Base.table_name_prefix}unique_schema_migrations#{Base.table_name_suffix}"
+ connection.remove_index table_name, :name => index_name
connection.drop_table(table_name)
end
end

0 comments on commit 87a8644

Please sign in to comment.