Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove duplicated unique index name.

  • Loading branch information...
commit 87a86449e743ee61ccb61d405e4ac2290d916c3b 1 parent 539b69e
@kennyj authored
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,7 +7,11 @@ 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
@@ -15,14 +19,13 @@ def self.create_table
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
Please sign in to comment.
Something went wrong with that request. Please try again.