I design a table and want an integer autoincrement column for an ID.
For sure, I read the docs about isGenerated
param for migrations.
Now, my code looks like this:
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"
}
]
})
)
}
As you can see, id
is not flagged as AI
. What I'm doing wrong?
CodePudding user response:
{
name: "id",
type: "int",
isPrimary: true,
isGenerated: true,
generationStrategy: "increment"
},
available options:
generationStrategy?: "uuid" | "increment" | "rowid" | "identity";