Ram Narayan Balaji 1bec15ea39
Feat: #24424 Flowable History Timed Cleanup and Ops Command for cleanup (#24367)
* Flowable History Timed Cleanup and Ops Command for cleanup

* Remove Commented Code

* Update generated TypeScript types

* Fix Migration column name

* Test Cases

* Remove cleanupAll parameter

* cron for default every sunday 12 am

* cron for default every sunday 12 am - 0 0 0 ? * 1

* Move Migrations to 1.11.1

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-12-05 16:35:23 +05:30

65 lines
2.0 KiB
SQL

-- Add Flowable batch processing tables for history cleanup support
CREATE TABLE IF NOT EXISTS flw_ru_batch (
id_ VARCHAR(64) NOT NULL,
rev_ INTEGER,
type_ VARCHAR(64) NOT NULL,
search_key_ VARCHAR(255),
search_key2_ VARCHAR(255),
create_time_ TIMESTAMP(3) NOT NULL,
complete_time_ TIMESTAMP(3),
status_ VARCHAR(255),
batch_doc_id_ VARCHAR(64),
tenant_id_ VARCHAR(255) DEFAULT '',
CONSTRAINT pk_flw_ru_batch PRIMARY KEY (id_)
);
CREATE INDEX idx_flw_ru_batch_type ON flw_ru_batch (type_);
CREATE INDEX idx_flw_ru_batch_search_key ON flw_ru_batch (search_key_);
CREATE INDEX idx_flw_ru_batch_status ON flw_ru_batch (status_);
CREATE TABLE IF NOT EXISTS flw_ru_batch_part (
id_ VARCHAR(64) NOT NULL,
rev_ INTEGER,
batch_id_ VARCHAR(64),
type_ VARCHAR(64) NOT NULL,
scope_id_ VARCHAR(64),
sub_scope_id_ VARCHAR(64),
scope_type_ VARCHAR(64),
search_key_ VARCHAR(255),
search_key2_ VARCHAR(255),
create_time_ TIMESTAMP(3) NOT NULL,
complete_time_ TIMESTAMP(3),
status_ VARCHAR(255),
result_doc_id_ VARCHAR(64),
tenant_id_ VARCHAR(255) DEFAULT '',
CONSTRAINT pk_flw_ru_batch_part PRIMARY KEY (id_)
);
CREATE INDEX idx_flw_ru_batch_part_batch_id ON flw_ru_batch_part (batch_id_);
CREATE INDEX idx_flw_ru_batch_part_type ON flw_ru_batch_part (type_);
CREATE INDEX idx_flw_ru_batch_part_status ON flw_ru_batch_part (status_);
-- Update workflow settings with new history cleanup configuration fields
UPDATE openmetadata_settings
SET json = jsonb_set(
jsonb_set(
jsonb_set(
jsonb_set(
json,
'{historyCleanUpConfiguration,batchSize}',
'1000',
true
),
'{historyCleanUpConfiguration,timeCycleConfig}',
'"0 0 0 ? * 1"',
true
),
'{runTimeCleanUpConfiguration}',
'{}',
true
),
'{runTimeCleanUpConfiguration,batchSize}',
'500',
true
)
WHERE configtype = 'workflowSettings';