From dcfaed6a1175a5e621ebdf0d6163db7d3705b2a8 Mon Sep 17 00:00:00 2001 From: Andrew Thornton Date: Wed, 7 Apr 2021 18:24:04 +0100 Subject: [PATCH] MariaDB 10.5 adds a suffix on old datatypes MariaDB when encountering an old datetime type will add a suffix of /* mariadb-5.3 */ on its schema information page. Xorm does not understand this and then its mappings fail. The simplest solution is just to remove any fixed suffix and that is what this PR does - a clever solution would look for and remove any comments or match them. See https://mariadb.com/kb/en/time/ for more details about the comment. Signed-off-by: Andrew Thornton --- dialects/mysql.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dialects/mysql.go b/dialects/mysql.go index 32e18a17..769e30b1 100644 --- a/dialects/mysql.go +++ b/dialects/mysql.go @@ -353,6 +353,8 @@ func (db *mysql) GetColumns(queryer core.Queryer, ctx context.Context, tableName cts := strings.Split(colType, "(") colName := cts[0] + // Remove the /* mariadb-5.3 */ suffix from coltypes + colName = strings.TrimSuffix(colName, "/* mariadb-5.3 */") colType = strings.ToUpper(colName) var len1, len2 int if len(cts) == 2 {