Remove default length of 50 for Blob (#1959)

There is an odd inconsistency with default blob sizes - this PR only sets the
default size for bytea and binary.

Signed-off-by: Andrew Thornton <art27@cantab.net>

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1959
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Andrew Thornton <art27@cantab.net>
Co-committed-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
Andrew Thornton 2021-07-23 08:59:53 +08:00 committed by Lunny Xiao
parent 6f79e06376
commit ad4830f531
1 changed files with 6 additions and 1 deletions

View File

@ -303,11 +303,16 @@ func (db *mssql) SQLType(c *schemas.Column) string {
c.IsPrimaryKey = true
c.Nullable = false
res = schemas.BigInt
case schemas.Bytea, schemas.Blob, schemas.Binary, schemas.TinyBlob, schemas.MediumBlob, schemas.LongBlob:
case schemas.Bytea, schemas.Binary:
res = schemas.VarBinary
if c.Length == 0 {
c.Length = 50
}
case schemas.Blob, schemas.TinyBlob, schemas.MediumBlob, schemas.LongBlob:
res = schemas.VarBinary
if c.Length == 0 {
res += "(MAX)"
}
case schemas.TimeStamp:
res = schemas.DateTime
case schemas.TimeStampz: