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 <art27@cantab.net>
This commit is contained in:
Andrew Thornton 2021-04-07 18:24:04 +01:00
parent 40ee326cac
commit dcfaed6a11
No known key found for this signature in database
GPG Key ID: 3CDE74631F13A748
1 changed files with 2 additions and 0 deletions

View File

@ -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 {