Open phil9909 opened 6 months ago
Generally, An SQL statement can have only one primary key
Hi @gg1229505432, thank you for your replay.
Generally, An SQL statement can have only one primary key
Yes, a SQL relation (I guess this is what you meant with statement, because a statement does not have a primary key, it might specify one, if it's a DDL statement) can only have one primary key, hence the name primary key.
But that is completely unrelated to this issue. I don't want multiple primary keys, that would be insane :sweat_smile:
What I want is a composite primary key, which as per documentation gorm supports: https://gorm.io/docs/composite_primary_key.html and as I said already: It was even working in older versions
I have the same problem with 1.5.6. Downgrading to 1.5.3 solves this.
GORM Playground Link
https://github.com/go-gorm/playground/pull/712
Description
For the following model
this SQL DDL is generated
Notice: The
user_id
is missing thePRIMARY KEY
constraintIt worked fine with
gorm.io/driver/sqlite v1.5.3
but is broken ingorm.io/driver/sqlite v1.5.4