Merge branch 'lichang' into lite
This commit is contained in:
@@ -97,13 +97,19 @@ func processSQLFile(db *gorm.DB, filePath string) {
|
|||||||
// log.Printf("Exec SQL: %s\n", line)
|
// log.Printf("Exec SQL: %s\n", line)
|
||||||
// log.Println(err.Error())
|
// log.Println(err.Error())
|
||||||
if strings.Contains(errorStr, "duplicate column") {
|
if strings.Contains(errorStr, "duplicate column") {
|
||||||
// 忽略重复字段错误 Error 1060 (42S21): Duplicate column name 'field_name'
|
// 忽略重复字段错误
|
||||||
|
// Error 1060 (42S21): Duplicate column name 'field_name'
|
||||||
|
// SQL logic error: duplicate column name: title (1)
|
||||||
} else if strings.Contains(errorStr, "duplicate key") {
|
} else if strings.Contains(errorStr, "duplicate key") {
|
||||||
// 忽略重复索引错误 Error 1061 (42000): Duplicate key name 'key_name'
|
// 忽略重复索引错误
|
||||||
|
// Error 1061 (42000): Duplicate key name 'key_name'
|
||||||
} else if strings.Contains(errorStr, "unknown column") {
|
} else if strings.Contains(errorStr, "unknown column") {
|
||||||
// 忽略未知字段错误 Error 1054 (42S22): Unknown column 'field_name' in 'table'
|
// 忽略未知字段错误
|
||||||
} else if strings.Contains(errorStr, "check that it exists") {
|
// Error 1054 (42S22): Unknown column 'field_name' in 'table'
|
||||||
// 忽略删除字段错误 Error 1091 (42000): Can't DROP COLUMN `field_name`; check that it exists
|
} else if strings.Contains(errorStr, "can't drop") {
|
||||||
|
// 忽略删除字段或索引错误
|
||||||
|
// Error 1091 (42000): Can't DROP COLUMN `field_name`; check that it exists
|
||||||
|
// Error 1091 (42000): Can't DROP 'idx_ne_type_id'; check that column/key exists
|
||||||
} else {
|
} else {
|
||||||
// 其他错误终止程序
|
// 其他错误终止程序
|
||||||
log.Fatalln(errorStr)
|
log.Fatalln(errorStr)
|
||||||
|
|||||||
Reference in New Issue
Block a user