Set multiple fields as primary key to enable composite primary key
type Product struct { |
Note that integer fields with primary_key
tag are auto_increment
by default. That can result in multiple auto-incremented integer primary keys instead of a single composite primary key.
To create the composite primary key containing ints you need to turn off auto_increment
for the int fields:
type Product struct { |