-
-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
autoIncrement ignored when combined with primaryKey #134
Comments
I have the same issue, it causes weird bugs because IDs get reuse. |
@dvdlevanon @pboguslawski |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
According to
https://www.sqlitetutorial.net/sqlite-autoincrement/
https://www.sqlite.org/autoinc.html
AUTOINCREMENT
should be used in sqlite if one want's ID values not to be reused (i.e. after row deletion).With table definition
GORM creates column without autoincrement:
but should add autoincrement also.
According to #126 one can create primary key + autoincrement with
autoIncrement
tag only but this looks like dirty hack and erroris thrown when trying to create table with
because GORM tries
ID
as PK by default (because of col name) and adds PK also toIDH
(because of wrong handling of tags like above).Expected behaviour
Column defined with
gorm:"[...];primaryKey;autoIncrement"
should be created as PK with autoincrement in sqlite db.The text was updated successfully, but these errors were encountered: