Skip to content

fix: make event_queue.event_id NOT NULL after backfill and writer updates #1824

Description

@coderabbitai

Follow-up: Enforce NOT NULL on event_queue.event_id

The event_id column added to event_queue in #1533 is currently nullable to support a staged rollout and backward compatibility during migration. However, PostgreSQL treats NULL values as distinct, which means the unique constraint event_queue_name_event_id on (name, event_id) does not deduplicate rows where event_id is NULL. This weakens the deduplication guarantee that the PR aims to establish.

Action Required

Once the following conditions are met:

  1. The backfill script (views/044_event_queue_event_id_backfill.sql) has been applied and all existing rows have a non-null event_id.
  2. All writer code paths have been updated to populate event_id with a non-null UUID.

A follow-up migration should be applied:

ALTER TABLE event_queue ALTER COLUMN event_id SET NOT NULL;

This ensures the uniqueness constraint fully enforces deduplication as intended.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions