简体   繁体   English

在将新数据保存到新添加的列中之后,Sugar Orm只是返回默认值(升级Sugar Orm)

[英]Sugar Orm just return the default value after saving new data in the new added column(upgrading Sugar Orm)

I want to add a new column anotherValue to my table AnotherTable . 我想向表AnotherTable添加新列anotherValue

I have read this related question and the SugarORM documentation, but when I save new data, and want to get anotherValue later, it just returns 0. 我已经阅读了这个相关问题和SugarORM文档,但是当我保存新数据并想在以后获取anotherValue ,它仅返回0。

sql截图

The datatype needs to be INT , not integer , and you need the COLUMN keyword: 数据类型必须是INT ,而不是integer ,并且您需要COLUMN关键字:

ALTER TABLE another_table ADD COLUMN another_value INT;

I actually wrote the (accepted) answer you linked to, I suggest you follow it more closely! 我实际上写了您链接的(接受的)答案,建议您更仔细地遵循它!

If you're still having trouble, please turn on SugarORM logging and post what is output when you save & load data. 如果仍然遇到问题,请打开SugarORM日志记录并发布保存和加载数据时的输出。 Additionally, try using a table & column name without underscore, to rule out SugarORM's name conversion causing issues. 此外,请尝试使用不带下划线的表和列名称,以排除SugarORM的名称转换引起的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM