feat: simplify SOP to immediate-effect configuration

This commit is contained in:
Eric 1549169735@qq.com
2026-08-18 16:27:02 +08:00
parent c5ab886b70
commit 8de48fb05e
150 changed files with 6764 additions and 1626 deletions

View File

@@ -0,0 +1,18 @@
CREATE TABLE scenario_rules (
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
tenant_id BIGINT UNSIGNED NOT NULL,
scenario_id BIGINT UNSIGNED NOT NULL,
rule_key VARCHAR(64) NOT NULL,
name VARCHAR(128) NOT NULL,
`condition` JSON NOT NULL,
actions JSON NOT NULL,
priority INT NOT NULL DEFAULT 0,
status VARCHAR(24) NOT NULL DEFAULT 'active',
created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
updated_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),
PRIMARY KEY (id),
UNIQUE KEY uk_scenario_rules_key (scenario_id, rule_key),
KEY idx_scenario_rules_active (tenant_id, scenario_id, status, priority),
CONSTRAINT fk_scenario_rules_tenant FOREIGN KEY (tenant_id) REFERENCES tenants(id),
CONSTRAINT fk_scenario_rules_scenario FOREIGN KEY (scenario_id) REFERENCES scenarios(id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;