Answer the question
In order to leave comments, you need to log in
Why is mysql returning an error?
Here is the code
type User struct {
UserID int `sql:"AUTO_INCREMENT"`
UserLogin string `sql:"type:varchar(50)"`
UserPass string `sql:"type:varchar(200)"`
UserSaltInt string `sql:"type:bigint"`
UserSaltString string `sql:"type:text"`
}
db, err := gorm.Open("mysql", "root:[email protected]/generais?charset=utf8&parseTime=True&loc=Local")
if err != nil {
log.Fatal(err)
}
db.DB()
db.DB().Ping()
db.DB().SetMaxIdleConns(10)
db.DB().SetMaxOpenConns(100)
db.SingularTable(true)
db.CreateTable(&User{})
db.Set("gorm:table_options", "ENGINE=InnoDB").CreateTable(&User{})
(Error 1075: Incorrect table definition; there can be only one auto column and it must be defined as a key)
[2015-08-17 12:37:23]
(Error 1075: Incorrect table definition; there can be only one auto column and it must be defined as a key)
[2015-08-17 12:37:23]
(Error 1050: Table 'user' already exists)
[2015-08-17 12:42:55]
Answer the question
In order to leave comments, you need to log in
Schoolboy, you opened a ton of related questions on one task... learn how to group data.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question