-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1057 from gobitfly/BEDS-397/add_ts_col_to_notific…
…ation_history_tables Beds 397/add ts col to notification history tables
- Loading branch information
Showing
2 changed files
with
41 additions
and
9 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
...ns/db/migrations/postgres/20241031105829_add_ts_column_to_notification_history_tables.sql
This file contains 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,26 @@ | ||
-- +goose Up | ||
-- +goose StatementBegin | ||
SELECT 'add ts column to notification history tables'; | ||
ALTER TABLE users_val_dashboards_notifications_history ADD COLUMN IF NOT EXISTS ts TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP; | ||
CREATE INDEX IF NOT EXISTS idx_user_id_ts_dashboard_id_group_id_event_type ON users_val_dashboards_notifications_history (user_id, ts, dashboard_id, group_id, event_type); | ||
ALTER TABLE machine_notifications_history ADD COLUMN IF NOT EXISTS ts TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP; | ||
CREATE INDEX IF NOT EXISTS idx_user_id_ts_machine_id_machine_name_event_type ON machine_notifications_history (user_id, ts, machine_id, machine_name, event_type); | ||
ALTER TABLE client_notifications_history ADD COLUMN IF NOT EXISTS ts TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP; | ||
CREATE INDEX IF NOT EXISTS idx_user_id_ts_client ON client_notifications_history (user_id, ts, client); | ||
ALTER TABLE network_notifications_history ADD COLUMN IF NOT EXISTS ts TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP; | ||
CREATE INDEX IF NOT EXISTS idx_user_id_epoch_network_event_type ON network_notifications_history (user_id, epoch, network, event_type); | ||
|
||
-- +goose StatementEnd | ||
|
||
-- +goose Down | ||
-- +goose StatementBegin | ||
SELECT 'remove ts column from notification history tables'; | ||
ALTER TABLE users_val_dashboards_notifications_history DROP COLUMN IF EXISTS ts; | ||
DROP INDEX IF EXISTS idx_user_id_ts_dashboard_id_group_id_event_type; | ||
ALTER TABLE machine_notifications_history DROP COLUMN IF EXISTS ts; | ||
DROP INDEX IF EXISTS idx_user_id_ts_machine_id_machine_name_event_type; | ||
ALTER TABLE client_notifications_history DROP COLUMN IF EXISTS ts; | ||
DROP INDEX IF EXISTS idx_user_id_ts_client; | ||
ALTER TABLE network_notifications_history DROP COLUMN IF EXISTS ts; | ||
DROP INDEX IF EXISTS idx_user_id_epoch_network_event_type; | ||
-- +goose StatementEnd |
This file contains 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