summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2020-08-16 15:10:11 +0200
committerYorhel <git@yorhel.nl>2020-08-16 15:15:25 +0200
commitb6e4d4be26284158a09baff739b2c324b1d653d3 (patch)
tree180d95780e4c87d01a7e5b1610ca22d82520f1a8 /util
parent1c23fdb2ef7acebabf069e8bb9a576805d89f1b6 (diff)
Reports: Get rid of report_type, split vndbid/num + allow reporting reviews and comments
rtype is not necessary, the DB identifier is sufficient. The separate type column was supposed to simplify DB lookups (but that's all consolidated in a single function anyway, so it didn't help much) and easy filtering depending on what mods have access to (but there is no such filter, and even with vndbids that should be easy enough). Converting the object ID into a vndbid + num should make it easier to correlate reports if necessary.
Diffstat (limited to 'util')
-rw-r--r--util/updates/wip-reviews.sql7
1 files changed, 7 insertions, 0 deletions
diff --git a/util/updates/wip-reviews.sql b/util/updates/wip-reviews.sql
index 6ce5182d..677eb7b6 100644
--- a/util/updates/wip-reviews.sql
+++ b/util/updates/wip-reviews.sql
@@ -1,3 +1,10 @@
+ALTER TABLE reports ADD COLUMN objectnum integer;
+UPDATE reports SET objectnum = regexp_replace(object, '^.+\.([0-9]+)$', '\1')::integer WHERE object LIKE '%.%';
+ALTER TABLE reports ALTER COLUMN object TYPE vndbid USING regexp_replace(object, '\.[0-9]+$','')::vndbid;
+ALTER TABLE reports DROP COLUMN rtype;
+DROP TYPE report_type;
+
+
-- WIP: The modifications in this file are not final and haven't been integrated in sql/ yet.
CREATE SEQUENCE reviews_seq;