objectbox / objectbox/objectbox-java

"Nuke version" to simplify data model changes during development

未關閉
#178 2 則留言 15 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

enhancement
主要語言
Java
星號
4.6k
分支
311
PR 合併指標
30 天內沒有已合併 PR

描述

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!

貢獻指南

這個儲存庫沒有索引到貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

未指定檔案或測試;先檢視 MyObjectBox.builder() 的初始化路徑,以及資料模型版本的追蹤方式。定義捨棄早期版本資料的 API 和行為,同時保留針對後續版本所提議的自訂遷移處理。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
java
領域
database
Issue 類型
功能
難度
5/5
預估耗時
一週以上
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。