summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2010-12-17 14:39:41 +0100
committerYorhel <git@yorhel.nl>2010-12-17 14:48:04 +0100
commit50cfb305796d1d115c408feefbe39fddf7615166 (patch)
treec56da35435063a11b79837dfd8821f6a63719271 /util
parenteaf9e895daab98eb122f2570bb409794b3257c99 (diff)
Don't allow NULL for rr.minage and use -1 for unknown
This can be seen as a partial revert of 0a4f97f0186d6941a4cab2e3bd05201f1fed1441. I used to think using NULL for special values is more "correct" in database terms. But in the end I guess I should be aiming for whatever solution is easier. Both are "correct" in a sense anyway.
Diffstat (limited to 'util')
-rwxr-xr-xutil/jsgen.pl2
-rw-r--r--util/updates/update_2.16.sql6
2 files changed, 7 insertions, 1 deletions
diff --git a/util/jsgen.pl b/util/jsgen.pl
index 4af20b27..c1a9593b 100755
--- a/util/jsgen.pl
+++ b/util/jsgen.pl
@@ -104,7 +104,7 @@ sub jsgen {
$common .= sprintf "rlst_rstat = [ %s ];\n", join ', ', map qq{"$_"}, @{$S{rlst_rstat}};
$common .= sprintf "rlst_vstat = [ %s ];\n", join ', ', map qq{"$_"}, @{$S{rlst_vstat}};
$common .= sprintf "cookie_prefix = '%s';\n", $S{cookie_prefix};
- $common .= sprintf "age_ratings = [ %s ];\n", join ',', map !defined $_ ? -1 : $_, @{$S{age_ratings}};
+ $common .= sprintf "age_ratings = [ %s ];\n", join ',', map @{$S{age_ratings}};
$common .= sprintf "languages = [ %s ];\n", join ', ', map qq{"$_"}, @{$S{languages}};
$common .= sprintf "platforms = [ %s ];\n", join ', ', map qq{"$_"}, @{$S{platforms}};
$common .= sprintf "media = [ %s ];\n", join ', ', map qq{"$_"}, sort keys %{$S{media}};
diff --git a/util/updates/update_2.16.sql b/util/updates/update_2.16.sql
new file mode 100644
index 00000000..8ffbd6ae
--- /dev/null
+++ b/util/updates/update_2.16.sql
@@ -0,0 +1,6 @@
+
+-- remove the NOT NULL from rr.minage and use -1 when unknown
+UPDATE releases_rev SET minage = -1 WHERE minage IS NULL;
+ALTER TABLE releases_rev ALTER COLUMN minage SET DEFAULT -1;
+ALTER TABLE releases_rev ALTER COLUMN minage DROP NOT NULL;
+