-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] tegg 支持 leoric #4725
Labels
Comments
Index 目前 leoric 中还没有自动 diff 并执行 sql 的机制,只有两个操作索引的 api 可供手动调用: await driver.addIndex(table, attributes, { name, type });
await driver.removeIndex(table, attributes, { name }); 由于索引只需要在第一次配置的时候执行到数据,所以部分不适合放到 p.s. primary index 用得很少,似乎可以考虑先不支持,sequelize 里暂时也没有对应的 |
这个可以后面补齐的。rfc 的内容是想把所有的场景枚举出来。实际实现可以根据实际的实现情况来走。 |
嗯呐,我先放到计划中,会在 1.x 版本中实现掉 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
背景
在 tegg 中以注解的方式来集成我们的 ORM 框架 Leoric。注解的几点优势:
伪代码
注解定义
Model
Index
Attribute
DataSource
包导出
通过
@eggjs/tegg
包的orm
路径来导出注解以及继承基类。Model, Index, Attribute, DataTypes 等注解没有问题,Bone 会有问题。Bone 中涉及了大量 ORM 实现细节,注解包不应该耦合实现,并且可能存在版本不统一情况。解决方案:注解包可以将 leoric 设置为 peerDep,安装了 orm 插件之后即可统一,没有安装的情况下按照指定的版本为 leoric。存在一种特殊的情况,插件安装路径不是在项目的 node_modules 下面,这种还是会导致有两个 leoric 的存在,需要插件在启动时把注解中的 leoric 替换为实际运行时的。
跟进
The text was updated successfully, but these errors were encountered: