diff options
author | Matthew Draper <matthew@trebex.net> | 2016-12-16 23:02:52 +1030 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2017-01-18 23:25:52 +1030 |
commit | 72e59fedb126ab2f42290796108a81f503257de5 (patch) | |
tree | c16f55417f15bf385bf5ec000de6db89baa51eac /activerecord/lib/active_record/migration | |
parent | 9f6f51be78f8807e18fc6562c57af2fdbf8ccb56 (diff) | |
download | rails-72e59fedb126ab2f42290796108a81f503257de5.tar.gz rails-72e59fedb126ab2f42290796108a81f503257de5.tar.bz2 rails-72e59fedb126ab2f42290796108a81f503257de5.zip |
Tweak bigint PK handling
* Don't force PKs on tables that have explicitly opted out
* All integer-like PKs are autoincrement unless they have an explicit
default
Diffstat (limited to 'activerecord/lib/active_record/migration')
-rw-r--r-- | activerecord/lib/active_record/migration/compatibility.rb | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/migration/compatibility.rb b/activerecord/lib/active_record/migration/compatibility.rb index a5d8893634..ffeca2c91e 100644 --- a/activerecord/lib/active_record/migration/compatibility.rb +++ b/activerecord/lib/active_record/migration/compatibility.rb @@ -24,9 +24,8 @@ module ActiveRecord # Since 5.1 Postgres adapter uses bigserial type for primary # keys by default and MySQL uses bigint. This compat layer makes old migrations utilize # serial/int type instead -- the way it used to work before 5.1. - if options[:id].blank? + unless options.key?(:id) options[:id] = :integer - options[:auto_increment] = true end super |