2024-10-03 11:00:29 +02:00
|
|
|
-- Clean dangling workflows not removed after test connection
|
2024-10-10 19:25:11 +05:30
|
|
|
truncate automations_workflow;
|
|
|
|
|
|
|
|
-- App Data Store
|
|
|
|
CREATE TABLE IF NOT EXISTS apps_data_store (
|
|
|
|
identifier VARCHAR(256) NOT NULL,
|
|
|
|
type VARCHAR(256) NOT NULL,
|
|
|
|
json JSON NOT NULL
|
2024-10-31 00:25:51 +05:30
|
|
|
);
|
|
|
|
|
|
|
|
-- Add the source column to the consumers_dlq table
|
2024-10-31 14:10:19 +05:30
|
|
|
ALTER TABLE consumers_dlq ADD COLUMN source VARCHAR(255);
|
2024-10-31 00:25:51 +05:30
|
|
|
|
|
|
|
-- Create an index on the source column in the consumers_dlq table
|
2024-11-08 17:17:16 +05:30
|
|
|
CREATE INDEX idx_consumers_dlq_source ON consumers_dlq (source);
|
|
|
|
|
2024-11-11 14:27:46 +05:30
|
|
|
-- Data Insight charts: add metrics field
|
|
|
|
UPDATE
|
|
|
|
di_chart_entity
|
|
|
|
SET
|
|
|
|
json = jsonb_set(
|
|
|
|
json #- '{chartDetails,formula}' #- '{chartDetails,filter}' #- '{chartDetails,function}' #- '{chartDetails,field}' #- '{chartDetails,treeFilter}',
|
|
|
|
'{chartDetails,metrics}',
|
|
|
|
jsonb_build_array(
|
|
|
|
jsonb_strip_nulls(
|
|
|
|
jsonb_build_object(
|
|
|
|
'formula', json -> 'chartDetails' -> 'formula',
|
|
|
|
'filter', json -> 'chartDetails' -> 'filter',
|
|
|
|
'function', json -> 'chartDetails' -> 'function',
|
|
|
|
'field', json -> 'chartDetails' -> 'field',
|
|
|
|
'treeFilter', json -> 'chartDetails' -> 'treeFilter'
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
WHERE
|
|
|
|
json -> 'chartDetails' -> 'type' = '"LineChart"'
|
|
|
|
and json -> 'chartDetails' -> 'metrics' is null;
|
|
|
|
|
|
|
|
|
2024-11-08 17:17:16 +05:30
|
|
|
-- Rename 'offset' to 'currentOffset' and add 'startingOffset'
|
|
|
|
UPDATE change_event_consumers
|
|
|
|
SET json = jsonb_set(
|
|
|
|
jsonb_set(json, '{currentOffset}', json -> 'offset'),
|
|
|
|
'{startingOffset}', json -> 'offset'
|
|
|
|
)
|
|
|
|
WHERE json -> 'offset' IS NOT NULL
|
|
|
|
AND jsonSchema = 'eventSubscriptionOffset';
|
|
|
|
|
|
|
|
|
|
|
|
-- Create table successful_sent_change_events for storing successfully sent events per alert
|
|
|
|
CREATE TABLE IF NOT EXISTS successful_sent_change_events (
|
|
|
|
id VARCHAR(36) PRIMARY KEY,
|
|
|
|
change_event_id VARCHAR(36) NOT NULL,
|
|
|
|
event_subscription_id VARCHAR(36) NOT NULL,
|
|
|
|
json jsonb NOT NULL,
|
|
|
|
timestamp BIGINT NOT NULL
|
|
|
|
);
|
|
|
|
|
|
|
|
-- Create an index on the event_subscription_id column in the successful_sent_change_events table
|
2024-11-11 14:27:46 +05:30
|
|
|
CREATE INDEX idx_event_subscription_id ON successful_sent_change_events (event_subscription_id);
|
|
|
|
|