Also, backfill the column. It sort of "naturally" backfills as leases
are acquired and cleared using the new code in
a05fc1db61
, but by using a default and a
one-time backfill after that the code can move towards a `NOT NULL`
constraint.
18 lines
370 B
Ruby
18 lines
370 B
Ruby
# frozen_string_literal: true
|
|
|
|
Sequel.migration do
|
|
up do
|
|
alter_table(:strand) do
|
|
set_column_default :lease, Sequel.lit("now() - '1000 years'::interval")
|
|
end
|
|
|
|
self[:strand].where(lease: nil).update(lease: Sequel.lit("now() - '1000 years'::interval"))
|
|
end
|
|
|
|
down do
|
|
alter_table(:strand) do
|
|
set_column_default :lease, nil
|
|
end
|
|
end
|
|
end
|