以跨平台方式维护Mysql数据库架构的最佳实践是什么?

时间:2022-10-27 13:04:52

We have two software stacks, Ruby on Rails and Java, that share a single Mysql database. We're using the Jooq Java database abstraction layer, which works by reading an existing database schema and generating code.

我们有两个软件堆栈,Ruby on Rails和Java,它们共享一个Mysql数据库。我们使用的是Jooq Java数据库抽象层,它通过读取现有的数据库模式并生成代码来工作。

We have been relying on Rails migrations to keep track of schema changes, but our Java developers are unfamiliar with this, and our Rails devs have had to dig us out of problems more than once. It's also a rather cumbersome process, making a schema change can take 5-10 minutes, whereas it would take seconds if modifying the schema directly through a tool like MySql Workbench.

我们一直依赖Rails迁移来跟踪模式更改,但我们的Java开发人员对此并不熟悉,而且我们的Rails开发人员不得不不止一次地将我们从问题中解脱出来。这也是一个相当麻烦的过程,使模式更改可能需要5-10分钟,而如果直接通过MySql Workbench等工具修改模式则需要几秒钟。

It would be preferable to have a solution for modifying our DB schema that wasn't tied to Rails, can anyone recommend a suitable approach?

最好有一个解决方案来修改与Rails无关的数据库模式,任何人都可以推荐一种合适的方法吗?

1 个解决方案

#1


5  

I guess you could take a look at Liquibase. It's a Java-based tool, but as I understand it would suit some of your requirements. Using that tool you are able to express the database content (both structure and data), then run such a tool against a running database and the tool will tell you what changes are missing and will apply them.

我想你可以看看Liquibase。它是一个基于Java的工具,但据我所知,它可以满足您的一些要求。使用该工具,您可以表达数据库内容(结构和数据),然后针对正在运行的数据库运行此类工具,该工具将告诉您缺少哪些更改并将应用它们。

#1


5  

I guess you could take a look at Liquibase. It's a Java-based tool, but as I understand it would suit some of your requirements. Using that tool you are able to express the database content (both structure and data), then run such a tool against a running database and the tool will tell you what changes are missing and will apply them.

我想你可以看看Liquibase。它是一个基于Java的工具,但据我所知,它可以满足您的一些要求。使用该工具,您可以表达数据库内容(结构和数据),然后针对正在运行的数据库运行此类工具,该工具将告诉您缺少哪些更改并将应用它们。