feat: support modify the varchar type column of postgresql database in sync function
This commit is contained in:
parent
0c9a2f6a70
commit
c44e147a9f
6
sync.go
6
sync.go
|
@ -168,7 +168,8 @@ func (session *Session) SyncWithOptions(opts SyncOptions, beans ...interface{})
|
|||
tbNameWithSchema, col.Name, curType, expectedType)
|
||||
}
|
||||
} else if strings.HasPrefix(curType, schemas.Varchar) && strings.HasPrefix(expectedType, schemas.Varchar) {
|
||||
if engine.dialect.URI().DBType == schemas.MYSQL {
|
||||
if engine.dialect.URI().DBType == schemas.POSTGRES ||
|
||||
engine.dialect.URI().DBType == schemas.MYSQL {
|
||||
if oriCol.Length < col.Length {
|
||||
engine.logger.Infof("Table %s column %s change type from varchar(%d) to varchar(%d)\n",
|
||||
tbNameWithSchema, col.Name, oriCol.Length, col.Length)
|
||||
|
@ -184,7 +185,8 @@ func (session *Session) SyncWithOptions(opts SyncOptions, beans ...interface{})
|
|||
}
|
||||
}
|
||||
} else if expectedType == schemas.Varchar {
|
||||
if engine.dialect.URI().DBType == schemas.MYSQL {
|
||||
if engine.dialect.URI().DBType == schemas.POSTGRES ||
|
||||
engine.dialect.URI().DBType == schemas.MYSQL {
|
||||
if oriCol.Length < col.Length {
|
||||
engine.logger.Infof("Table %s column %s change type from varchar(%d) to varchar(%d)\n",
|
||||
tbNameWithSchema, col.Name, oriCol.Length, col.Length)
|
||||
|
|
Loading…
Reference in New Issue