Skip to content

Change id primary keys from integer (serial) to bigint (identity)

João Pereira requested to merge db-ids-should-be-bigint into database

This MR does the following changes (following the recommendations/best practices discussed during the PostreSQL training):

  • Changes the type of the id primary keys from integer to bigint. This is now the default for Rails 6 as well, and avoids running out of integer values.

  • Changes the id columns increment strategy from serial to the new (PostgreSQL 10+) identity. This is a general recommendation for PostgreSQL (see https://wiki.postgresql.org/wiki/Don%27t_Do_This#Don.27t_use_serial).

Related to &2313 (closed).

Edited by João Pereira

Merge request reports