objectbox / objectbox/objectbox-java

"Nuke version" to simplify data model changes during development

Open
#178 2 comments 15 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Java
Stars
4.6k
Forks
311
PR merge metrics
No merged PRs in 30d

Description

For renames and type changes, there is an UID-based approach to work with already deployed databases.

However during development, it may just be easier to wipe all data and model data.

API outline:

MyObjectBox.builder().version(7).nukeDataBeforeVersion(7)

Thus, ObjectBox would track the current version of the data model, and just discard everything for earlier versions.

Alternative API: annotations, but where to apply them? Also the builder seems appropriate because that's where the initialization happens.

Looking into the future, this approach should also work nicely with custom migration callbacks. E.g.

MyObjectBox.builder().version(10).nukeDataBeforeVersion(7).migrate(new MyMigration())

Here, versions 1 to 6 just would be nuked, and version 10 would be applied. For versions 7 to 9, the custom migration would be triggered.

Feedback on this approach welcome!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file or test is named; start by reviewing the MyObjectBox.builder() initialization path and how data-model versions are tracked. Define the API and behavior for discarding data from earlier versions while preserving the proposed custom migration handling for later versions.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.