-
Notifications
You must be signed in to change notification settings - Fork 1
[HOTE-1125] feat: create order_status_reminder table #343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
lewisbirks
merged 6 commits into
NHSDigital:main
from
iichr:feature/hote-1125/order-status-reminder-table
Apr 15, 2026
+44
−0
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
fe20c75
feat: add order_status_reminder table and seed some sample data
iichr 9cbe327
fix: use explicity pk on conflict in seed data for order status remin…
iichr dfd95ec
feat: move to enum and renumber migration
iichr 3070029
feat: remove order status reminder seeded data
iichr 7063930
feat: rm redundant index on order_status_reminder table
iichr adfbfbd
Merge branch 'main' into feature/hote-1125/order-status-reminder-table
lewisbirks File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
database/migrations/000009_add_order_status_reminder_table.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| -- +goose Up | ||
| CREATE TYPE reminder_status AS ENUM ( | ||
| 'SCHEDULED', | ||
| 'QUEUED', | ||
| 'FAILED', | ||
| 'CANCELLED' | ||
| ); | ||
|
iichr marked this conversation as resolved.
|
||
|
|
||
| CREATE TABLE IF NOT EXISTS order_status_reminder | ||
| ( | ||
| reminder_id uuid PRIMARY KEY DEFAULT gen_random_uuid(), | ||
| order_uid uuid NOT NULL REFERENCES test_order (order_uid) ON DELETE CASCADE, | ||
| trigger_status varchar(50) NOT NULL REFERENCES status_type (status_code), | ||
| reminder_number smallint NOT NULL CHECK (reminder_number >= 1), | ||
| status reminder_status NOT NULL, | ||
| triggered_at timestamp with time zone NOT NULL, | ||
| sent_at timestamp with time zone, | ||
| created_at timestamp with time zone NOT NULL DEFAULT current_timestamp, | ||
| CONSTRAINT uq_order_status_reminder | ||
| UNIQUE (order_uid, trigger_status, reminder_number) | ||
| ); | ||
|
|
||
| CREATE INDEX IF NOT EXISTS idx_order_status_reminder_status_triggered_at | ||
| ON order_status_reminder (status, triggered_at); | ||
|
|
||
|
|
||
| -- +goose Down | ||
| DROP INDEX IF EXISTS idx_order_status_reminder_status_triggered_at; | ||
| DROP TABLE IF EXISTS order_status_reminder; | ||
| DROP TYPE IF EXISTS reminder_status; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.