Any funds whose code was null will have it set to "FUND-WITH-ID-$id"
Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
Signed-off-by: Ruth Frasur <rfrasur@library.in.gov>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
name TEXT NOT NULL,
year INT NOT NULL DEFAULT EXTRACT( YEAR FROM NOW() ),
currency_type TEXT NOT NULL REFERENCES acq.currency_type (code) DEFERRABLE INITIALLY DEFERRED,
- code TEXT,
+ code TEXT NOT NULL,
rollover BOOL NOT NULL DEFAULT FALSE,
propagate BOOL NOT NULL DEFAULT TRUE,
active BOOL NOT NULL DEFAULT TRUE,
--- /dev/null
+BEGIN;
+
+-- if there are any straggling funds without a code set, fix that
+UPDATE acq.fund
+SET code = 'FUND-WITH-ID-' || id
+WHERE code IS NULL;
+
+ALTER TABLE acq.fund
+ ALTER COLUMN code SET NOT NULL;
+
+COMMIT;