小编Саш*_*сий的帖子

如何在TypeORM迁移中创建自增整数字段?

我设计了一个表,想要一个 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. 我做错了什么?

mysql database typeorm node.js-typeorm

3
推荐指数
1
解决办法
3992
查看次数

标签 统计

database ×1

mysql ×1

node.js-typeorm ×1

typeorm ×1