feat: add historical data management
This commit is contained in:
5
server/migrations/000013_history_indexes.down.sql
Normal file
5
server/migrations/000013_history_indexes.down.sql
Normal file
@@ -0,0 +1,5 @@
|
||||
DROP INDEX IF EXISTS call_batch_tickets_history_batch_position_idx;
|
||||
DROP INDEX IF EXISTS call_batches_history_session_called_idx;
|
||||
DROP INDEX IF EXISTS queue_tickets_history_project_called_idx;
|
||||
DROP INDEX IF EXISTS queue_tickets_history_session_status_number_idx;
|
||||
DROP INDEX IF EXISTS queue_sessions_history_project_date_idx;
|
||||
14
server/migrations/000013_history_indexes.up.sql
Normal file
14
server/migrations/000013_history_indexes.up.sql
Normal file
@@ -0,0 +1,14 @@
|
||||
CREATE INDEX IF NOT EXISTS queue_sessions_history_project_date_idx
|
||||
ON queue_sessions (project_id, business_date DESC, id);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS queue_tickets_history_session_status_number_idx
|
||||
ON queue_tickets (queue_session_id, status, ticket_number);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS queue_tickets_history_project_called_idx
|
||||
ON queue_tickets (project_id, called_at DESC);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS call_batches_history_session_called_idx
|
||||
ON call_batches (queue_session_id, called_at DESC);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS call_batch_tickets_history_batch_position_idx
|
||||
ON call_batch_tickets (call_batch_id, position);
|
||||
4
server/migrations/000014_history_anonymization.down.sql
Normal file
4
server/migrations/000014_history_anonymization.down.sql
Normal file
@@ -0,0 +1,4 @@
|
||||
DROP INDEX IF EXISTS queue_tickets_history_anonymized_idx;
|
||||
|
||||
ALTER TABLE queue_tickets
|
||||
DROP COLUMN IF EXISTS history_anonymized_at;
|
||||
6
server/migrations/000014_history_anonymization.up.sql
Normal file
6
server/migrations/000014_history_anonymization.up.sql
Normal file
@@ -0,0 +1,6 @@
|
||||
ALTER TABLE queue_tickets
|
||||
ADD COLUMN history_anonymized_at timestamptz;
|
||||
|
||||
CREATE INDEX queue_tickets_history_anonymized_idx
|
||||
ON queue_tickets (history_anonymized_at, id)
|
||||
WHERE history_anonymized_at IS NULL;
|
||||
Reference in New Issue
Block a user