Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions database/migrations/000007_add_notification_audit_table.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
-- +goose Up
CREATE TABLE IF NOT EXISTS notification_audit
(
audit_id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
message_reference uuid NOT NULL,
notify_message_id varchar(255),
event_code varchar(50) NOT NULL,
routing_plan_id uuid,
correlation_id uuid NOT NULL,
status varchar(50) NOT NULL,
created_at timestamp with time zone NOT NULL DEFAULT current_timestamp,
CONSTRAINT uq_notification_audit_message_reference_status
UNIQUE (message_reference, status)
);

CREATE INDEX IF NOT EXISTS idx_notification_audit_message_reference_created_at
ON notification_audit (message_reference, created_at);


-- +goose Down
DROP INDEX IF EXISTS idx_notification_audit_message_reference_created_at;
DROP TABLE IF EXISTS notification_audit;
12 changes: 12 additions & 0 deletions database/schema_diagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,18 @@ entity "consent" as consent {
created_at : timestamp
}

entity "notification_audit" as notification_audit {
Comment thread
cptiv2020 marked this conversation as resolved.
**audit_id : uuid**
message_reference : uuid
notify_message_id : varchar(255)
event_code : varchar(50)
routing_plan_id : uuid
correlation_id : uuid
status : varchar(50)
created_at : timestamp
unique(message_reference, status)
}

' Relationships
patient ||--o{ orders : "patient_uid"
supplier ||--o{ orders : "supplier_id"
Expand Down
Loading