简体   繁体   中英

SQL syntax error when trying to connect Play application to mysql database

I'm trying to connect my play2.4 application to a MySQL database. Upon applying an evolution I get the following error

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 '(6), pickup_date datetime(6), delivery_date datetime(6' at line 14 [ERROR:1064, SQLSTATE:42000], while trying to run this SQL script:

When I check php myadmin I see that all the tables are created until this one is reached:

create table delivery (
id                        bigint auto_increment not null,
deleted                   tinyint(1) default 0,    
description               varchar(500),  
notes                     varchar(1000),
account_id                bigint,
customer_id               bigint,
sender_id                 bigint, 
recipient_id              bigint,
delivery_status_id        bigint,
delivery_type_id          bigint,
package_type_id           bigint,
item_type_id              bigint,
call_date                 datetime(6),
pickup_date               datetime(6),
delivery_date             datetime(6),
no_of_pieces              integer,
cust_type                 integer,
payment_type              integer,
way_bill                  integer,  
created_time              datetime(6),
modified_time             datetime(6),
createdby_id              bigint,
modifiedby_id             bigint,
version                   datetime(6) not null,
constraint pk_delivery primary key (id))

Based on that I'm guessing the error happens when this table is being created but I've been unable to find a reason as to why their would be an error here.

DateTime does not have a size. It's just datetime .

call_date                 datetime,
pickup_date               datetime,
delivery_date             datetime,
...
created_time              datetime,
modified_time             datetime,
...
version                   datetime not null,

问题是我正在使用java.util.Date而不是java.sql.Date

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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