[英]What are best practices for maintaining a Mysql database schema in a cross platform way?
We have two software stacks, Ruby on Rails and Java, that share a single Mysql database. 我们有两个软件堆栈,Ruby on Rails和Java,它们共享一个Mysql数据库。 We're using the Jooq Java database abstraction layer, which works by reading an existing database schema and generating code. 我们正在使用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. 我们一直依靠Rails迁移来跟踪模式更改,但是我们的Java开发人员对此并不熟悉,并且我们的Rails开发人员不得不不止一次地使我们摆脱问题。 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. 这也是一个相当麻烦的过程,进行模式更改可能需要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无关的数据库模式,有人可以推荐合适的方法吗?
I guess you could take a look at Liquibase . 我想你可以看看Liquibase 。 It's a Java-based tool, but as I understand it would suit some of your requirements. 这是一个基于Java的工具,但是据我了解,它可以满足您的一些要求。 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. 使用该工具,您可以表达数据库的内容(结构和数据),然后针对正在运行的数据库运行这样的工具,该工具将告诉您缺少哪些更改并将其应用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.