I have the following table channels
in my db with id
being primary key and telegram_id
being unique.
If I try to run this code:
db.Create(&models.Channel{
TelegramID: 5,
Title: "ok",
})
it won't be inserted into db and the duplicate entry error will be logged in console.
However if I change TelegramID
to be different (for example "6") and run the code, it will insert with ID being equal to 11, not to 10.
How can I make it not to auto-increment ID when the data is not inserted?