fix: sqlite dialector cannot apply PRIMARY KEY AUTOINCREMENT
type
fix #4760
This commit is contained in:
parent
e57e5d8884
commit
3fe5335dfd
@ -217,7 +217,7 @@ func (m Migrator) CreateTable(values ...interface{}) error {
|
|||||||
field := stmt.Schema.FieldsByDBName[dbName]
|
field := stmt.Schema.FieldsByDBName[dbName]
|
||||||
if !field.IgnoreMigration {
|
if !field.IgnoreMigration {
|
||||||
createTableSQL += "? ?"
|
createTableSQL += "? ?"
|
||||||
hasPrimaryKeyInDataType = hasPrimaryKeyInDataType || strings.Contains(strings.ToUpper(string(field.DataType)), "PRIMARY KEY")
|
hasPrimaryKeyInDataType = hasPrimaryKeyInDataType || strings.Contains(strings.ToUpper(m.DataTypeOf(field)), "PRIMARY KEY")
|
||||||
values = append(values, clause.Column{Name: dbName}, m.DB.Migrator().FullDataTypeOf(field))
|
values = append(values, clause.Column{Name: dbName}, m.DB.Migrator().FullDataTypeOf(field))
|
||||||
createTableSQL += ","
|
createTableSQL += ","
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user