Print a helpful message for JSON column update failures. (#18041)

Automatic Merge
This commit is contained in:
Agniva De Sarker
2021-08-03 00:35:03 +05:30
committed by GitHub
parent 370321a823
commit f2119d60fa

View File

@@ -920,7 +920,11 @@ func (ss *SqlStore) AlterColumnTypeIfExists(tableName string, columnName string,
}
if err != nil {
mlog.Critical("Failed to alter column type", mlog.Err(err))
msg := "Failed to alter column type."
if mySqlColType == "JSON" && postgresColType == "jsonb" {
msg += " It is likely you have invalid JSON values in the column. Please fix the values manually and run the migration again."
}
mlog.Critical(msg, mlog.Err(err))
time.Sleep(time.Second)
os.Exit(ExitAlterColumn)
}