Jhipster 5.7.2如何从H2迁移到mysql并保留我的修改 [英] Jhipster 5.7.2 How to Migrate to mysql from H2 keeping my modifications

查看:173
本文介绍了Jhipster 5.7.2如何从H2迁移到mysql并保留我的修改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过选择h2数据库选项创建了一个jhipster项目.我对项目进行了很多更改,我想切换到mysql数据库以保留数据.

I created a jhipster project by selecting the h2 database option. I have made a lot of changes on my project and I want to switch to a mysql database to keep my data.

所以我将"devDatabaseType": "h2Disk"从文件 yo-rc.json 更改为"devDatabaseType": "mysql".但是,当我执行命令"jhipster upgrade --force"或"jhipster"时,我会丢失对angular或java项目所做的所有修改.

So I changed "devDatabaseType": "h2Disk", from the file yo-rc.json to "devDatabaseType": "mysql". However when I do the command "jhipster upgrade --force" or "jhipster" I lose all the modifications made on angular or my java project.

如何在不丢失更改的情况下迁移数据库

How can I migrate my database without losing my changes

(更新),编辑后:

(Update) After Edit :

src/main/resources/config/application-dev.yml 
src/test/resources/config/application.yml
Delete **DatabaseConfiguration.java**  
Edit **WebConfigurer.java**, **SecurityConfiguration.java 
navbar.component.html** and **pom.xml**  to remove references to H2

我收到此错误:堆栈跟踪
带有错误的完整项目可以在这里找到:项目

I get this error : stack trace
The complete project with the bug is available here : project

推荐答案

对于这种简单的更改,无需运行jhipster upgrade.

No need to run jhipster upgrade for such a simple change.

  • 编辑您的src/main/resources/config/application-dev.yml以使用mysql,从application-prod.yml复制数据源属性,但不要将缓存属性设置为true. src/test/resources/config/application.yml
  • 中的单元测试也是如此
  • 清空DatabaseConfiguration.java,但保留@Enable*类批注的类.
  • 编辑WebConfigurer.javaSecurityConfiguration.javanavbar.component.html以删除对H2控制台的引用
  • 编辑pom.xml*.gradle以删除对h2的依赖
  • Edit your src/main/resources/config/application-dev.yml to use mysql, copy datasource properties from application-prod.yml but don't set cache properties to true. Same thing for unit tests in src/test/resources/config/application.yml
  • Empty DatabaseConfiguration.java but keep the class for the @Enable* class annotations.
  • Edit WebConfigurer.java, SecurityConfiguration.javaand navbar.component.html to remove references to H2 console
  • Edit pom.xml or *.gradle to remove dependency on h2

这篇关于Jhipster 5.7.2如何从H2迁移到mysql并保留我的修改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆