Skip to content

Create ft_service_stats table#4910

Open
DilwoarH wants to merge 1 commit into
mainfrom
add-ft-service-stats-db-updates-4
Open

Create ft_service_stats table#4910
DilwoarH wants to merge 1 commit into
mainfrom
add-ft-service-stats-db-updates-4

Conversation

@DilwoarH

@DilwoarH DilwoarH commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

What

Add migration to create ft_service_stats table with relevant indexes

Why

We need the ft_service_stats table to store the count of statuses

@klssmith klssmith left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just making a note of the things we chatted about, one thing we could consider is to use a composite primary key, matching what we do with the existing ft tables, which means the ID column isn't necessary and it will automatically get a unique index.

We also don't want test notifications to show up on the dashboard, so unless we're specifically not writing test notifications to the new table, might need to add a column for key_type so we can filter these out

sa.Column("template_id", postgresql.UUID(as_uuid=True), nullable=False),
sa.Column("notification_type", postgresql.ENUM(name="notification_type", create_type=False), nullable=False),
sa.Column("notification_status", sa.Text(), nullable=False),
sa.Column("date", sa.Date(), nullable=False, server_default=sa.text("CURRENT_DATE")),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is the date in BST, we probably don't want this default since it won't be in BST. It could help avoid confusion or misunderstandings to call the column bst_date too, like we do for ft_notification_status

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@DilwoarH DilwoarH changed the title Create ft_service_stats table [DO NOT MERGE] Create ft_service_stats table Jul 18, 2026
@DilwoarH
DilwoarH force-pushed the add-ft-service-stats-db-updates-4 branch from 76fa3e5 to 6158044 Compare July 22, 2026 09:11
@DilwoarH
DilwoarH changed the base branch from add-ft-service-stats-db-updates-3 to main July 22, 2026 09:11
@DilwoarH DilwoarH changed the title [DO NOT MERGE] Create ft_service_stats table Create ft_service_stats table Jul 22, 2026
@DilwoarH
DilwoarH force-pushed the add-ft-service-stats-db-updates-4 branch from 6158044 to e156f46 Compare July 22, 2026 09:44
This is needed to store daily stats from WAL logs
@DilwoarH
DilwoarH force-pushed the add-ft-service-stats-db-updates-4 branch from e156f46 to 45f3ed4 Compare July 22, 2026 11:35

@klssmith klssmith left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The plan to not write test notifications to this table means we don't need to have a column for key_type, so this is fine to not have that

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.

2 participants