I started a project with Play Framework 2.4 including Ebean ORM and using MySql Server 5.5.
As Play docs describes, it possible to generate the database from objects and it is working as expected. But when I tried to insert a Timestamp I got a problem because Play is using a newer mysql syntax that is not supported by my server.
Here is my model:
@ManyToOne
@Column(name = "user_send_id")
private User userSendReq;
@ManyToOne
@Column(name = "user_request_id")
private User userGetReq;
@CreatedTimestamp
@Column(name = "date_request")
private Timestamp whenRequest;
@UpdatedTimestamp
@Column(name = "date_friends")
private Timestamp whenFriends;
private boolean request;
And this is the MySQL code Play generates for me:
create table friends (
user_send_req_id bigint,
user_get_req_id bigint,
request tinyint(1) default 0,
date_request datetime(6) not null,
date_friends datetime(6) not null)
;
When I try to apply the evolution to the server I got the error below:
Error Code: 1064. 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 '(6) not null, date_friends datetime(6) not null)' at line 5
Is there a way to tell Play to generate the SQL Evolution files just with datetime()
and not with datetime(6)
?