You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During the connection process, if a table field has been added, it is not possible to update the newly added field's data using g.Model(tableName).Data(newData).Update().
#3654
Closed
leavky opened this issue
Jun 20, 2024
· 2 comments
Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
g.Model() is a singleton object and will only initialize the DB object once, so this is not a Bug. If you want to operate the database after updating the fields, you can maintain a gdb object yourself
Go version
go1.21.5
GoFrame version
v2.7.0
Can this bug be reproduced with the latest release?
Option Yes
What did you do?
开启服务,使用
ALTER TABLE tableName ADD COLUMN fieldName TEXT;
为表格添加一个新的字段,然后通过g.Model(tableName ).Where("id", recordId).OmitEmpty().Data(newData).Update()
无法更新数据,但是新增字段后重启服务,使用g.Model(tableName ).Where("id", recordId).OmitEmpty().Data(newData).Update()
就可以更新数据了What did you see happen?
通过
g.Model(tableName ).Where("id", recordId).OmitEmpty().Data(newData).Update()
无法更新数据What did you expect to see?
新增字段后可以通过通过
g.Model(tableName ).Where("id", recordId).OmitEmpty().Data(newData).Update()
更新数据,目前使用执行SQL语句解决了,希望可以修正一下在运行过程中增加了字段也可以更新数据The text was updated successfully, but these errors were encountered: