38 $sql =
"select count(*) from pg_class where relname='copyright';";
39 $result = pg_query($PG_CONN, $sql);
41 $row = pg_fetch_assoc($result);
42 pg_free_result($result);
43 if (1 > $row[
'count']) {
47 $sql =
"delete from copyright where pfile_fk not in (select pfile_pk from pfile);";
48 $result = pg_query($PG_CONN, $sql);
50 pg_free_result($result);
53 $sql =
"SELECT conname from pg_constraint where conname= 'copyright_pfile_fk_fkey';";
54 $conresult = pg_query($PG_CONN, $sql);
56 if (pg_num_rows($conresult) == 0) {
57 $sql =
"ALTER TABLE copyright ADD CONSTRAINT copyright_pfile_fk_fkey FOREIGN KEY (pfile_fk) REFERENCES pfile (pfile_pk) ON DELETE CASCADE; ";
58 $result = pg_query($PG_CONN, $sql);
60 pg_free_result($result);
63 pg_free_result($conresult);
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
DBCheckResult($result, $sql, $filenm, $lineno)
Check the postgres result for unexpected errors. If found, treat them as fatal.