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

110 views Asked by At

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 screenshot

1

There are 1 answers

0
Jake Lee On

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.