aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/schema
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2017-06-06 11:56:12 +0900
committerRyuta Kamizono <kamipo@gmail.com>2017-06-07 11:11:08 +0900
commit9b8c7796a9c2048208aa843ad3dc477dffa8bdee (patch)
tree1ab85743b084a1f315396e80025be467654499a9 /activerecord/test/schema
parent2b96d5822bfe407be7589e293f3265c0c7a6726c (diff)
downloadrails-9b8c7796a9c2048208aa843ad3dc477dffa8bdee.tar.gz
rails-9b8c7796a9c2048208aa843ad3dc477dffa8bdee.tar.bz2
rails-9b8c7796a9c2048208aa843ad3dc477dffa8bdee.zip
Avoid overwriting the methods of `AttributeMethods::PrimaryKey`
Currently the methods of `AttributeMethods::PrimaryKey` are overwritten by `define_attribute_methods`. It will be broken if a table that customized primary key has non primary key id column. It should not be overwritten if a table has any primary key. Fixes #29350.
Diffstat (limited to 'activerecord/test/schema')
-rw-r--r--activerecord/test/schema/schema.rb14
1 files changed, 8 insertions, 6 deletions
diff --git a/activerecord/test/schema/schema.rb b/activerecord/test/schema/schema.rb
index 50f1d9bfe7..8863736943 100644
--- a/activerecord/test/schema/schema.rb
+++ b/activerecord/test/schema/schema.rb
@@ -807,16 +807,18 @@ ActiveRecord::Schema.define do
t.string :sponsorable_type
end
- create_table :string_key_objects, id: false, primary_key: :id, force: true do |t|
- t.string :id
- t.string :name
- t.integer :lock_version, null: false, default: 0
+ create_table :string_key_objects, id: false, force: true do |t|
+ t.string :id, null: false
+ t.string :name
+ t.integer :lock_version, null: false, default: 0
+ t.index :id, unique: true
end
- create_table :subscribers, force: true, id: false do |t|
+ create_table :subscribers, force: true do |t|
t.string :nick, null: false
t.string :name
- t.column :books_count, :integer, null: false, default: 0
+ t.integer :books_count, null: false, default: 0
+ t.integer :update_count, null: false, default: 0
t.index :nick, unique: true
end