You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to restore my gogs database and repositories from my old system using a SQLite database to my new system using an MySQL 8.0.14 database.
During restore i get the following error:
2019/01/27 15:39:31 [ERROR] [...ogs/models/models.go:371 ImportDatabase()] Failed to reset 'created_unix': Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'release SET created_unix=? WHERE id=?' at line 1
I've been searching for the reason for this error and i have found it, in the lines 372 and 379 of the file 'models/models.go' back tics are missing around the table name.
During restore the script tries to update fields in the table with the name 'restore', but as the term 'restore' also seems to be a reserved command this fails if you just state: UPDATE restore WHERE ....
If you change this to UPDATE `restore` WHERE .... it is solved and the restore executes normally.
So change line 372 from:
if _, err = x.Exec("UPDATE "+rawTableName+" SET created_unix=? WHERE id=?", meta["CreatedUnix"], meta["ID"]); err != nil {
to
if _, err = x.Exec("UPDATE `"+rawTableName+"` SET created_unix=? WHERE id=?", meta["CreatedUnix"], meta["ID"]); err != nil {
And also the same for line 379.
Thanks for the great product!
Klaas Eenkhoorn
The text was updated successfully, but these errors were encountered:
[ ]
with[x]
):log/gogs.log
):I'm trying to restore my gogs database and repositories from my old system using a SQLite database to my new system using an MySQL 8.0.14 database.
During restore i get the following error:
I've been searching for the reason for this error and i have found it, in the lines 372 and 379 of the file 'models/models.go' back tics are missing around the table name.
During restore the script tries to update fields in the table with the name 'restore', but as the term 'restore' also seems to be a reserved command this fails if you just state:
UPDATE restore WHERE ....
If you change this to
UPDATE `restore` WHERE ....
it is solved and the restore executes normally.So change line 372 from:
to
And also the same for line 379.
Thanks for the great product!
Klaas Eenkhoorn
The text was updated successfully, but these errors were encountered: