adding new column to existing table
See original GitHub issuehello, this is my class : public class UserInfoDb extends SugarRecord { public boolean isChecked ; public boolean isShowChanges ; public String Packages ;
public UserInfoDb(){
}
} now, i`m trying to add new string to this class like this :
public String TestField ;
i changed db version and create a sql file in asset/sugar_upgrades.
i tried this : alter table user_info_db add test_field TEXT;
also : alter table user_info_db add column test_field TEXT;
also i tried to create new table and copy old table to new table and drop old table too, after that all, seems sugar will do updates but when i`m trying to work with new column i will get this :
Failed to read row 0, column -1 from a CursorWindow which has 1 rows, 4 columns
any idea?
Issue Analytics
- State:
- Created 6 years ago
- Comments:6
Top Results From Across the Web
SQL ALTER TABLE Statement - W3Schools
The ALTER TABLE statement is used to add, delete, or modify columns in an existing table. The ALTER TABLE statement is also used...
Read more >SQL Server ALTER TABLE ADD Column
First, specify the name of the table in which you want to add the new column. · Second, specify the name of the...
Read more >Add Columns to a Table (Database Engine) - SQL Server
Insert columns into a table with Table Designer · In Object Explorer, right-click the table to which you want to add columns and...
Read more >How to Add A New Column to a Table in SQL?
In SQL, create new column using the ALTER TABLE statement. This program helps to add column in SQL. You can also modify, or...
Read more >SQL Server: ALTER TABLE ADD Columns in a Table
You can add columns to an existing table by using the ALTER TABLE statement. ... Use the ALTER TABLE ADD statement to add...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hey, You need to add the new column/field to your class. Also, when you’re simply adding new columns, you’re not supposed to write update scripts. So you should delete that update file. Just add the field to the class and update the db version.
Ohhh awesome then. Good luck. And please close the issue if everything’s working great. 😃