rebuild_automdates — rebuild the automatic Mdates for an individual
int
rebuild_automdates
(
|
sname) ; |
char(3)
sname
;This procedure rebuilds the automatic Mdates on the CENSUS table for a specific individual.
This routine should not be run while triggers (automatic data validation) are enabled.
-- Turn off triggers by e.g.:
-- cd db/triggers
-- make BABASE_DB=babase_foo destroy
BEGIN;
-- Empty those tables that could refer to automdates.
DELETE FROM cycstats WHERE sname = 'FOO';
DELETE FROM mmintervals WHERE sname = 'FOO';
DELETE FROM mdintervals WHERE sname = 'FOO';
SELECT rebuild_all_automdates();
-- Commit so that triggers can be re-installed.
COMMIT;
-- Re-install trigges by e.g.:
-- cd db/triggers
-- make BABASE_DB=babase_foo install
BEGIN;
-- Rebuild the cycles.seq and cycles.series columns
SELECT rebuild_cycles('FOO');
-- Rebuild the tables temporarly emptied.
SELECT rebuild_cycstats('FOO');
SELECT rebuild_mmintervals('FOO');
SELECT rebuild_mdintervals('FOO');
COMMIT;