From ad4830f531cdf18cb742d5dd4f810b411931af1f Mon Sep 17 00:00:00 2001 From: Andrew Thornton Date: Fri, 23 Jul 2021 08:59:53 +0800 Subject: [PATCH] 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 Reviewed-on: https://gitea.com/xorm/xorm/pulls/1959 Reviewed-by: Lunny Xiao Co-authored-by: Andrew Thornton Co-committed-by: Andrew Thornton --- dialects/mssql.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dialects/mssql.go b/dialects/mssql.go index 7deade80..3b935396 100644 --- a/dialects/mssql.go +++ b/dialects/mssql.go @@ -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: