27 $sql =
"select count(*) from pg_class where relname='copyright';";
30 $row = pg_fetch_assoc($result);
31 pg_free_result($result);
32 if (1 > $row[
'count']) {
36 $sql =
"delete from copyright where pfile_fk not in (select pfile_pk from pfile);";
39 pg_free_result($result);
42 $sql =
"SELECT conname from pg_constraint where conname= 'copyright_pfile_fk_fkey';";
43 $conresult = pg_query(
$PG_CONN, $sql);
45 if (pg_num_rows($conresult) == 0) {
46 $sql =
"ALTER TABLE copyright ADD CONSTRAINT copyright_pfile_fk_fkey FOREIGN KEY (pfile_fk) REFERENCES pfile (pfile_pk) ON DELETE CASCADE; ";
49 pg_free_result($result);
52 pg_free_result($conresult);
DBCheckResult($result, $sql, $filenm, $lineno)
Check the postgres result for unexpected errors. If found, treat them as fatal.
Migrate_20_25($Verbose)
Delete from copyright where pfile_fk not in (select pfile_pk from pfile) add foreign constraint on co...
foreach($Options as $Option=> $OptVal) if(0==$reference_flag &&0==$nomos_flag) $PG_CONN