]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/sql/Pg/upgrade/XXXX.schema.action_circulation-auto_renewal-default-false.sql
Lp 1839002: Default circulation auto_renewal field to FALSE
[Evergreen.git] / Open-ILS / src / sql / Pg / upgrade / XXXX.schema.action_circulation-auto_renewal-default-false.sql
1 BEGIN;
2
3 --SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
4
5 UPDATE action.circulation SET auto_renewal = FALSE WHERE auto_renewal IS NULL;
6
7 UPDATE action.aged_circulation SET auto_renewal = FALSE WHERE auto_renewal IS NULL;
8
9 COMMIT;
10
11 -- The following two changes cannot occur in a transaction with the
12 -- above updates because we will get an error about not being able to
13 -- alter a table with pending transactions.  They also need to occur
14 -- after the above updates or the SET NOT NULL change will fail.
15
16 ALTER TABLE action.circulation ALTER COLUMN auto_renewal SET DEFAULT FALSE;
17 ALTER TABLE action.circulation ALTER COLUMN auto_renewal SET NOT NULL;
18
19 ALTER TABLE action.aged_circulation ALTER COLUMN auto_renewal SET DEFAULT FALSE;
20 ALTER TABLE action.aged_circulation ALTER COLUMN auto_renewal SET NOT NULL;