Adding Auto Increment to the Second Key of a Composite Key

Hello,

I am trying to add an auto increment for the second key of my composite key but I am getting an error:

<changeSet author="a1" id="1">

<createTable tableName="AgentDef">

<column name="Tenant_Id" type="VARCHAR(36)">

<constraints primaryKey="true" />

<column name="AgentId" type="INTEGER" autoIncrement="true">

<constraints primaryKey="true" />

<column name="AgentName" type="VARCHAR(255)" />

I am getting the following exception:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration$LiquibaseConfiguration.class]: Invocation of init method failed; nested exception is liquibase.exception.MigrationFailedException: Migration failed for change set       Reason: liquibase.exception.DatabaseException: Incorrect table definition; there can be only one auto column and it must be defined as a key

Noting the following:

- The AgentId field should be kept as the second field in the primary key set and Tenant_Id should be the first field. If I change the order, the exception does not happen and database works fine.