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;








1















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










share|improve this question


























  • 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

















1















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










share|improve this question


























  • 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













1












1








1








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










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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 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

















  • 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
















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












1 Answer
1






active

oldest

votes


















0














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:



  1. in new version of app, when request raised to server, add extra information to indicate this is from new version of app

  2. in new version of server, when receive request from app, check if extra information is available

  3. if extra information is available, it is from new version of app, you can add new columns in the response

  4. if extra information is not available, it is from old version of app, you should remove new column in the response

  5. new version of app will receive new columns and handle

  6. old version of app will receive response without new column, and is able to handle.





share|improve this answer

























  • 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










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
);



);













draft saved

draft discarded


















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









0














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:



  1. in new version of app, when request raised to server, add extra information to indicate this is from new version of app

  2. in new version of server, when receive request from app, check if extra information is available

  3. if extra information is available, it is from new version of app, you can add new columns in the response

  4. if extra information is not available, it is from old version of app, you should remove new column in the response

  5. new version of app will receive new columns and handle

  6. old version of app will receive response without new column, and is able to handle.





share|improve this answer

























  • 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















0














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:



  1. in new version of app, when request raised to server, add extra information to indicate this is from new version of app

  2. in new version of server, when receive request from app, check if extra information is available

  3. if extra information is available, it is from new version of app, you can add new columns in the response

  4. if extra information is not available, it is from old version of app, you should remove new column in the response

  5. new version of app will receive new columns and handle

  6. old version of app will receive response without new column, and is able to handle.





share|improve this answer

























  • 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













0












0








0







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:



  1. in new version of app, when request raised to server, add extra information to indicate this is from new version of app

  2. in new version of server, when receive request from app, check if extra information is available

  3. if extra information is available, it is from new version of app, you can add new columns in the response

  4. if extra information is not available, it is from old version of app, you should remove new column in the response

  5. new version of app will receive new columns and handle

  6. old version of app will receive response without new column, and is able to handle.





share|improve this answer













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:



  1. in new version of app, when request raised to server, add extra information to indicate this is from new version of app

  2. in new version of server, when receive request from app, check if extra information is available

  3. if extra information is available, it is from new version of app, you can add new columns in the response

  4. if extra information is not available, it is from old version of app, you should remove new column in the response

  5. new version of app will receive new columns and handle

  6. old version of app will receive response without new column, and is able to handle.






share|improve this answer












share|improve this answer



share|improve this answer










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

















  • 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








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.



















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현