How to handle “migration” in sqlite databaseHow to list the tables in a SQLite database file that was opened with ATTACH?How to save an Android Activity state using save instance state?Why is the Android emulator so slow? How can we speed up the Android emulator?How do I check in SQLite whether a table exists?Is it possible to insert multiple rows at a time in an SQLite database?Improve INSERT-per-second performance of SQLite?What are the best practices for SQLite on Android?How do I fix android.os.NetworkOnMainThreadException?Android application upgrade without a databaseWhy does my exception handler not trap Android SQLite insert error?
How does the oscilloscope trigger really work?
How to explain to a team that the project they will work for 6 months will 100% fail?
Is the beaming of this score following a vocal practice or it is just outdated and obscuring the beat?
French equivalent of "Make leaps and bounds"
What is the German idiom or expression for when someone is being hypocritical against their own teachings?
Is it really ~648.69 km/s Delta-V to "Land" on the Surface of the Sun?
Could one become a successful researcher by writing some really good papers while being outside academia?
Should I self-publish my novella on Amazon or try my luck getting publishers?
Should I take out a personal loan to pay off credit card debt?
Our group keeps dying during the Lost Mine of Phandelver campaign. What are we doing wrong?
Is TA-ing worth the opportunity cost?
Does it make sense to occupy open space?
Casting Goblin Matron with Plague Engineer on the battlefield
If there were no space agencies, could a person go to space?
LWC: Can I have an expression and a string as a class combination?
How quickly could a country build a tall concrete wall around a city?
Why are the inside diameters of some pipe larger than the stated size?
Look mom! I made my own (Base 10) numeral system!
Why do I need to insert 12 characters to clear this bash command-line?
Infeasibility in mathematical optimization models
Did WWII Japanese soldiers engage in cannibalism of their enemies?
Does this smartphone photo show Mars just below the Sun?
How does The Fools Guild make its money?
Word or idiom defining something barely functional
How to handle “migration” in sqlite database
How to list the tables in a SQLite database file that was opened with ATTACH?How to save an Android Activity state using save instance state?Why is the Android emulator so slow? How can we speed up the Android emulator?How do I check in SQLite whether a table exists?Is it possible to insert multiple rows at a time in an SQLite database?Improve INSERT-per-second performance of SQLite?What are the best practices for SQLite on Android?How do I fix android.os.NetworkOnMainThreadException?Android application upgrade without a databaseWhy does my exception handler not trap Android SQLite insert error?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I'm missing the clarity of how to handle SQLite database migration when the user doesn't want to update the app which includes additional columns for the updated app. How to handle the crash and the issues which occur when the user doesn't want to update the app. Any suggestions will be appreciable.
I have tried the following code which includes the Upgrading the database version though when user doesn't want to update the app.
Like the below in on upgrade method
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int
newVersion)
switch (oldVersion)
case 1:
db.execSQL("ALTER TABLE " + TABLE_GITHUB + " ADD COLUMN " +
NODE_ID + " TEXT ");
case 2:
db.execSQL("ALTER TABLE " + TABLE_GITHUB + " ADD COLUMN " +
PRIVATE + " TEXT ");
case 3:
db.execSQL("ALTER TABLE GITHUB_DATA ADD COLUMN repos_url
text");
I was successful in upgrading the SQLite database when the user has SQLite version 2 and made it as 3 by using the above on the upgrade method. But I have failed of getting the data from which the column I added (of repos_url column). The column has been added to the SQLite but I was unable to get the data though I have data from the server. Any suggestion will be appreciable. Thank you.
Edit:
Considering this situation If I'm maintaining the versioning using the server.
I have repos_url which i need to include for the new version user.This is the adapter i need to show in recyclerview.
@Override
public void onBindViewHolder(@NonNull GithubViewHolder githubViewHolder, int i)
HashMap<String,String> hashMap = githubArryaList.get(i);
githubViewHolder.name.setText(hashMap.get("name"));
githubViewHolder.fullname.setText(hashMap.get("full_name"));
githubViewHolder.id.setText(hashMap.get("id"));
githubViewHolder.node_id.setText(hashMap.get("node_id"));
githubViewHolder.priv.setText(hashMap.get("private"));
//new column
githubViewHolder.repos_url.setText(hashMap.get("repos_url"));
And this is the sqlite method for sending the data.
public ArrayList getFavouritesData()
ArrayList arrayList = new ArrayList();
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery("SELECT * FROM " + TABLE_GITHUB,null);
if (cursor.moveToFirst())
do
HashMap<String,String> hashMap = new HashMap<>();
hashMap.put(SqliteFavouriteDatabase.NAME,cursor.getString(cursor.getColumnIndex(SqliteFavouriteDatabase.NAME)));
hashMap.put(SqliteFavouriteDatabase.FULL_NAME,cursor.getString(cursor.getColumnIndex(SqliteFavouriteDatabase.FULL_NAME)));
hashMap.put(SqliteFavouriteDatabase.ID,cursor.getString(cursor.getColumnIndex(SqliteFavouriteDatabase.ID)));
hashMap.put(SqliteFavouriteDatabase.NODE_ID,cursor.getString(cursor.getColumnIndex(SqliteFavouriteDatabase.NODE_ID)));
hashMap.put(SqliteFavouriteDatabase.PRIVATE,cursor.getString(cursor.getColumnIndex(SqliteFavouriteDatabase.PRIVATE)));
hashMap.put(SqliteFavouriteDatabase.REPOS_URL,cursor.getString(cursor.getColumnIndex(SqliteFavouriteDatabase.REPOS_URL)));
arrayList.add(hashMap);
while (cursor.moveToNext());
cursor.close();
db.close();
return arrayList;
The question is for the oldd version how to handle the new column data.The issue arise when there is no column called repos_url for the old version but I have to use the repos_url for the new user and i have to use the same method and adapter for both versions (new and old).How to handle this for both versions. Thank you
android sqlite
|
show 3 more comments
I'm missing the clarity of how to handle SQLite database migration when the user doesn't want to update the app which includes additional columns for the updated app. How to handle the crash and the issues which occur when the user doesn't want to update the app. Any suggestions will be appreciable.
I have tried the following code which includes the Upgrading the database version though when user doesn't want to update the app.
Like the below in on upgrade method
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int
newVersion)
switch (oldVersion)
case 1:
db.execSQL("ALTER TABLE " + TABLE_GITHUB + " ADD COLUMN " +
NODE_ID + " TEXT ");
case 2:
db.execSQL("ALTER TABLE " + TABLE_GITHUB + " ADD COLUMN " +
PRIVATE + " TEXT ");
case 3:
db.execSQL("ALTER TABLE GITHUB_DATA ADD COLUMN repos_url
text");
I was successful in upgrading the SQLite database when the user has SQLite version 2 and made it as 3 by using the above on the upgrade method. But I have failed of getting the data from which the column I added (of repos_url column). The column has been added to the SQLite but I was unable to get the data though I have data from the server. Any suggestion will be appreciable. Thank you.
Edit:
Considering this situation If I'm maintaining the versioning using the server.
I have repos_url which i need to include for the new version user.This is the adapter i need to show in recyclerview.
@Override
public void onBindViewHolder(@NonNull GithubViewHolder githubViewHolder, int i)
HashMap<String,String> hashMap = githubArryaList.get(i);
githubViewHolder.name.setText(hashMap.get("name"));
githubViewHolder.fullname.setText(hashMap.get("full_name"));
githubViewHolder.id.setText(hashMap.get("id"));
githubViewHolder.node_id.setText(hashMap.get("node_id"));
githubViewHolder.priv.setText(hashMap.get("private"));
//new column
githubViewHolder.repos_url.setText(hashMap.get("repos_url"));
And this is the sqlite method for sending the data.
public ArrayList getFavouritesData()
ArrayList arrayList = new ArrayList();
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery("SELECT * FROM " + TABLE_GITHUB,null);
if (cursor.moveToFirst())
do
HashMap<String,String> hashMap = new HashMap<>();
hashMap.put(SqliteFavouriteDatabase.NAME,cursor.getString(cursor.getColumnIndex(SqliteFavouriteDatabase.NAME)));
hashMap.put(SqliteFavouriteDatabase.FULL_NAME,cursor.getString(cursor.getColumnIndex(SqliteFavouriteDatabase.FULL_NAME)));
hashMap.put(SqliteFavouriteDatabase.ID,cursor.getString(cursor.getColumnIndex(SqliteFavouriteDatabase.ID)));
hashMap.put(SqliteFavouriteDatabase.NODE_ID,cursor.getString(cursor.getColumnIndex(SqliteFavouriteDatabase.NODE_ID)));
hashMap.put(SqliteFavouriteDatabase.PRIVATE,cursor.getString(cursor.getColumnIndex(SqliteFavouriteDatabase.PRIVATE)));
hashMap.put(SqliteFavouriteDatabase.REPOS_URL,cursor.getString(cursor.getColumnIndex(SqliteFavouriteDatabase.REPOS_URL)));
arrayList.add(hashMap);
while (cursor.moveToNext());
cursor.close();
db.close();
return arrayList;
The question is for the oldd version how to handle the new column data.The issue arise when there is no column called repos_url for the old version but I have to use the repos_url for the new user and i have to use the same method and adapter for both versions (new and old).How to handle this for both versions. Thank you
android sqlite
Hi, when you say "I was unable to get the data though", do you mean that you insert a new row withrepos_url
value, but when you select it is empty?
– Pozzo Apps
Mar 27 at 6:20
if user doesn't want to update the app, then you'll have to maintain a separate API/app version for their app. sqlite doesn't support your usecase.
– kkarakk
Mar 27 at 6:20
@PozzoApps I have got the value of repos_url from the server at the same time I have updated the SQLite table column using above on upgrade method. the table has been added but the value of the repos_url is null when I checked from SQLite.db file
– Brahma Datta
Mar 27 at 6:22
@kkarakk yes you are correct i got the same idea of maintining the versioning of apis but how to maintain the sqlite columns.I have added the sqlite column in sqlite db already.Will it not be a problem for the user who dont upgrade the app.We use the methods of sending data to getData() which i have added the new column (repos_url).
– Brahma Datta
Mar 27 at 6:25
1
ok, in that case you need to accept that old app versions wont have the new column.
– Pozzo Apps
Mar 27 at 6:30
|
show 3 more comments
I'm missing the clarity of how to handle SQLite database migration when the user doesn't want to update the app which includes additional columns for the updated app. How to handle the crash and the issues which occur when the user doesn't want to update the app. Any suggestions will be appreciable.
I have tried the following code which includes the Upgrading the database version though when user doesn't want to update the app.
Like the below in on upgrade method
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int
newVersion)
switch (oldVersion)
case 1:
db.execSQL("ALTER TABLE " + TABLE_GITHUB + " ADD COLUMN " +
NODE_ID + " TEXT ");
case 2:
db.execSQL("ALTER TABLE " + TABLE_GITHUB + " ADD COLUMN " +
PRIVATE + " TEXT ");
case 3:
db.execSQL("ALTER TABLE GITHUB_DATA ADD COLUMN repos_url
text");
I was successful in upgrading the SQLite database when the user has SQLite version 2 and made it as 3 by using the above on the upgrade method. But I have failed of getting the data from which the column I added (of repos_url column). The column has been added to the SQLite but I was unable to get the data though I have data from the server. Any suggestion will be appreciable. Thank you.
Edit:
Considering this situation If I'm maintaining the versioning using the server.
I have repos_url which i need to include for the new version user.This is the adapter i need to show in recyclerview.
@Override
public void onBindViewHolder(@NonNull GithubViewHolder githubViewHolder, int i)
HashMap<String,String> hashMap = githubArryaList.get(i);
githubViewHolder.name.setText(hashMap.get("name"));
githubViewHolder.fullname.setText(hashMap.get("full_name"));
githubViewHolder.id.setText(hashMap.get("id"));
githubViewHolder.node_id.setText(hashMap.get("node_id"));
githubViewHolder.priv.setText(hashMap.get("private"));
//new column
githubViewHolder.repos_url.setText(hashMap.get("repos_url"));
And this is the sqlite method for sending the data.
public ArrayList getFavouritesData()
ArrayList arrayList = new ArrayList();
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery("SELECT * FROM " + TABLE_GITHUB,null);
if (cursor.moveToFirst())
do
HashMap<String,String> hashMap = new HashMap<>();
hashMap.put(SqliteFavouriteDatabase.NAME,cursor.getString(cursor.getColumnIndex(SqliteFavouriteDatabase.NAME)));
hashMap.put(SqliteFavouriteDatabase.FULL_NAME,cursor.getString(cursor.getColumnIndex(SqliteFavouriteDatabase.FULL_NAME)));
hashMap.put(SqliteFavouriteDatabase.ID,cursor.getString(cursor.getColumnIndex(SqliteFavouriteDatabase.ID)));
hashMap.put(SqliteFavouriteDatabase.NODE_ID,cursor.getString(cursor.getColumnIndex(SqliteFavouriteDatabase.NODE_ID)));
hashMap.put(SqliteFavouriteDatabase.PRIVATE,cursor.getString(cursor.getColumnIndex(SqliteFavouriteDatabase.PRIVATE)));
hashMap.put(SqliteFavouriteDatabase.REPOS_URL,cursor.getString(cursor.getColumnIndex(SqliteFavouriteDatabase.REPOS_URL)));
arrayList.add(hashMap);
while (cursor.moveToNext());
cursor.close();
db.close();
return arrayList;
The question is for the oldd version how to handle the new column data.The issue arise when there is no column called repos_url for the old version but I have to use the repos_url for the new user and i have to use the same method and adapter for both versions (new and old).How to handle this for both versions. Thank you
android sqlite
I'm missing the clarity of how to handle SQLite database migration when the user doesn't want to update the app which includes additional columns for the updated app. How to handle the crash and the issues which occur when the user doesn't want to update the app. Any suggestions will be appreciable.
I have tried the following code which includes the Upgrading the database version though when user doesn't want to update the app.
Like the below in on upgrade method
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int
newVersion)
switch (oldVersion)
case 1:
db.execSQL("ALTER TABLE " + TABLE_GITHUB + " ADD COLUMN " +
NODE_ID + " TEXT ");
case 2:
db.execSQL("ALTER TABLE " + TABLE_GITHUB + " ADD COLUMN " +
PRIVATE + " TEXT ");
case 3:
db.execSQL("ALTER TABLE GITHUB_DATA ADD COLUMN repos_url
text");
I was successful in upgrading the SQLite database when the user has SQLite version 2 and made it as 3 by using the above on the upgrade method. But I have failed of getting the data from which the column I added (of repos_url column). The column has been added to the SQLite but I was unable to get the data though I have data from the server. Any suggestion will be appreciable. Thank you.
Edit:
Considering this situation If I'm maintaining the versioning using the server.
I have repos_url which i need to include for the new version user.This is the adapter i need to show in recyclerview.
@Override
public void onBindViewHolder(@NonNull GithubViewHolder githubViewHolder, int i)
HashMap<String,String> hashMap = githubArryaList.get(i);
githubViewHolder.name.setText(hashMap.get("name"));
githubViewHolder.fullname.setText(hashMap.get("full_name"));
githubViewHolder.id.setText(hashMap.get("id"));
githubViewHolder.node_id.setText(hashMap.get("node_id"));
githubViewHolder.priv.setText(hashMap.get("private"));
//new column
githubViewHolder.repos_url.setText(hashMap.get("repos_url"));
And this is the sqlite method for sending the data.
public ArrayList getFavouritesData()
ArrayList arrayList = new ArrayList();
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery("SELECT * FROM " + TABLE_GITHUB,null);
if (cursor.moveToFirst())
do
HashMap<String,String> hashMap = new HashMap<>();
hashMap.put(SqliteFavouriteDatabase.NAME,cursor.getString(cursor.getColumnIndex(SqliteFavouriteDatabase.NAME)));
hashMap.put(SqliteFavouriteDatabase.FULL_NAME,cursor.getString(cursor.getColumnIndex(SqliteFavouriteDatabase.FULL_NAME)));
hashMap.put(SqliteFavouriteDatabase.ID,cursor.getString(cursor.getColumnIndex(SqliteFavouriteDatabase.ID)));
hashMap.put(SqliteFavouriteDatabase.NODE_ID,cursor.getString(cursor.getColumnIndex(SqliteFavouriteDatabase.NODE_ID)));
hashMap.put(SqliteFavouriteDatabase.PRIVATE,cursor.getString(cursor.getColumnIndex(SqliteFavouriteDatabase.PRIVATE)));
hashMap.put(SqliteFavouriteDatabase.REPOS_URL,cursor.getString(cursor.getColumnIndex(SqliteFavouriteDatabase.REPOS_URL)));
arrayList.add(hashMap);
while (cursor.moveToNext());
cursor.close();
db.close();
return arrayList;
The question is for the oldd version how to handle the new column data.The issue arise when there is no column called repos_url for the old version but I have to use the repos_url for the new user and i have to use the same method and adapter for both versions (new and old).How to handle this for both versions. Thank you
android sqlite
android sqlite
edited Mar 27 at 7:02
Brahma Datta
asked Mar 27 at 6:15
Brahma DattaBrahma Datta
7284 silver badges14 bronze badges
7284 silver badges14 bronze badges
Hi, when you say "I was unable to get the data though", do you mean that you insert a new row withrepos_url
value, but when you select it is empty?
– Pozzo Apps
Mar 27 at 6:20
if user doesn't want to update the app, then you'll have to maintain a separate API/app version for their app. sqlite doesn't support your usecase.
– kkarakk
Mar 27 at 6:20
@PozzoApps I have got the value of repos_url from the server at the same time I have updated the SQLite table column using above on upgrade method. the table has been added but the value of the repos_url is null when I checked from SQLite.db file
– Brahma Datta
Mar 27 at 6:22
@kkarakk yes you are correct i got the same idea of maintining the versioning of apis but how to maintain the sqlite columns.I have added the sqlite column in sqlite db already.Will it not be a problem for the user who dont upgrade the app.We use the methods of sending data to getData() which i have added the new column (repos_url).
– Brahma Datta
Mar 27 at 6:25
1
ok, in that case you need to accept that old app versions wont have the new column.
– Pozzo Apps
Mar 27 at 6:30
|
show 3 more comments
Hi, when you say "I was unable to get the data though", do you mean that you insert a new row withrepos_url
value, but when you select it is empty?
– Pozzo Apps
Mar 27 at 6:20
if user doesn't want to update the app, then you'll have to maintain a separate API/app version for their app. sqlite doesn't support your usecase.
– kkarakk
Mar 27 at 6:20
@PozzoApps I have got the value of repos_url from the server at the same time I have updated the SQLite table column using above on upgrade method. the table has been added but the value of the repos_url is null when I checked from SQLite.db file
– Brahma Datta
Mar 27 at 6:22
@kkarakk yes you are correct i got the same idea of maintining the versioning of apis but how to maintain the sqlite columns.I have added the sqlite column in sqlite db already.Will it not be a problem for the user who dont upgrade the app.We use the methods of sending data to getData() which i have added the new column (repos_url).
– Brahma Datta
Mar 27 at 6:25
1
ok, in that case you need to accept that old app versions wont have the new column.
– Pozzo Apps
Mar 27 at 6:30
Hi, when you say "I was unable to get the data though", do you mean that you insert a new row with
repos_url
value, but when you select it is empty?– Pozzo Apps
Mar 27 at 6:20
Hi, when you say "I was unable to get the data though", do you mean that you insert a new row with
repos_url
value, but when you select it is empty?– Pozzo Apps
Mar 27 at 6:20
if user doesn't want to update the app, then you'll have to maintain a separate API/app version for their app. sqlite doesn't support your usecase.
– kkarakk
Mar 27 at 6:20
if user doesn't want to update the app, then you'll have to maintain a separate API/app version for their app. sqlite doesn't support your usecase.
– kkarakk
Mar 27 at 6:20
@PozzoApps I have got the value of repos_url from the server at the same time I have updated the SQLite table column using above on upgrade method. the table has been added but the value of the repos_url is null when I checked from SQLite.db file
– Brahma Datta
Mar 27 at 6:22
@PozzoApps I have got the value of repos_url from the server at the same time I have updated the SQLite table column using above on upgrade method. the table has been added but the value of the repos_url is null when I checked from SQLite.db file
– Brahma Datta
Mar 27 at 6:22
@kkarakk yes you are correct i got the same idea of maintining the versioning of apis but how to maintain the sqlite columns.I have added the sqlite column in sqlite db already.Will it not be a problem for the user who dont upgrade the app.We use the methods of sending data to getData() which i have added the new column (repos_url).
– Brahma Datta
Mar 27 at 6:25
@kkarakk yes you are correct i got the same idea of maintining the versioning of apis but how to maintain the sqlite columns.I have added the sqlite column in sqlite db already.Will it not be a problem for the user who dont upgrade the app.We use the methods of sending data to getData() which i have added the new column (repos_url).
– Brahma Datta
Mar 27 at 6:25
1
1
ok, in that case you need to accept that old app versions wont have the new column.
– Pozzo Apps
Mar 27 at 6:30
ok, in that case you need to accept that old app versions wont have the new column.
– Pozzo Apps
Mar 27 at 6:30
|
show 3 more comments
1 Answer
1
active
oldest
votes
That is backward compatibility -- your new server is not compatible with old version of app.
While it is impossible (or difficult) to modify old version of app, you can make change in both new version of app and new version of server to handle this:
- in new version of app, when request raised to server, add extra information to indicate this is from new version of app
- in new version of server, when receive request from app, check if extra information is available
- if extra information is available, it is from new version of app, you can add new columns in the response
- if extra information is not available, it is from old version of app, you should remove new column in the response
- new version of app will receive new columns and handle
- old version of app will receive response without new column, and is able to handle.
Yeah you explained it in very nice way.That's awesome but i just need a clarity in one situation.I am sending the data using recyclerview which has new value called repos_url in adapter for new verison what happens when user has old version but still i am using this repos_url in adapter for both versions. @Aimin
– Brahma Datta
Mar 27 at 6:47
Do you get what I mean in step 4? Server should not include repos_url in the response to old versions. Else it depends on how nice you write your old version of app -- if unknown column is just ignored, your app still survives, else it will crash.
– AIMIN PAN
Mar 27 at 7:26
"Server should not include repos_url in the response to old versions".....yeah but isn't it an issue when I'm including this variable in an adapter which I use for both version like I edited my question. I have to add repos_url value for the new version. But the same adapter I am using for both versions. At this point of time, what happens for old version asking for repos_url value through its having from the server for old version api.
– Brahma Datta
Mar 27 at 7:36
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55370898%2fhow-to-handle-migration-in-sqlite-database%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
That is backward compatibility -- your new server is not compatible with old version of app.
While it is impossible (or difficult) to modify old version of app, you can make change in both new version of app and new version of server to handle this:
- in new version of app, when request raised to server, add extra information to indicate this is from new version of app
- in new version of server, when receive request from app, check if extra information is available
- if extra information is available, it is from new version of app, you can add new columns in the response
- if extra information is not available, it is from old version of app, you should remove new column in the response
- new version of app will receive new columns and handle
- old version of app will receive response without new column, and is able to handle.
Yeah you explained it in very nice way.That's awesome but i just need a clarity in one situation.I am sending the data using recyclerview which has new value called repos_url in adapter for new verison what happens when user has old version but still i am using this repos_url in adapter for both versions. @Aimin
– Brahma Datta
Mar 27 at 6:47
Do you get what I mean in step 4? Server should not include repos_url in the response to old versions. Else it depends on how nice you write your old version of app -- if unknown column is just ignored, your app still survives, else it will crash.
– AIMIN PAN
Mar 27 at 7:26
"Server should not include repos_url in the response to old versions".....yeah but isn't it an issue when I'm including this variable in an adapter which I use for both version like I edited my question. I have to add repos_url value for the new version. But the same adapter I am using for both versions. At this point of time, what happens for old version asking for repos_url value through its having from the server for old version api.
– Brahma Datta
Mar 27 at 7:36
add a comment |
That is backward compatibility -- your new server is not compatible with old version of app.
While it is impossible (or difficult) to modify old version of app, you can make change in both new version of app and new version of server to handle this:
- in new version of app, when request raised to server, add extra information to indicate this is from new version of app
- in new version of server, when receive request from app, check if extra information is available
- if extra information is available, it is from new version of app, you can add new columns in the response
- if extra information is not available, it is from old version of app, you should remove new column in the response
- new version of app will receive new columns and handle
- old version of app will receive response without new column, and is able to handle.
Yeah you explained it in very nice way.That's awesome but i just need a clarity in one situation.I am sending the data using recyclerview which has new value called repos_url in adapter for new verison what happens when user has old version but still i am using this repos_url in adapter for both versions. @Aimin
– Brahma Datta
Mar 27 at 6:47
Do you get what I mean in step 4? Server should not include repos_url in the response to old versions. Else it depends on how nice you write your old version of app -- if unknown column is just ignored, your app still survives, else it will crash.
– AIMIN PAN
Mar 27 at 7:26
"Server should not include repos_url in the response to old versions".....yeah but isn't it an issue when I'm including this variable in an adapter which I use for both version like I edited my question. I have to add repos_url value for the new version. But the same adapter I am using for both versions. At this point of time, what happens for old version asking for repos_url value through its having from the server for old version api.
– Brahma Datta
Mar 27 at 7:36
add a comment |
That is backward compatibility -- your new server is not compatible with old version of app.
While it is impossible (or difficult) to modify old version of app, you can make change in both new version of app and new version of server to handle this:
- in new version of app, when request raised to server, add extra information to indicate this is from new version of app
- in new version of server, when receive request from app, check if extra information is available
- if extra information is available, it is from new version of app, you can add new columns in the response
- if extra information is not available, it is from old version of app, you should remove new column in the response
- new version of app will receive new columns and handle
- old version of app will receive response without new column, and is able to handle.
That is backward compatibility -- your new server is not compatible with old version of app.
While it is impossible (or difficult) to modify old version of app, you can make change in both new version of app and new version of server to handle this:
- in new version of app, when request raised to server, add extra information to indicate this is from new version of app
- in new version of server, when receive request from app, check if extra information is available
- if extra information is available, it is from new version of app, you can add new columns in the response
- if extra information is not available, it is from old version of app, you should remove new column in the response
- new version of app will receive new columns and handle
- old version of app will receive response without new column, and is able to handle.
answered Mar 27 at 6:37
AIMIN PANAIMIN PAN
3242 silver badges10 bronze badges
3242 silver badges10 bronze badges
Yeah you explained it in very nice way.That's awesome but i just need a clarity in one situation.I am sending the data using recyclerview which has new value called repos_url in adapter for new verison what happens when user has old version but still i am using this repos_url in adapter for both versions. @Aimin
– Brahma Datta
Mar 27 at 6:47
Do you get what I mean in step 4? Server should not include repos_url in the response to old versions. Else it depends on how nice you write your old version of app -- if unknown column is just ignored, your app still survives, else it will crash.
– AIMIN PAN
Mar 27 at 7:26
"Server should not include repos_url in the response to old versions".....yeah but isn't it an issue when I'm including this variable in an adapter which I use for both version like I edited my question. I have to add repos_url value for the new version. But the same adapter I am using for both versions. At this point of time, what happens for old version asking for repos_url value through its having from the server for old version api.
– Brahma Datta
Mar 27 at 7:36
add a comment |
Yeah you explained it in very nice way.That's awesome but i just need a clarity in one situation.I am sending the data using recyclerview which has new value called repos_url in adapter for new verison what happens when user has old version but still i am using this repos_url in adapter for both versions. @Aimin
– Brahma Datta
Mar 27 at 6:47
Do you get what I mean in step 4? Server should not include repos_url in the response to old versions. Else it depends on how nice you write your old version of app -- if unknown column is just ignored, your app still survives, else it will crash.
– AIMIN PAN
Mar 27 at 7:26
"Server should not include repos_url in the response to old versions".....yeah but isn't it an issue when I'm including this variable in an adapter which I use for both version like I edited my question. I have to add repos_url value for the new version. But the same adapter I am using for both versions. At this point of time, what happens for old version asking for repos_url value through its having from the server for old version api.
– Brahma Datta
Mar 27 at 7:36
Yeah you explained it in very nice way.That's awesome but i just need a clarity in one situation.I am sending the data using recyclerview which has new value called repos_url in adapter for new verison what happens when user has old version but still i am using this repos_url in adapter for both versions. @Aimin
– Brahma Datta
Mar 27 at 6:47
Yeah you explained it in very nice way.That's awesome but i just need a clarity in one situation.I am sending the data using recyclerview which has new value called repos_url in adapter for new verison what happens when user has old version but still i am using this repos_url in adapter for both versions. @Aimin
– Brahma Datta
Mar 27 at 6:47
Do you get what I mean in step 4? Server should not include repos_url in the response to old versions. Else it depends on how nice you write your old version of app -- if unknown column is just ignored, your app still survives, else it will crash.
– AIMIN PAN
Mar 27 at 7:26
Do you get what I mean in step 4? Server should not include repos_url in the response to old versions. Else it depends on how nice you write your old version of app -- if unknown column is just ignored, your app still survives, else it will crash.
– AIMIN PAN
Mar 27 at 7:26
"Server should not include repos_url in the response to old versions".....yeah but isn't it an issue when I'm including this variable in an adapter which I use for both version like I edited my question. I have to add repos_url value for the new version. But the same adapter I am using for both versions. At this point of time, what happens for old version asking for repos_url value through its having from the server for old version api.
– Brahma Datta
Mar 27 at 7:36
"Server should not include repos_url in the response to old versions".....yeah but isn't it an issue when I'm including this variable in an adapter which I use for both version like I edited my question. I have to add repos_url value for the new version. But the same adapter I am using for both versions. At this point of time, what happens for old version asking for repos_url value through its having from the server for old version api.
– Brahma Datta
Mar 27 at 7:36
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55370898%2fhow-to-handle-migration-in-sqlite-database%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Hi, when you say "I was unable to get the data though", do you mean that you insert a new row with
repos_url
value, but when you select it is empty?– Pozzo Apps
Mar 27 at 6:20
if user doesn't want to update the app, then you'll have to maintain a separate API/app version for their app. sqlite doesn't support your usecase.
– kkarakk
Mar 27 at 6:20
@PozzoApps I have got the value of repos_url from the server at the same time I have updated the SQLite table column using above on upgrade method. the table has been added but the value of the repos_url is null when I checked from SQLite.db file
– Brahma Datta
Mar 27 at 6:22
@kkarakk yes you are correct i got the same idea of maintining the versioning of apis but how to maintain the sqlite columns.I have added the sqlite column in sqlite db already.Will it not be a problem for the user who dont upgrade the app.We use the methods of sending data to getData() which i have added the new column (repos_url).
– Brahma Datta
Mar 27 at 6:25
1
ok, in that case you need to accept that old app versions wont have the new column.
– Pozzo Apps
Mar 27 at 6:30