INSERT INTO app.model_config( id, name, provider, base_url, model_id, api_key_ciphertext, api_key_hint, key_version, config_json, capabilities_json, enabled, is_default, created_by) VALUES ( #{model.id, typeHandler=tech.easyflow.manuagent.typehandler.UuidTypeHandler}, #{model.name}, #{model.provider}, #{model.baseUrl}, #{model.modelId}, #{model.apiKeyCiphertext}, #{model.apiKeyHint}, #{model.keyVersion}, #{model.configJson, jdbcType=OTHER, typeHandler=tech.easyflow.manuagent.typehandler.JsonbStringTypeHandler}, #{model.capabilitiesJson, jdbcType=OTHER, typeHandler=tech.easyflow.manuagent.typehandler.JsonbStringTypeHandler}, COALESCE(#{model.enabled}, TRUE), COALESCE(#{model.defaultModel}, FALSE), #{model.createdBy, typeHandler=tech.easyflow.manuagent.typehandler.UuidTypeHandler}) UPDATE app.model_config SET name = #{model.name}, base_url = #{model.baseUrl}, model_id = #{model.modelId}, config_json = #{model.configJson, jdbcType=OTHER, typeHandler=tech.easyflow.manuagent.typehandler.JsonbStringTypeHandler}, capabilities_json = #{model.capabilitiesJson, jdbcType=OTHER, typeHandler=tech.easyflow.manuagent.typehandler.JsonbStringTypeHandler}, api_key_ciphertext = #{model.apiKeyCiphertext}, api_key_hint = #{model.apiKeyHint}, key_version = #{model.keyVersion}, updated_at = CURRENT_TIMESTAMP WHERE id = #{model.id, typeHandler=tech.easyflow.manuagent.typehandler.UuidTypeHandler} UPDATE app.model_config SET is_default = FALSE WHERE is_default UPDATE app.model_config SET is_default = TRUE, updated_at = CURRENT_TIMESTAMP WHERE id = #{id, typeHandler=tech.easyflow.manuagent.typehandler.UuidTypeHandler} UPDATE app.model_config SET enabled = #{enabled}, updated_at = CURRENT_TIMESTAMP WHERE id = #{id, typeHandler=tech.easyflow.manuagent.typehandler.UuidTypeHandler} DELETE FROM app.model_config WHERE id = #{id, typeHandler=tech.easyflow.manuagent.typehandler.UuidTypeHandler}