From 26638f0ac939edb00d12b55442bbdb138d5d9449 Mon Sep 17 00:00:00 2001
From: Jerad Phelps <jerad.phelps@gmail.com>
Date: Thu, 17 Oct 2013 19:00:22 -0500
Subject: added schema_migrations_table_name to ActiveRecord::Base in order
 that the name of the schema migrations table can be configured.

consolidated test_schema_migrations_table_name tests

Added changelog entry

edited changelog

removed commented lines

removed reader

ensure the schema migrations table is reset at end of test

added entry to configuration guide

guides typo and changelog order
---
 activerecord/lib/active_record/model_schema.rb     | 6 ++++++
 activerecord/lib/active_record/schema_migration.rb | 4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

(limited to 'activerecord/lib')

diff --git a/activerecord/lib/active_record/model_schema.rb b/activerecord/lib/active_record/model_schema.rb
index 75c0c1bda8..dc5ff02882 100644
--- a/activerecord/lib/active_record/model_schema.rb
+++ b/activerecord/lib/active_record/model_schema.rb
@@ -32,6 +32,12 @@ module ActiveRecord
       class_attribute :table_name_suffix, instance_writer: false
       self.table_name_suffix = ""
 
+      ##
+      # :singleton-method:
+      # Accessor for the name of the schema migrations table. By default, the value is "schema_migrations"
+      class_attribute :schema_migrations_table_name, instance_accessor: false
+      self.schema_migrations_table_name = "schema_migrations"
+
       ##
       # :singleton-method:
       # Indicates whether table names should be the pluralized versions of the corresponding class names.
diff --git a/activerecord/lib/active_record/schema_migration.rb b/activerecord/lib/active_record/schema_migration.rb
index fee19b1096..a9d164e366 100644
--- a/activerecord/lib/active_record/schema_migration.rb
+++ b/activerecord/lib/active_record/schema_migration.rb
@@ -7,11 +7,11 @@ module ActiveRecord
     class << self
 
       def table_name
-        "#{table_name_prefix}schema_migrations#{table_name_suffix}"
+        "#{table_name_prefix}#{ActiveRecord::Base.schema_migrations_table_name}#{table_name_suffix}"
       end
 
       def index_name
-        "#{table_name_prefix}unique_schema_migrations#{table_name_suffix}"
+        "#{table_name_prefix}unique_#{ActiveRecord::Base.schema_migrations_table_name}#{table_name_suffix}"
       end
 
       def table_exists?
-- 
cgit v1.2.3