aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2015-09-20 13:58:11 +0900
committerRyuta Kamizono <kamipo@gmail.com>2015-10-08 03:17:02 +0900
commitfd37486e072fc946da6405eb92a1664b5a735615 (patch)
tree0dc1c15fab4c7aa1841712f4e1293807704338d8 /activerecord
parente70ec9e91cb63fd63cfc0a285e5d2268a0297e46 (diff)
downloadrails-fd37486e072fc946da6405eb92a1664b5a735615.tar.gz
rails-fd37486e072fc946da6405eb92a1664b5a735615.tar.bz2
rails-fd37486e072fc946da6405eb92a1664b5a735615.zip
Remove unused `pk_and_sequence_for` in AbstractMysqlAdapter
`pk_and_sequence_for` is implemented for PG and MySQL adapters (not implemented for Sqlite3 adapter). But MySQL adapters are not using `pk_and_sequence_for` already.
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/CHANGELOG.md4
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb7
-rw-r--r--activerecord/test/cases/adapters/mysql/mysql_adapter_test.rb24
3 files changed, 4 insertions, 31 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md
index 6a40d32ef9..15c0674596 100644
--- a/activerecord/CHANGELOG.md
+++ b/activerecord/CHANGELOG.md
@@ -1,3 +1,7 @@
+* Remove unused `pk_and_sequence_for` in AbstractMysqlAdapter.
+
+ *Ryuta Kamizono*
+
* Allow fixtures files to set the model class in the YAML file itself.
To load the fixtures file `accounts.yml` as the `User` model, use:
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
index cd8097d1b3..24408d6bb6 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
@@ -850,13 +850,6 @@ module ActiveRecord
nil
end
- # Returns a table's primary key and belonging sequence.
- def pk_and_sequence_for(table)
- if pk = primary_key(table)
- [ pk, nil ]
- end
- end
-
def primary_keys(table_name) # :nodoc:
raise ArgumentError unless table_name.present?
diff --git a/activerecord/test/cases/adapters/mysql/mysql_adapter_test.rb b/activerecord/test/cases/adapters/mysql/mysql_adapter_test.rb
index 29573d8e0d..d2ce48fc00 100644
--- a/activerecord/test/cases/adapters/mysql/mysql_adapter_test.rb
+++ b/activerecord/test/cases/adapters/mysql/mysql_adapter_test.rb
@@ -65,30 +65,6 @@ module ActiveRecord
end
end
- def test_pk_and_sequence_for
- with_example_table do
- pk, seq = @conn.pk_and_sequence_for('ex')
- assert_equal 'id', pk
- assert_equal @conn.default_sequence_name('ex', 'id'), seq
- end
- end
-
- def test_pk_and_sequence_for_with_non_standard_primary_key
- with_example_table '`code` INT auto_increment, PRIMARY KEY (`code`)' do
- pk, seq = @conn.pk_and_sequence_for('ex')
- assert_equal 'code', pk
- assert_equal @conn.default_sequence_name('ex', 'code'), seq
- end
- end
-
- def test_pk_and_sequence_for_with_custom_index_type_pk
- with_example_table '`id` INT auto_increment, PRIMARY KEY USING BTREE (`id`)' do
- pk, seq = @conn.pk_and_sequence_for('ex')
- assert_equal 'id', pk
- assert_equal @conn.default_sequence_name('ex', 'id'), seq
- end
- end
-
def test_composite_primary_key
with_example_table '`id` INT, `number` INT, foo INT, PRIMARY KEY (`id`, `number`)' do
assert_nil @conn.primary_key('ex')