Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Database upgrade issue #1

Open
Tony---Zhang opened this issue Oct 29, 2018 · 0 comments
Open

Database upgrade issue #1

Tony---Zhang opened this issue Oct 29, 2018 · 0 comments

Comments

@Tony---Zhang
Copy link
Owner

Tony---Zhang commented Oct 29, 2018

PushIOManager database upgrade issue

In version 6.38.1, push is is supported for message center cache
It added two new tables(InboxMessage & FormLink) to support this feature. This feature is great, but what a pity, they forget to do database migration.

If you upgrade your sdk version to this new version, you can't fetch any messages from message center because no data in the two tables.

Here are the best way to solve this problem:

  1. Upgrade their database from version 1 to version 2
  2. Add two lines following to public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) method in PIODBStore
db.execSQL("CREATE TABLE InboxMessage (id TEXT PRIMARY KEY NOT NULL, subject TEXT, message TEXT, icon_url TEXT, message_center_name TEXT, deeplink_url TEXT, richmessage_html TEXT, richmessage_url TEXT, sent_ts TEXT, expiry_ts TEXT, user_id TEXT, device_id TEXT, expiry_datetime TEXT, fetch_datetime TEXT)");
db.execSQL("CREATE TABLE FormLink (messageID TEXT PRIMARY KEY REFERENCES InboxMessage (id), form_link TEXT, expiry_datetime TEXT)");

What's more

If you are using 6.38.1 right now, here are some hack code to do this

Hack code

You need to call

PushIODBStoreRepo(context).createCacheTables()

After you registerApp in your database

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant