Database upgrade on objectbox and drop old table

55 views Asked by At

What i want to achieve is following things. At some point i want do some updates on my data and database. What i want to do is to drop a table and repopulate it again, in order to keep the id-s same for some of the items

Today i populate a table like this

suspend fun insertItemsIfTableIsEmpty() = withContext(Dispatchers.IO) {
        if (itemsBoxStore.count() == 0L) {
            insertItems(items = Items.all)
        }
    }

What i want to achieve at some point is to drop the old table and repopulate with new items. Some of those are identical, few are different and some are new.

After that i want to keep that table untouched and initiate as in the code above. I know how to do it for sql and room, but not for objectBox. The items are quite complex and have one-to-many and one-to-one relations with other classes not mentioned here. Those other classes are not touched

Drop an old table and create a new. But it failed

0

There are 0 answers