Coder Social home page Coder Social logo

Comments (6)

vincentlauvlwj avatar vincentlauvlwj commented on August 22, 2024 4

谢谢,了解了,这是一个很好的建议,我会仔细思考是否加入此功能。

不过我正在计划开发一个 IntelliJ IDEA 的插件,使用这个插件可以一键从数据库的表中生成 Ktorm 的实体类和表对象。有了这个插件,就可以减少很多重复的工作,也可以解决你提到的表结构跟实体类对应出错的问题。因此,在开发完这个插件后,有没有必要再实现自动建表和自动更新表结构的功能就需要打个问号。

以 Hibernate 为例,据我所知,其 ddl-auto 功能一般都仅在开发中使用。在生产环境中升级应用版本的时候,按照正规流程,一般我们都会手动编辑一个用于表结构迁移的 SQL 文件,而不是把表结构的修改交给 Hibernate,这样既方便了运维和管理,也不容易出错。这个功能,在使用不当的情况下,很容易对表结构做出误操作,甚至造成数据丢失。因此,我个人暂时还没有这个计划。

总之,谢谢你的建议。我的计划是先把生成实体类和表对象的 IDEA 插件开发出来,这应该能够解决我们的问题。如果以后真的有需要的话,我再考虑是否实现此功能。

from ktorm.

vincentlauvlwj avatar vincentlauvlwj commented on August 22, 2024 2

这个可以有:smile:

from ktorm.

vincentlauvlwj avatar vincentlauvlwj commented on August 22, 2024

请问下你指的功能具体是什么,能详细描述一下吗?

是类似 Hibernate 那种从实体类生成表结构?

from ktorm.

zhzhwcn avatar zhzhwcn commented on August 22, 2024

抱歉我没用过 Hibernate, 我是从c#过来的。
就是类似这种功能https://docs.microsoft.com/zh-cn/ef/core/managing-schemas/migrations/
应该跟你说的那个差不多

from ktorm.

zhzhwcn avatar zhzhwcn commented on August 22, 2024

使用插件也是可以的,就像你说的升级版本的时候会需要一个SQL文件,不知道插件里会不会有自动生成这个SQL的功能呢?如果有的话这个插件其实就是我说的这个功能的另外一种实现了。

from ktorm.

ljj038 avatar ljj038 commented on August 22, 2024

Table对象 -> DDL sql
数据表 -> Table对象

这两个功能要是都能加上就好了. 这样在开发的时候只需写好Table对象, 就能自动Create table, alter table, create index等操作.

from ktorm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.