aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/schema_migration.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/schema_migration.rb')
-rw-r--r--activerecord/lib/active_record/schema_migration.rb11
1 files changed, 4 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/schema_migration.rb b/activerecord/lib/active_record/schema_migration.rb
index b384529e75..8f0ab2b55b 100644
--- a/activerecord/lib/active_record/schema_migration.rb
+++ b/activerecord/lib/active_record/schema_migration.rb
@@ -9,7 +9,7 @@ module ActiveRecord
class SchemaMigration < ActiveRecord::Base # :nodoc:
class << self
def primary_key
- nil
+ "version"
end
def table_name
@@ -21,7 +21,7 @@ module ActiveRecord
end
def table_exists?
- connection.table_exists?(table_name)
+ ActiveSupport::Deprecation.silence { connection.table_exists?(table_name) }
end
def create_table(limit=nil)
@@ -31,16 +31,13 @@ module ActiveRecord
connection.create_table(table_name, id: false) do |t|
t.column :version, :string, version_options
+ t.index :version, unique: true, name: index_name
end
- connection.add_index table_name, :version, unique: true, name: index_name
end
end
def drop_table
- if table_exists?
- connection.remove_index table_name, name: index_name
- connection.drop_table(table_name)
- end
+ connection.drop_table table_name, if_exists: true
end
def normalize_migration_number(number)