From 50cfb305796d1d115c408feefbe39fddf7615166 Mon Sep 17 00:00:00 2001 From: Yorhel Date: Fri, 17 Dec 2010 14:39:41 +0100 Subject: 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. --- util/jsgen.pl | 2 +- util/updates/update_2.16.sql | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 util/updates/update_2.16.sql (limited to 'util') 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; + -- cgit v1.2.3