[Non-Backfill Approach] Add a temporary column with default value of 1 and then rename
- Include
SafelyChangeColumnDefaultas per this guide: https://docs.gitlab.com/development/database/avoiding_downtime_in_migrations/#changing-column-defaults - Post deployment migration:
transaction do
add a column organization_id_tmp default 1 not null
drop organization_id
rename organization_id_tmp to organization_id
end
- Re-add FK and unique index
Edited by Kinshuk Singh