Enforce NOT NULL constraint on notification_status#4908
Open
DilwoarH wants to merge 2 commits into
Open
Conversation
…nd create unique index on notifications
8fce946 to
e9e818f
Compare
81f9491 to
661c1ca
Compare
spatel033
reviewed
Jul 8, 2026
| ) | ||
| op.execute("ALTER TABLE notifications ALTER COLUMN notification_status SET NOT NULL;") | ||
|
|
||
| with op.get_context().autocommit_block(): |
Contributor
There was a problem hiding this comment.
Notifications table only handles INSERT and UPDATE operations, PostgreSQL’s default replica identity already includes all required columns (template_id, notification_status, created_at) in the wal2json stream using our existing id primary key.
The DELETE operations are for archiving notifications to notification_history where notification_status counts must remain unchanged, so our aggregator can simply ignore all delete logs.
I think in this case we can skip this migration and it also saves write overhead on notifications table.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Enforce NOT NULL constraint on notification_status
Why
Without NOT NULL - we cannot create an index for notification_status column