-
-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support trigger migrations #3134
Conversation
fdca981
to
222c3a6
Compare
As metadata changes, search continues to work.
222c3a6
to
0299f2e
Compare
1fc5431
to
be64c37
Compare
be93903
to
44ef928
Compare
Previously, triggers lived only in a particular migration file. With this change, code for the triggers resides in the model, and their lifecycle is managed through normal Django migrations.
4594de3
to
7472383
Compare
7472383
to
8df408e
Compare
- do not COALESCE columns that cannot be NULL - do not bring bookwyrm_book to author names JOIN - add comments documenting the four steps
fwiw, I think it might be a good idea to delay merging this until after having tagged the next release. I’m completely fine with that if you agree it makes sense. |
I agree! I think I'm going to make a release tomorrow morning with just what's already merged unless you think there's anything that should get in under the wire |
Only #3096 comes to mind (very optional, just to get it out there?; but I didn’t quite understand what it fixes, so I have no technical opinion). Current main sounds great! |
I considered that one and decided to wait because I have zero recollection of why I had it set to the current way, but I know I did it on purpose, and I don't want to have to re-debug it tomorrow. But another day, I will have the willpower to do so 😆 |
💯
Thank you for preparing this release.
|
Conflicts: requirements.txt
8bdb0df
to
cceccd1
Compare
These are tests I missed when first writing trigger tests in test_book_search.py.
author.search_vector
, which is never usedauthor_search_vector_trigger
via Author.Meta.triggersauthor_search_vector_trigger
, add missing WHERE clausesearch_vector_trigger
via Book.Meta.triggersbook_authors_search_vector_trigger
to executeThis PR uses django-pgtrigger to define triggers as part of model metadata. With this, Django's migration mechanism can be used to keep track of changes.
Done:
In a later PR:
migrate trigger on bookwyrm_book_authors table
(pgtriggers docs say the latter probably requires giving
Book.authors
its own "through" table, which we need anyway for things like Multiple Types of Authors #1120. But that's a more pervasive change, and I don't believe it belongs in this PR.)Also, about this trigger, see last commit.)