powerdesigner 16.5 生成的sql语句在mysql数据库没法成功执行

导入由powerdesigner 16.5生成的sql文件到mysql执行时报出以下问题。mysql

问题1:varchar类型的字段报错。sql

解决:varchar类型的字段添加长度。ide

问题2:自增字段报错。3d

生成的sql文件内容以下:code

create table scnu_homework_answer  
(  
   answer_id            bigint not null auto_increment   
   tenant_id            bigint not null   
   answer_iscorrected   smallint not null  
   answer_tea_isdeleted smallint not null   
   answer_stu_isdeleted smallint not null  
);  
alter table scnu_homework_answer  
   add primary key (answer_id);
缘由:表的自增属性是先设置的,可是表的主键的自增是在表创建以后进行的,因此mysql才会报错。

解决:在对生成的sql文件选项进行设置时,将默认的outside改为inside便可。
blog