简体   繁体   中英

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 .

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.

sql截图

The datatype needs to be INT , not integer , and you need the COLUMN keyword:

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. Additionally, try using a table & column name without underscore, to rule out SugarORM's name conversion causing issues.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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