If we don't set the auto_renewal column to DEFAULT FALSE NOT NULL from
the beginning, then we need to apply updates to all of the circulation
rows -- which can take an extremely long time.
Setting these attributes from the beginning turns the subsequent upgrade
UPDATE statement into a no-op, as none of the rows will be NULL. And the
subsequent ALTER COLUMN statement that adds the DEFAULT FALSE NOT NULL
attributes runs harmlessly.
Signed-off-by: Dan Scott <dan@coffeecode.net>
ADD column max_auto_renewals INTEGER;
ALTER TABLE action.circulation
- ADD column auto_renewal BOOLEAN;
+ ADD column auto_renewal BOOLEAN DEFAULT FALSE NOT NULL;
ALTER TABLE action.circulation
ADD column auto_renewal_remaining INTEGER;
ALTER TABLE action.aged_circulation
- ADD column auto_renewal BOOLEAN;
+ ADD column auto_renewal BOOLEAN DEFAULT FALSE NOT NULL;
ALTER TABLE action.aged_circulation
ADD column auto_renewal_remaining INTEGER;
ADD column max_auto_renewals INTEGER;
ALTER TABLE action.circulation
- ADD column auto_renewal BOOLEAN;
+ ADD column auto_renewal BOOLEAN DEFAULT FALSE NOT NULL;
ALTER TABLE action.circulation
ADD column auto_renewal_remaining INTEGER;
ALTER TABLE action.aged_circulation
- ADD column auto_renewal BOOLEAN;
+ ADD column auto_renewal BOOLEAN DEFAULT FALSE NOT NULL;
ALTER TABLE action.aged_circulation
ADD column auto_renewal_remaining INTEGER;