summaryrefslogtreecommitdiff
path: root/lib/VNDB/DB/Discussions.pm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2020-08-06 16:08:16 +0200
committerYorhel <git@yorhel.nl>2020-08-07 10:39:16 +0200
commitc3a26b56d68c56ee9ffa17900fb1f1a6fcf32e26 (patch)
tree2542e1a94d317f0ae23dd90ccf928e713dbd0deb /lib/VNDB/DB/Discussions.pm
parent4ff57327c4c95652c0634ca97ed5495c037fc16e (diff)
Discussions: Fix handling of user deletion
Which I broke by removing the DEFAULT clause on threads_posts.uid. That column still used the old uid=0 for deleted users rather than the uid=NULL that I was planning to migrate the entire DB to. So while I'm fixing up the threads schema, may as well update this too. There's still a bunch of columns relying on uid=0, but I can fix that later.
Diffstat (limited to 'lib/VNDB/DB/Discussions.pm')
-rw-r--r--lib/VNDB/DB/Discussions.pm6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/VNDB/DB/Discussions.pm b/lib/VNDB/DB/Discussions.pm
index 0cc05303..1de87dd9 100644
--- a/lib/VNDB/DB/Discussions.pm
+++ b/lib/VNDB/DB/Discussions.pm
@@ -48,7 +48,7 @@ sub dbThreadGet {
my @join = (
$o{what} =~ /lastpost/ ? (
'JOIN threads_posts tpl ON tpl.tid = t.id AND tpl.num = t.c_lastnum',
- 'JOIN users ul ON ul.id = tpl.uid'
+ 'LEFT JOIN users ul ON ul.id = tpl.uid'
) : (),
$o{type} && $o{iid} ?
'JOIN threads_boards tb ON tb.tid = t.id' : (),
@@ -97,7 +97,7 @@ sub dbThreadGet {
do { my $idx = $r{ delete $_->{tid} }; $r->[$idx] = { $r->[$idx]->%*, %$_ } } for (@{$self->dbAll(q|
SELECT tpf.tid, EXTRACT('epoch' from tpf.date) AS firstpost_date, !s
FROM threads_posts tpf
- JOIN users uf ON tpf.uid = uf.id
+ LEFT JOIN users uf ON tpf.uid = uf.id
WHERE tpf.num = 1 AND tpf.tid IN(!l)|,
VNWeb::DB::sql_user('uf', 'firstpost_'), [ keys %r ]
)});
@@ -152,7 +152,7 @@ sub dbPostGet {
$o{what} =~ /thread/ ? ('t.title', 't.hidden AS thread_hidden') : (),
);
my @join = (
- $o{what} =~ /user/ ? 'JOIN users u ON u.id = tp.uid' : (),
+ $o{what} =~ /user/ ? 'LEFT JOIN users u ON u.id = tp.uid' : (),
$o{what} =~ /thread/ ? 'JOIN threads t ON t.id = tp.tid' : (),
);