Repository is archived
No commit activity in last 3 years
No release in over 3 years
Easily use 64-bit primary keys in Rails
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 0

Runtime

 Project Readme

rails-bigint-primarykey Build Status

Overview

rails-bigint-primarykey aims to be a simple, transparent way to use 64bit primary keys in MySQL and PostgreSQL.

This gem was initially a fork of the rails-bigint-pk gem but it was significantly rewritten to support Rails 5.

Installation & Usage

Add the following to your Gemfile:

gem 'rails-bigint-primarykey'

Gotchas

When adding foreign key columns, be sure to use references and not add_column.

change_table :my_table do |t|
  t.references :other_table
end

# Doing this will not use 64bit ints
add_column :my_table, :other_table_id, :int

When upgrading to Rails 5.1 you still need this gem if your were using it before and your migrations still use the version 5.0 or previous.