diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2023-12-31 13:00:35 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-31 05:00:35 +0000 |
commit | da58bb85fa4ff8a37f843d09452b4244b18f93ce (patch) | |
tree | b1b79552332abc25d1fd65ea65ded1f4de3babdf /tests/integration | |
parent | f8a1bad883aa4697b4001f74e2074898d7162aef (diff) | |
download | gitea-da58bb85fa4ff8a37f843d09452b4244b18f93ce.tar.gz gitea-da58bb85fa4ff8a37f843d09452b4244b18f93ce.zip |
Upgrade xorm to new version which supported update join for all supported databases (#28590)
Fix https://github.com/go-gitea/gitea/pull/28547#issuecomment-1867740842
Since https://gitea.com/xorm/xorm/pulls/2383 merged, xorm now supports
UPDATE JOIN.
To keep consistent from different databases, xorm use
`engine.Join().Update`, but the actural generated SQL are different
between different databases.
For MySQL, it's `UPDATE talbe1 JOIN table2 ON join_conditions SET xxx
Where xxx`.
For MSSQL, it's `UPDATE table1 SET xxx FROM TABLE1, TABLE2 WHERE
join_conditions`.
For SQLITE per https://www.sqlite.org/lang_update.html, sqlite support
`UPDATE table1 SET xxx FROM table2 WHERE join conditions` from
3.33.0(2020-8-14).
POSTGRES is the same as SQLITE.
Diffstat (limited to 'tests/integration')
-rw-r--r-- | tests/integration/migrate_test.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/integration/migrate_test.go b/tests/integration/migrate_test.go index f25329f66b..2f44de8a4f 100644 --- a/tests/integration/migrate_test.go +++ b/tests/integration/migrate_test.go @@ -12,6 +12,8 @@ import ( "testing" auth_model "code.gitea.io/gitea/models/auth" + "code.gitea.io/gitea/models/db" + issues_model "code.gitea.io/gitea/models/issues" repo_model "code.gitea.io/gitea/models/repo" "code.gitea.io/gitea/models/unittest" user_model "code.gitea.io/gitea/models/user" @@ -99,3 +101,10 @@ func TestMigrateGiteaForm(t *testing.T) { unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{Name: migratedRepoName}) }) } + +func Test_UpdateCommentsMigrationsByType(t *testing.T) { + assert.NoError(t, unittest.PrepareTestDatabase()) + + err := issues_model.UpdateCommentsMigrationsByType(db.DefaultContext, structs.GithubService, "1", 1) + assert.NoError(t, err) +} |