lxy-kit/tpl/SqlTpl.sql
2019-03-13 16:03:59 +08:00

20 lines
557 B
SQL

##(remark)
# drop table if exists `#(tableName)`;
CREATE TABLE `#(tableName)` (
`id` bigint(20) auto_increment comment '主键',
#for(x : fieldList)
#set(
field=x.field
,field=field.substring(0, 1).toLowerCase() + field.substring(1)
,isMust = x.isMust? "not null" : ""
,autoIncrement = "id".equals(field)? "auto_increment" : ""
)
#if(field != "id")
`#(field)` #(x.fieldType) #(isMust) #(autoIncrement) comment '#(x.remark)',
#end
#end
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 comment '#(remark)';