Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8999893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:14:26+00:00 2026-06-16T00:14:26+00:00

According to a previous question that I’ve asked (see this ), dropping and re-creating

  • 0

According to a previous question that I’ve asked (see this), dropping and re-creating tables is not going to work very well if I make changes and add new data once I’ve
distributed the app, because users will lose all their data.

Is there a recommended strategy for dealing with this and/or do you have some examples of what I have to do to manage this problem ?

Thanks

EDIT :

It would be something like this

@Override
    public void onUpgrade (SQLiteDatabase db, ConnectionSource connectionSource, int oldVersion, int newVersion){
        // TODO Auto-generated method stub
            //This is why I'm currently trying
        while(oldVersion < newVersion){
            switch(oldVersion){
            case 2:
                //add new datas from version 2 here
                break;
            case 3:
                //add new datas from version 3 here
                break;
            default:
                break;
            }
            oldVersion++;
        }
            /*
        try {
            Log.i(DatabaseHelper.class.getName(), "onUpgrade");
            TableUtils.dropTable(connectionSource, Category.class, true);
            TableUtils.dropTable(connectionSource, Level.class, true);
            TableUtils.dropTable(connectionSource, Hint.class, true);
            TableUtils.dropTable(connectionSource, HintCount.class, true);
            TableUtils.dropTable(connectionSource, Question.class, true);
            // after we drop the old databases, we create the new ones
            onCreate(db, connectionSource);
        } catch (SQLException e) {
            Log.e(DatabaseHelper.class.getName(), "Can't drop databases", e);
            throw new RuntimeException(e);
        }
            */
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:14:27+00:00Added an answer on June 16, 2026 at 12:14 am

    If you only worried about new data, not schema modification you can try createIfNotExists method in ORM lite. So basically on every upgrade you’ll try to insert all data. But only new data will be inserted.

    EDIT:
    Another approach might be following:
    Split all you objects to groups like: initial objects, first upgrade object, second upgrade objects and so on.

    In onCreate you’ll create all objects, iterating on all groups. In onUpgrade you’ll use groups according to current version.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

NOTE: Before reading this question please note that I have read the previous questions
A few hours ago I asked this question . I learned that std::vector deletes
According to my previous question integration of jsf2.0 and spring 3.1 and hibernate 4.1
This is a continuation of my previous question which I posted when I wasn't
According to my previous question with the help of Cosmin Prund, I found how
This question is more precise than my previous one: General code completion framework written
Another way to ask this question is: what is Inversion of Control according to
This is a design question, to whet the guru's appetite. In a previous version,
According to the previous question How can I find ROI and detect markers inside
Concerning my previous question , I found out that maven can't really output jboss

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.