title: How to use bigint type when using add_reference with Rails?
body: <p>In Rails 5 and PostgreSQL.</p>
  
  <p>I created this file to want to use <code>bigint</code> data type instead of <code>integer</code> by default:</p>
  
  <pre><code># config/initializers/bigint_primary_keys.rb
  ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::NATIVE_DATABASE_TYPES[:primary_key] = 'bigserial primary key'
  </code></pre>
  
  <p>So when run create and migrate, the table id will be <code>bigint</code> type.</p>
  
  <pre><code># posts table
  id bigint not null
  ...
  
  # users table
  id bigint not null
  ...
  </code></pre>
  
  <p>But when using <code>add_reference</code> in the migration:</p>
  
  <pre><code>class ChangeA &lt; ActiveRecord::Migration[5]
    def change
      add_reference :posts, :users
    end
  end
  </code></pre>
  
  <p>The <code>posts</code> table add this field:</p>
  
  <pre><code># posts table
  ...
  user_id integer
  </code></pre>
  
  <p>Both <code>posts</code> and <code>users</code> table ids are <code>bigint</code> type, but this field does not changed.</p>
  
  <p>Is there a way to set a data type to <code>add_reference</code> method?</p>