summaryrefslogtreecommitdiff
path: root/lib/VNDB/DB/Tags.pm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2015-10-17 17:05:50 +0200
committerYorhel <git@yorhel.nl>2015-10-17 17:20:41 +0200
commit718f4d0258049aa92f229c08d5ec7204dae3ffa6 (patch)
treefc45906cbc145e85e7954671da10d7dbbab9dfbc /lib/VNDB/DB/Tags.pm
parenteed1eced579e022135f98f3f733ecab88e3b6b6e (diff)
SQL: Fix all browsing queries to use the new schema
This basically makes VNDB browsable again, but editing entries is still broken. I split off the get-old-revision functionality from the db*Get() methods into db*GetRev(). This split makes sense even with the old SQL schema: db*Get() had to special-case some joins/filters when fetching an older revision, and none of the other filters would work in that case. This split does cause some code duplication in that all db*GetRev() methods look very much alike, and that the columns they fetch is almost identical to the db*Get() methods. Not sure yet how to avoid the duplication elegantly. I didn't do a whole lot of query optimization yet (most issues require extra indices, I'll investigate later which indices will make a big difference), but I did fix some low hanging fruit whenever I encountered something. I don't think I've worsened anything, performance-wise.
Diffstat (limited to 'lib/VNDB/DB/Tags.pm')
-rw-r--r--lib/VNDB/DB/Tags.pm6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/VNDB/DB/Tags.pm b/lib/VNDB/DB/Tags.pm
index 37411a62..f3c901ab 100644
--- a/lib/VNDB/DB/Tags.pm
+++ b/lib/VNDB/DB/Tags.pm
@@ -184,11 +184,11 @@ sub dbTagLinks {
my @select = (
qw|tv.tag tv.vid tv.uid tv.vote tv.spoiler tv.ignore|, "EXTRACT('epoch' from tv.date) AS date",
- $o{what} =~ /details/ ? (qw|vr.title u.username t.name|) : (),
+ $o{what} =~ /details/ ? (qw|v.title u.username t.name|) : (),
);
my @join = $o{what} =~ /details/ ? (
- 'JOIN vn v ON v.id = tv.vid JOIN vn_rev vr ON vr.id = v.latest',
+ 'JOIN vn v ON v.id = tv.vid',
'JOIN users u ON u.id = tv.uid',
'JOIN tags t ON t.id = tv.tag'
) : ();
@@ -196,7 +196,7 @@ sub dbTagLinks {
my $order = !$o{sort} ? '' : 'ORDER BY '.{
username => 'u.username',
date => 'tv.date',
- title => 'vr.title',
+ title => 'v.title',
tag => 't.name',
}->{$o{sort}}.($o{reverse} ? ' DESC' : ' ASC');