forked from retoor/devplacepy
Ensure the notifications column set in init_db like messages and push_registration
notifications was filtered and indexed on user_uid and read without an ensure-block, so a partial first insert could create it with a reduced schema. The block mirrors the messages one and the table joins FILTERED_COLUMNS. idx_notifications_user_read already serves the unread count the push payload now reads. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -200,6 +200,19 @@ def init_db():
|
|||||||
)
|
)
|
||||||
_index(db, "messages", "idx_messages_updated_at", ["updated_at"])
|
_index(db, "messages", "idx_messages_updated_at", ["updated_at"])
|
||||||
_index(db, "messages", "idx_messages_dedupe", ["sender_uid", "client_id"])
|
_index(db, "messages", "idx_messages_dedupe", ["sender_uid", "client_id"])
|
||||||
|
notifications = get_table("notifications")
|
||||||
|
for column, example in (
|
||||||
|
("uid", ""),
|
||||||
|
("user_uid", ""),
|
||||||
|
("type", ""),
|
||||||
|
("message", ""),
|
||||||
|
("related_uid", ""),
|
||||||
|
("target_url", ""),
|
||||||
|
("read", False),
|
||||||
|
("created_at", ""),
|
||||||
|
):
|
||||||
|
if not notifications.has_column(column):
|
||||||
|
notifications.create_column_by_example(column, example)
|
||||||
_index(db, "notifications", "idx_notifications_user", ["user_uid"])
|
_index(db, "notifications", "idx_notifications_user", ["user_uid"])
|
||||||
_index(db, "notifications", "idx_notifications_user_read", ["user_uid", "read"])
|
_index(db, "notifications", "idx_notifications_user_read", ["user_uid", "read"])
|
||||||
push_registration = get_table("push_registration")
|
push_registration = get_table("push_registration")
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "devplacepy"
|
name = "devplacepy"
|
||||||
version = "1.1.30"
|
version = "1.1.31"
|
||||||
description = "DevPlace - The Developer Social Network"
|
description = "DevPlace - The Developer Social Network"
|
||||||
requires-python = ">=3.12"
|
requires-python = ">=3.12"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ from devplacepy.database import get_table, init_db
|
|||||||
|
|
||||||
FILTERED_COLUMNS = {
|
FILTERED_COLUMNS = {
|
||||||
"messages": ("uid", "sender_uid", "receiver_uid", "content", "read", "created_at", "updated_at"),
|
"messages": ("uid", "sender_uid", "receiver_uid", "content", "read", "created_at", "updated_at"),
|
||||||
|
"notifications": ("uid", "user_uid", "type", "message", "related_uid", "target_url", "read", "created_at"),
|
||||||
"workspace_quota_rules": ("uid", "owner_kind", "owner_id", "deleted_at"),
|
"workspace_quota_rules": ("uid", "owner_kind", "owner_id", "deleted_at"),
|
||||||
"workspace_editor_prefs": ("uid", "owner_kind", "owner_id", "deleted_at"),
|
"workspace_editor_prefs": ("uid", "owner_kind", "owner_id", "deleted_at"),
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user