From 72e59fedb126ab2f42290796108a81f503257de5 Mon Sep 17 00:00:00 2001 From: Matthew Draper Date: Fri, 16 Dec 2016 23:02:52 +1030 Subject: 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 --- activerecord/lib/active_record/migration/compatibility.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'activerecord/lib/active_record/migration') 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 -- cgit v1.2.3