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 摘要。