繁体   English   中英

数据库'默认'需要进化! 当尝试使用play framework 2.7.0和Ebean连接MySQL时

[英]Database 'default' needs evolution! when trying connect to MySQL with play framework 2.7.0 and Ebean

我正在尝试使用play framework 2.7.0建立一个项目,现在我正在尝试使用sbt-play-ebean 5.0.0连接到MySQL数据库。

这是我的代码。 https://github.com/hiroya8649/play-mysql-ebean-test

以下是您可能要检查的文件:

https://github.com/hiroya8649/play-mysql-ebean-test/blob/master/conf/application.conf

https://github.com/hiroya8649/play-mysql-ebean-test/blob/master/build.sbt

https://github.com/hiroya8649/play-mysql-ebean-test/blob/master/project/plugins.sbt

现在我尝试连接到localhost:9000,它告诉我Database 'default' needs evolution! An SQL script will be run on your databaserun this script按钮。

这个脚本也一样: https//github.com/hiroya8649/play-mysql-ebean-test/blob/master/conf/evolutions/default/1.sql但是如果我点击run this script它会告诉我

Evolution has not been applied properly. Please check the problem and resolve it manually before marking it as resolved. -
We got the following error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'delimiter $$ -- -- PROCEDURE: usp_ebean_drop_foreign_keys TABLE, COLUMN -- delete' at line 1 [ERROR:1064, SQLSTATE:42000], while trying to run this SQL script:

如果我只是将其标记为已解决,则会显示播放问候世界页面。 但我不认为这是正确的,我在项目中添加了一个Task模型,所以我认为应该在数据库中创建一个表,但事实并非如此。

我的设置有什么问题吗?


我在playframework和play-ebean GitHub中找到相同的问题,它似乎发生在播放版本2.6.20并且尚未修复。

在某些情况下,您使用错误的分隔符。 在将代码添加到evolution之前,请从命令行检查代码。

例:

https://github.com/hiroya8649/play-mysql-ebean-test/blob/master/conf/evolutions/default/1.sql#L10

https://github.com/hiroya8649/play-mysql-ebean-test/blob/master/conf/evolutions/default/1.sql#L40

delimiter $$
....
DROP PROCEDURE IF EXISTS usp_ebean_drop_column;

您需要更改为:

DROP PROCEDURE IF EXISTS usp_ebean_drop_column$$

要么:

delimiter $$
...
delimiter ;
DROP PROCEDURE IF EXISTS usp_ebean_drop_column;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM