|
|
@ -330,6 +330,7 @@ func ImportDatabase(dirPath string, verbose bool) (err error) { |
|
|
|
rawTableName := x.TableName(table) |
|
|
|
rawTableName := x.TableName(table) |
|
|
|
_, isInsertProcessor := table.(xorm.BeforeInsertProcessor) |
|
|
|
_, isInsertProcessor := table.(xorm.BeforeInsertProcessor) |
|
|
|
scanner := bufio.NewScanner(f) |
|
|
|
scanner := bufio.NewScanner(f) |
|
|
|
|
|
|
|
|
|
|
|
for scanner.Scan() { |
|
|
|
for scanner.Scan() { |
|
|
|
switch bean := table.(type) { |
|
|
|
switch bean := table.(type) { |
|
|
|
case *LoginSource: |
|
|
|
case *LoginSource: |
|
|
@ -367,10 +368,13 @@ func ImportDatabase(dirPath string, verbose bool) (err error) { |
|
|
|
|
|
|
|
|
|
|
|
// Reset created_unix back to the date save in archive because Insert method updates its value
|
|
|
|
// Reset created_unix back to the date save in archive because Insert method updates its value
|
|
|
|
if isInsertProcessor && !skipInsertProcessors[rawTableName] { |
|
|
|
if isInsertProcessor && !skipInsertProcessors[rawTableName] { |
|
|
|
if _, err = x.Exec("UPDATE "+rawTableName+" SET created_unix=? WHERE id=?", meta["CreatedUnix"], meta["ID"]); err != nil { |
|
|
|
timestamp, ok := meta["CreatedUnix"].(uint64) |
|
|
|
|
|
|
|
if ok { |
|
|
|
|
|
|
|
if _, err = x.Exec("UPDATE "+rawTableName+" SET created_unix=? WHERE id=?", timestamp, meta["ID"]); err != nil { |
|
|
|
log.Error(2, "Failed to reset 'created_unix': %v", err) |
|
|
|
log.Error(2, "Failed to reset 'created_unix': %v", err) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
switch rawTableName { |
|
|
|
switch rawTableName { |
|
|
|
case "milestone": |
|
|
|
case "milestone": |
|
|
|