OpenMetadata/bootstrap/sql/migrations/native/1.12.0/mysql/schemaChanges.sql
Sriharsha Chintalapani 69ef1371bc
Rules library (#24748)
* Add DQ Rules Library

* Add DQ Rules Library - Add Tests and enable testDefinitions through APIs to list

* Add DQ Rules Library - Add Tests and enable testDefinitions through APIs to list

* Add DQ Rules Library - Add Tests and enable testDefinitions through APIs to list

* Update generated TypeScript types

* Add DQ Rules Library - Add Tests and enable testDefinitions through APIs to list

* Add DQ Rules Library - Add Tests and enable testDefinitions through APIs to list

* Update generated TypeScript types

* Refactor tests to use toStrictEqual for string comparisons and improve consistency

- Updated various test files to replace `toBe` with `toStrictEqual` for string assertions in ImportStatus, SummaryCard, TabsLabel, and others.
- Enhanced regex tests to ensure accurate validation of entity names and tags.
- Added new translations for test platform warnings in en-us.json.
- Improved utility tests for alerts, authentication, CSV handling, and task messages to use `toEqual` for better clarity.

* Refactor TestDefinitionForm and TestDefinitionList components to use updated API methods and improve SQL expression handling

* Enhance TestDefinitionList component with permission checks for edit and delete actions, and update tests to reflect changes in permission handling

* Remove debug log from handleSubmit in TestDefinitionForm component

* Add permission loading state and enhance permission handling in TestDefinitionList component

* Update generated TypeScript types

* Update generated TypeScript types

* Update generated TypeScript types

* fix build failure

* Revert "Update generated TypeScript types"

This reverts commit 67b062216f.

* Enhance TestDefinitionForm and TestDefinitionList components with improved UI and pagination handling

* fix: update RulesLibrary tests and enhance TestDefinitionForm styling

* fix: Enhance TestDefinitionForm with error handling and improved UX

* fix: Update test definition handling and improve rendering in TestDefinitionList

* fix: Refactor TestDefinitionPermissions tests for improved permission checks and API context handling

* fix: Update system test definition retrieval to use findLast for improved accuracy

* feat: Add end-to-end tests for Rules Library and Test Definition Permissions

* fix: Update edit button visibility check to use beDisabled for better clarity

* fix: Refactor response handling in TestDefinitionPermissions tests for improved reliability

* move migrations execution order

* fix: remove existing columns

* style: remove migration extra line break

* chore: fix migration

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Shailesh Parmar <shailesh.parmar.webdev@gmail.com>
Co-authored-by: TeddyCr <teddy.crepineau@gmail.com>
2026-01-14 08:12:30 +01:00

52 lines
2.2 KiB
SQL

-- Update ApplicationBotRole to include Trigger operation
UPDATE policy_entity
SET json = JSON_ARRAY_APPEND(json, '$.rules[0].operations', 'Trigger')
WHERE name = 'ApplicationBotPolicy'
AND JSON_EXTRACT(json, '$.rules[0].operations') IS NOT NULL
AND NOT JSON_CONTAINS(JSON_EXTRACT(json, '$.rules[0].operations'), '"Trigger"');
-- Create table for persisted audit log events
CREATE TABLE IF NOT EXISTS audit_log_event (
id BIGINT NOT NULL AUTO_INCREMENT,
change_event_id CHAR(36) NOT NULL,
event_ts BIGINT NOT NULL,
event_type VARCHAR(32) NOT NULL,
user_name VARCHAR(256) DEFAULT NULL,
actor_type VARCHAR(32) DEFAULT 'USER',
impersonated_by VARCHAR(256) DEFAULT NULL,
service_name VARCHAR(256) DEFAULT NULL,
entity_type VARCHAR(128) DEFAULT NULL,
entity_id CHAR(36) DEFAULT NULL,
entity_fqn VARCHAR(768) DEFAULT NULL,
entity_fqn_hash VARCHAR(768) CHARACTER SET ascii COLLATE ascii_bin DEFAULT NULL,
event_json LONGTEXT NOT NULL,
created_at BIGINT DEFAULT (UNIX_TIMESTAMP(CURRENT_TIMESTAMP(3)) * 1000),
PRIMARY KEY (id),
UNIQUE KEY idx_audit_log_event_change_event_id (change_event_id),
KEY idx_audit_log_event_ts (event_ts DESC),
KEY idx_audit_log_event_user_ts (user_name, event_ts DESC),
KEY idx_audit_log_event_entity_hash_ts (entity_fqn_hash, event_ts DESC),
KEY idx_audit_log_actor_type_ts (actor_type, event_ts DESC),
KEY idx_audit_log_service_name_ts (service_name, event_ts DESC),
KEY idx_audit_log_created_at (created_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- Add enabled field to test_definition table for Rules Library feature
-- This allows administrators to enable/disable test definitions in the rules library
-- Add virtual column for enabled field
-- CAST is needed to convert JSON boolean (true/false) to TINYINT (1/0)
ALTER TABLE test_definition
ADD COLUMN enabled TINYINT(1)
GENERATED ALWAYS AS (COALESCE(CAST(json_extract(json, '$.enabled') AS UNSIGNED), 1))
VIRTUAL;
-- Add index for filtering enabled/disabled test definitions
CREATE INDEX idx_test_definition_enabled ON test_definition(enabled);
-- Set all existing test definitions to enabled by default
UPDATE test_definition
SET json = JSON_SET(json, '$.enabled', true)
WHERE json_extract(json, '$.enabled') IS NULL;