DEFERRABLE INITIALLY DEFERRED,
copy_location INT NOT NULL DEFAULT 1 REFERENCES asset.copy_location (id) DEFERRABLE INITIALLY DEFERRED,
checkin_scan_time TIMESTAMP WITH TIME ZONE,
- auto_renewal BOOLEAN,
+ auto_renewal BOOLEAN NOT NULL DEFAULT FALSE,
auto_renewal_remaining INTEGER
) INHERITS (money.billable_xact);
ALTER TABLE action.circulation ADD PRIMARY KEY (id);
--- /dev/null
+BEGIN;
+
+--SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+UPDATE action.circulation SET auto_renewal = FALSE WHERE auto_renewal IS NULL;
+
+UPDATE action.aged_circulation SET auto_renewal = FALSE WHERE auto_renewal IS NULL;
+
+COMMIT;
+
+-- The following two changes cannot occur in a transaction with the
+-- above updates because we will get an error about not being able to
+-- alter a table with pending transactions. They also need to occur
+-- after the above updates or the SET NOT NULL change will fail.
+
+ALTER TABLE action.circulation ALTER COLUMN auto_renewal SET DEFAULT FALSE;
+ALTER TABLE action.circulation ALTER COLUMN auto_renewal SET NOT NULL;
+
+ALTER TABLE action.aged_circulation ALTER COLUMN auto_renewal SET DEFAULT FALSE;
+ALTER TABLE action.aged_circulation ALTER COLUMN auto_renewal SET NOT NULL;