遵循strong_migrations建议,如何安全地将ID数据类型从INT更改为BIGINT?

时间:2018-11-09 21:43:51

标签: ruby-on-rails postgresql

我想知道如何遵循strong_migrations建议安全地将id字段的数据类型从INT更改为BIGINT?

Changing the type of an existing column requires the entire
table and indexes to be rewritten. A safer approach is to:
  1. Create a new column
  2. Write to both columns
  3. Backfill data from the old column to the new column
  4. Move reads from the old column to the new column
  5. Stop writing to the old column
  6. Drop the old column

在这种情况下,新列的名称应该是什么?

0 个答案:

没有答案