| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.ResultSet;
- import java.sql.Statement;
- /** Ensure lobster_execution_config exists and seed company 338 defaults. */
- public class ApplyLobsterExecutionConfig {
- private static final String URL = "jdbc:mysql://cq-cdb-8fjmemkb.sql.tencentcdb.com:27220/ylrz_saas"
- + "?useSSL=false&serverTimezone=GMT%2B8&allowMultiQueries=true";
- private static final String USER = "root";
- private static final String PWD = "Ylrz_1q2w3e4r5t6y";
- private static final String DDL =
- "CREATE TABLE IF NOT EXISTS `lobster_execution_config` ("
- + "`id` bigint NOT NULL AUTO_INCREMENT,"
- + "`company_id` bigint NOT NULL,"
- + "`default_execution_mode` varchar(16) NOT NULL DEFAULT 'HYBRID',"
- + "`auto_start_instance_on_tag` tinyint NOT NULL DEFAULT 0,"
- + "`quality_gate_enabled` tinyint NOT NULL DEFAULT 1,"
- + "`quality_pass_score_percent` int NOT NULL DEFAULT 75,"
- + "`quality_target_score_percent` int NOT NULL DEFAULT 75,"
- + "`quality_min_node_score_percent` int NOT NULL DEFAULT 60,"
- + "`quality_min_e2e_avg_score_percent` int NOT NULL DEFAULT 75,"
- + "`quality_multiturn_min_avg_score_percent` int NOT NULL DEFAULT 45,"
- + "`message_dedup_enabled` tinyint NOT NULL DEFAULT 1,"
- + "`message_dedup_exact_window_size` int NOT NULL DEFAULT 5,"
- + "`message_dedup_semantic_threshold` decimal(4,2) NOT NULL DEFAULT 0.85,"
- + "`message_dedup_window_duration_seconds` int NOT NULL DEFAULT 300,"
- + "`create_by` varchar(64) DEFAULT NULL,"
- + "`create_time` datetime DEFAULT CURRENT_TIMESTAMP,"
- + "`update_by` varchar(64) DEFAULT NULL,"
- + "`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,"
- + "PRIMARY KEY (`id`),"
- + "UNIQUE KEY `uk_company_id` (`company_id`)"
- + ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4";
- public static void main(String[] args) throws Exception {
- try (Connection c = DriverManager.getConnection(URL, USER, PWD);
- Statement st = c.createStatement()) {
- st.execute(DDL);
- st.execute("INSERT IGNORE INTO lobster_execution_config (company_id) VALUES (338)");
- try (ResultSet rs = st.executeQuery(
- "SELECT COUNT(*) FROM information_schema.TABLES WHERE TABLE_SCHEMA='ylrz_saas'"
- + " AND TABLE_NAME='lobster_execution_config'")) {
- rs.next();
- System.out.println("lobster_execution_config exists: " + (rs.getInt(1) > 0));
- }
- try (ResultSet rs = st.executeQuery(
- "SELECT company_id FROM lobster_execution_config WHERE company_id=338")) {
- System.out.println("company 338 row: " + (rs.next() ? "OK" : "MISSING"));
- }
- }
- }
- }
|