summaryrefslogtreecommitdiff
path: root/lib/Multi/APIDump.pm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2019-06-26 11:19:52 +0200
committerYorhel <git@yorhel.nl>2019-06-26 11:34:30 +0200
commit4d67310a2cb148925b6f8ba96a4fade124e83854 (patch)
tree824fc08cafa2812b126049c5ff85cd932aaea310 /lib/Multi/APIDump.pm
parent940c8dc80bcfbd4dea0f286032b00873e31daac4 (diff)
Tags: Split "meta" field into "searchable" and "applicable"
As discussed in https://vndb.org/t12507 TODO: - Same conversion for traits - Re-add mod ability to delete all votes for a particular tag?
Diffstat (limited to 'lib/Multi/APIDump.pm')
-rw-r--r--lib/Multi/APIDump.pm6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Multi/APIDump.pm b/lib/Multi/APIDump.pm
index c84c3d1c..28e944ca 100644
--- a/lib/Multi/APIDump.pm
+++ b/lib/Multi/APIDump.pm
@@ -20,7 +20,7 @@ sub run {
sub tags_gen {
# The subqueries are kinda ugly, but it's convenient to have everything in a single query.
pg_cmd q|
- SELECT id, name, description, meta, c_items AS vns, cat,
+ SELECT id, name, description, searchable, applicable, c_items AS vns, cat,
(SELECT string_agg(alias,'$$$-$$$') FROM tags_aliases where tag = id) AS aliases,
(SELECT string_agg(parent::text, ',') FROM tags_parents WHERE tag = id) AS parents
FROM tags WHERE state = 2
@@ -31,7 +31,9 @@ sub tags_gen {
my @res = $res->rowsAsHashes;
for(@res) {
$_->{id} *= 1;
- $_->{meta} = $_->{meta} eq 't' ? JSON::XS::true : JSON::XS::false;
+ $_->{meta} = $_->{searchable} ne 't' ? JSON::XS::true : JSON::XS::false; # For backwards compat
+ $_->{searchable} = $_->{searchable} eq 't' ? JSON::XS::true : JSON::XS::false;
+ $_->{applicable} = $_->{applicable} eq 't' ? JSON::XS::true : JSON::XS::false;
$_->{vns} *= 1;
$_->{aliases} = [ split /\$\$\$-\$\$\$/, ($_->{aliases}||'') ];
$_->{parents} = [ map $_*1, split /,/, ($_->{parents}||'') ];