Repository navigation
Conversation
…from Boolean to Integer
…from Boolean to Integer
…from Boolean to Integer
…from Boolean to Integer
…from Boolean to Integer
…from Boolean to Integer
…from Boolean to Integer
…from Boolean to Integer
|
@zxuexingzhijie 你好,这个 PR 把 ModelConfig.isActive/proxyEnabled 从 Boolean 改为 Integer(#540)。准备好 review 了,方便时帮忙看一下,谢谢! |
…model_config columns to int(11) Signed-off-by: wylovelyi <wylovelyi@users.noreply.github.com>
|
Pushed a follow-up for the existing-deployment migration gap (P2 from review).
Fix: appended an idempotent |
What this PR does
Closes #540 — changes
ModelConfig.isActiveandModelConfig.proxyEnabledfromBooleantoInteger, to stay consistent with sibling fields (isDeleted,isRecall,AgentDatasource.isActive) and to make future DB migration to PostgreSQL easier (PostgreSQL does not auto-cast Integer↔Boolean).Key design decisions
Integer:ModelConfig.isActive(0/1) andproxyEnabled(0/1).Boolean: the REST JSON contract is unchanged, so the frontend is not affected. The translation betweenInteger(DB) andBoolean(API) is done inModelConfigConverter.is_activeandproxy_enabledchanged fromtinyint(1) DEFAULT '0'toint(11) DEFAULT '0'in bothschema.sqlandschema-h2.sql. MyBatis auto-maps the columns toInteger.Files changed
.../entity/ModelConfig.javaisActive/proxyEnabledfield typeBoolean→Integer.../converter/ModelConfigConverter.javaInteger↔Booleantranslation in both directions.../service/impl/ModelConfigDataServiceImpl.javaBoolean.TRUE.equals(...)→!= null && == 1; write1/0.../service/ModelConfigOpsService.javaBoolean.TRUE.equals(Integer)is always false, so an activated config never refreshed the in-memory model on update → changed to!= null && == 1.../mapper/ModelConfigConverterTest.javaInteger(0/1).../service/ModelConfigDataServiceImplTest.javaInteger(0/1)db/schema.sqldb/schema-h2.sqlNotes
ModelConfigOpsServicefix is a real correctness improvement uncovered while migrating the type: withIntegerfields,Boolean.TRUE.equals(integerValue)returnsfalsepermanently, which would silently skip reloading the active model after an update. Worth merging regardless of the type change itself.true/falsepayloads still work.