Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
506 views
in Technique[技术] by (71.8m points)

android - Room Migration With Complex Change

I have to migrate my application from one version to another. The changes in my table are a bit complex and I do not know how to migrate them.

I know that if we add a column we can write an Alter query on the table. But my table has 2 changes and I need help in migrating those.

My Exiting Table

String Comment;
String Text;
String Option;
String Type;
String Phone;

My New Table

String Comment;
String Text;
String Option;
String Type;
String Phone;

//NEW COLUMNS

@SerializedName("EtaMessage")
String ETA

@SerializedName("ChipInfoVOs")
List<Info>chipInformation;

How can I write an Alter Query to migrate to this table. It includes a Type Converter. I read about another way to migrate

  • Create a new table
  • Copy existing data to new table
  • Drop Old table
  • Rename new table as old table name

But again, How do I write query for @SerializedName and List type.

Please help, thanks.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...