8000 Can not add primary key · Issue #3537 · go-gorm/gorm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Can not add primary key #3537
Closed
Closed
@00LT00

Description

@00LT00

GORM Playground Link

go-gorm/playground#1

Description

My previous struct is :

type Rule struct {
	PType string `gorm:"size:40;uniqueIndex:unique_index"`
	V0    string `gorm:"size:40;uniqueIndex:unique_index"`
	V1    string `gorm:"size:40;uniqueIndex:unique_index"`
}

Now, I add primary key for this table like this:

type Rule struct {
	ID    uint
	PType string `gorm:"size:40;uniqueIndex:unique_index"`
	V0    string `gorm:"size:40;uniqueIndex:unique_index"`
	V1    string `gorm:"size:40;uniqueIndex:unique_index"`
}

I get a error

Error 1075: Incorrect table definition; there can be only one auto column and it must be defined as a key

But my table doesn't have auto column
image
Maybe it was error of Mysql?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0