mirror of
https://github.com/standardebooks/web.git
synced 2025-07-13 10:02:02 -04:00
Rewrite DeleteUnused() queries using new indices
This commit is contained in:
parent
5c8315e6ff
commit
f0bfa7a43b
3 changed files with 13 additions and 13 deletions
|
@ -104,10 +104,10 @@ class Collection{
|
||||||
*/
|
*/
|
||||||
public static function DeleteUnused(): void{
|
public static function DeleteUnused(): void{
|
||||||
Db::Query('
|
Db::Query('
|
||||||
DELETE
|
DELETE c
|
||||||
from Collections
|
from Collections c
|
||||||
where CollectionId not in
|
left join CollectionEbooks ce using (CollectionId)
|
||||||
(select distinct CollectionId from CollectionEbooks)
|
where ce.CollectionId is null
|
||||||
');
|
');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,11 +113,11 @@ class EbookTag extends Tag{
|
||||||
*/
|
*/
|
||||||
public static function DeleteUnused(): void{
|
public static function DeleteUnused(): void{
|
||||||
Db::Query('
|
Db::Query('
|
||||||
DELETE
|
DELETE t
|
||||||
from Tags
|
from Tags t
|
||||||
where Type = ?
|
left join EbookTags et using (TagId)
|
||||||
and TagId not in
|
where t.Type = ?
|
||||||
(select distinct TagId from EbookTags)
|
and et.TagId is null
|
||||||
', [Enums\TagType::Ebook]);
|
', [Enums\TagType::Ebook]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,10 +70,10 @@ class LocSubject{
|
||||||
*/
|
*/
|
||||||
public static function DeleteUnused(): void{
|
public static function DeleteUnused(): void{
|
||||||
Db::Query('
|
Db::Query('
|
||||||
DELETE
|
DELETE ls
|
||||||
from LocSubjects
|
from LocSubjects ls
|
||||||
where LocSubjectId not in
|
left join EbookLocSubjects els using (LocSubjectId)
|
||||||
(select distinct LocSubjectId from EbookLocSubjects)
|
where els.LocSubjectId is null
|
||||||
');
|
');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue