# 2021年自定义插件数据库数据的最佳约定？

**URL:** https://meta.discourse.org/t/best-convention-for-custom-plugin-db-data-for-2021/183521
**Category:** Development
**Created:** [2021年三月17日 12:20 UTC](https://meta.discourse.org/t/best-convention-for-custom-plugin-db-data-for-2021/183521 "2021-03-17T12:20:46Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![Zach\_Swinehart](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zach_swinehart/32/210979_2.png) [@Zach\_Swinehart](https://meta.discourse.org/u/Zach_Swinehart)
#### Post date: [2021年三月17日 12:49 UTC](https://meta.discourse.org/t/best-convention-for-custom-plugin-db-data-for-2021/183521/3 "2021-03-17T12:49:21Z")

</div>

啊，好的，太棒了。看来我问对了。 😉 有没有推荐的从插件内部修改核心模型的方法？

我想添加一些自定义的定义和关系，例如通过我的新表建立 hasManyThrough 关系，但除了在我新模型中调用函数并传入类别、用户等 ID 之外，我不太确定最佳做法是什么。

我找到了[这篇帖子](https://meta.discourse.org/t/extending-user-model/108128)，但看起来他一直没有得到答案。

---

_[View the full topic](https://meta.discourse.org/t/best-convention-for-custom-plugin-db-data-for-2021/183521)._
