Skip to content

Commit

Permalink
Merge pull request #21686 from kamipo/remove_pk_and_sequence_for
Browse files Browse the repository at this point in the history
Remove unused `pk_and_sequence_for` in AbstractMysqlAdapter
  • Loading branch information
pixeltrix committed Oct 8, 2015
2 parents eaa0cb7 + fd37486 commit c750ca5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 31 deletions.
4 changes: 4 additions & 0 deletions 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:
Expand Down
Expand Up @@ -850,13 +850,6 @@ def show_variable(name)
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?

Expand Down
24 changes: 0 additions & 24 deletions activerecord/test/cases/adapters/mysql/mysql_adapter_test.rb
Expand Up @@ -65,30 +65,6 @@ def test_exec_insert_string
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')
Expand Down

0 comments on commit c750ca5

Please sign in to comment.