summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authoryorhel <yorhel@1fe2e327-d9db-4752-bcf7-ef0cb4a1748b>2008-08-20 14:17:47 +0000
committeryorhel <yorhel@1fe2e327-d9db-4752-bcf7-ef0cb4a1748b>2008-08-20 14:17:47 +0000
commitd4368e6342088e8d244cd82dcecce94e74f18299 (patch)
tree90033eb3ce8c0953c5575968781ddd37c1866d71 /util
parentcbd1e5abe69b7ad6e92b95142123e99f544b747e (diff)
Converted relation graphs to PNG
git-svn-id: svn://vndb.org/vndb@101 1fe2e327-d9db-4752-bcf7-ef0cb4a1748b
Diffstat (limited to 'util')
-rwxr-xr-xutil/updates/update_1.22.pl28
-rw-r--r--util/updates/update_1.22.sh16
-rw-r--r--util/updates/update_1.22.sql5
3 files changed, 18 insertions, 31 deletions
diff --git a/util/updates/update_1.22.pl b/util/updates/update_1.22.pl
deleted file mode 100755
index 465c8c40..00000000
--- a/util/updates/update_1.22.pl
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/usr/bin/perl
-
-
-# update_1.22.sql must be executed before this script
-
-
-use strict;
-use warnings;
-use DBI;
-
-BEGIN { require '/www/vndb/lib/global.pl' }
-
-my $sql = DBI->connect(@VNDB::DBLOGIN,
- { PrintError => 1, RaiseError => 1, AutoCommit => 0 });
-
-my $q = $sql->prepare('INSERT INTO relgraph (id, cmap) VALUES(?,?)');
-for (glob "/www/vndb/data/rg/*/*.cmap") {
- my $id = $1 if /([0-9]+)\.cmap$/;
- open my $F, '<', $_ or die $!;
- $q->execute($id, join "\n", <$F>);
- close $F;
-}
-
-$sql->do('ALTER TABLE vn ADD FOREIGN KEY (rgraph) REFERENCES relgraph (id) DEFERRABLE INITIALLY DEFERRED');
-$sql->commit;
-
-# it's now safe to delete /data/rg
-
diff --git a/util/updates/update_1.22.sh b/util/updates/update_1.22.sh
new file mode 100644
index 00000000..3fdbaea7
--- /dev/null
+++ b/util/updates/update_1.22.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+# update_1.22.sql must be executed before this script
+
+cd /www/vndb
+
+# delete all relation graphs (just the files)
+find static/rg -name '*.gif' -delete
+
+# delete all relation graph image maps (entire directory)
+rm -rf data/rg
+
+# regenerate all relation graphs
+util/multi.pl -c 'relgraph all'
+
+
diff --git a/util/updates/update_1.22.sql b/util/updates/update_1.22.sql
index e3729765..9a81b2c6 100644
--- a/util/updates/update_1.22.sql
+++ b/util/updates/update_1.22.sql
@@ -5,12 +5,11 @@ CREATE TABLE relgraph (
cmap text NOT NULL DEFAULT ''
) WITHOUT OIDS;
-SELECT SETVAL('relgraph_id_seq', NEXTVAL('relgraph_seq'));
DROP SEQUENCE relgraph_seq;
-
ALTER TABLE vn ALTER COLUMN rgraph DROP NOT NULL;
ALTER TABLE vn ALTER COLUMN rgraph SET DEFAULT NULL;
-UPDATE vn SET rgraph = NULL WHERE rgraph = 0;
+UPDATE vn SET rgraph = NULL;
+ALTER TABLE vn ADD FOREIGN KEY (rgraph) REFERENCES relgraph (id) DEFERRABLE INITIALLY DEFERRED;
-- add foreign table constraint to changes.causedby