我设计了一个表,想要一个 ID 的整数自动增量列。当然,我阅读了有关isGenerated迁移参数的文档。
现在,我的代码如下所示:
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.createTable(
new Table({
name: tableName,
columns: [
{
name: "id",
type: "int",
isGenerated: true,
isPrimary: true,
},
{
name: "seller_id",
type: "int"
}
]
})
)
}
Run Code Online (Sandbox Code Playgroud)
如您所见,id未标记为AI. 我做错了什么?