mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-26 11:31:08 +00:00
Fix JOIN in author_search_vector_trigger
, add missing WHERE clause
This commit is contained in:
parent
416a6caf2d
commit
bcb3a343d4
3 changed files with 4 additions and 5 deletions
|
@ -32,8 +32,8 @@ class Migration(migrations.Migration):
|
|||
trigger=pgtrigger.compiler.Trigger(
|
||||
name="reset_search_vector_on_author_edit",
|
||||
sql=pgtrigger.compiler.UpsertTriggerSql(
|
||||
func="WITH book AS (SELECT bookwyrm_book.id AS row_id FROM bookwyrm_author LEFT OUTER JOIN bookwyrm_book_authors ON bookwyrm_book_authors.id = new.id LEFT OUTER JOIN bookwyrm_book ON bookwyrm_book.id = bookwyrm_book_authors.book_id) UPDATE bookwyrm_book SET search_vector = '' FROM book WHERE id = book.row_id;RETURN NEW;",
|
||||
hash="9c0a472e2bf60e63d593cce49f47972c7b227a00",
|
||||
func="WITH book AS (SELECT bookwyrm_book.id AS row_id FROM bookwyrm_author LEFT OUTER JOIN bookwyrm_book_authors ON bookwyrm_book_authors.author_id = bookwyrm_author.id LEFT OUTER JOIN bookwyrm_book ON bookwyrm_book.id = bookwyrm_book_authors.book_id WHERE bookwyrm_author.id = new.id ) UPDATE bookwyrm_book SET search_vector = '' FROM book WHERE id = book.row_id;RETURN NEW;",
|
||||
hash="abc8ea76fa1bf02a0f56aaae390c1b970bef1278",
|
||||
operation='UPDATE OF "name"',
|
||||
pgid="pgtrigger_reset_search_vector_on_author_edit_a447c",
|
||||
table="bookwyrm_author",
|
||||
|
|
|
@ -81,9 +81,10 @@ class Author(BookDataModel):
|
|||
SELECT bookwyrm_book.id AS row_id
|
||||
FROM bookwyrm_author
|
||||
LEFT OUTER JOIN bookwyrm_book_authors
|
||||
ON bookwyrm_book_authors.id = new.id
|
||||
ON bookwyrm_book_authors.author_id = bookwyrm_author.id
|
||||
LEFT OUTER JOIN bookwyrm_book
|
||||
ON bookwyrm_book.id = bookwyrm_book_authors.book_id
|
||||
WHERE bookwyrm_author.id = new.id
|
||||
)
|
||||
UPDATE bookwyrm_book
|
||||
SET search_vector = ''
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
""" test searching for books """
|
||||
import datetime
|
||||
from unittest import expectedFailure
|
||||
from django.db import connection
|
||||
from django.test import TestCase
|
||||
from django.utils import timezone
|
||||
|
@ -207,7 +206,6 @@ class SearchVectorTriggers(TestCase):
|
|||
self.assertEqual(self.edition, self._search_first("Mozilla"))
|
||||
self.assertEqual(self.edition, self._search_first("Name"))
|
||||
|
||||
@expectedFailure
|
||||
def test_search_after_updated_author_name(self):
|
||||
"""book found under new author name"""
|
||||
self.assertEqual(self.edition, self._search_first("Name"))
|
||||
|
|
Loading…
Reference in a new issue