Skip to content

mysql 自增主键的问题 #422

@Harries

Description

@Harries

protected String createTableAppendField(TapField tapField) { String datatype = tapField.getDataType().toUpperCase(); String fieldSql = " " + tapField.getName() + "`" + " " + tapField.getDataType().toUpperCase();

    // auto increment
    // mysql a table can only create one auto-increment column, and must be the primary key
    if (null != tapField.getAutoInc() && tapField.getAutoInc()) {
        if (tapField.getPrimaryKeyPos() == 1) {
            fieldSql += " AUTO_INCREMENT";
        } else {
            TapLogger.warn(TAG, "Field \"{}\" cannot be auto increment in mysql, there can be only one auto column and it must be defined the first key", tapField.getName());
        }
    }`

目前我刚好第2个字段才是自增主键,导致创建表没有吧自增的属性同步过去。 感觉有点奇怪,是不是一个bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions