Skip to content

Add ft service stats db updates#4881

Open
DilwoarH wants to merge 3 commits into
mainfrom
add-ft-service-stats-db-updates
Open

Add ft service stats db updates#4881
DilwoarH wants to merge 3 commits into
mainfrom
add-ft-service-stats-db-updates

Conversation

@DilwoarH

@DilwoarH DilwoarH commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

This pull request introduces several database migrations focused on improving notification tracking and reporting. The main changes include creating a new ft_service_stats table for aggregated notification statistics, enforcing data consistency and indexing on the notifications table, and setting up logical replication support.

Database schema and migration improvements:

Creation of notification statistics table:

  • Added a new ft_service_stats table to store aggregated counts of notification statuses by service, template, notification type, and status. This includes appropriate foreign keys, a unique constraint on the dimension columns, and several indexes to support efficient queries.
  • Updated the current Alembic head to reference the new migration for ft_service_stats.

Notification table indexing and constraints:

  • Enforced NOT NULL on the notification_status column in the notifications table.
  • Created a unique, concurrently indexed combination of id and notification_status for the notifications table, and set it as the replica identity for logical replication.

Logical replication support:

  • Added a migration to create a logical replication slot named notify_dashboard_replication_slot using the wal2json output plugin, with corresponding downgrade logic.

@DilwoarH DilwoarH force-pushed the add-ft-service-stats-db-updates branch 4 times, most recently from 863c080 to b4b9050 Compare June 14, 2026 23:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant