mirror of
https://github.com/go-gitea/gitea.git
synced 2024-11-15 09:58:28 -07:00
Remove If Exist check on migration for mssql because that syntax required SQL server 2016 (#30894)
Fix #30872 We will assume the database is consistent before executing the migration. So the indexes should exist. Removing `IF EXIST` then is safe enough. --------- Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
parent
1f3ada47a3
commit
40de54ece8
@ -1,3 +1,5 @@
|
|||||||
-
|
-
|
||||||
id: 1
|
id: 1
|
||||||
|
user_id: 1
|
||||||
|
pull_id: 1
|
||||||
commit_sha: 19fe5caf872476db265596eaac1dc35ad1c6422d
|
commit_sha: 19fe5caf872476db265596eaac1dc35ad1c6422d
|
||||||
|
@ -36,9 +36,9 @@ func expandHashReferencesToSha256(x *xorm.Engine) error {
|
|||||||
if setting.Database.Type.IsMSSQL() {
|
if setting.Database.Type.IsMSSQL() {
|
||||||
// drop indexes that need to be re-created afterwards
|
// drop indexes that need to be re-created afterwards
|
||||||
droppedIndexes := []string{
|
droppedIndexes := []string{
|
||||||
"DROP INDEX IF EXISTS [IDX_commit_status_context_hash] ON [commit_status]",
|
"DROP INDEX [IDX_commit_status_context_hash] ON [commit_status]",
|
||||||
"DROP INDEX IF EXISTS [UQE_review_state_pull_commit_user] ON [review_state]",
|
"DROP INDEX [UQE_review_state_pull_commit_user] ON [review_state]",
|
||||||
"DROP INDEX IF EXISTS [UQE_repo_archiver_s] ON [repo_archiver]",
|
"DROP INDEX [UQE_repo_archiver_s] ON [repo_archiver]",
|
||||||
}
|
}
|
||||||
for _, s := range droppedIndexes {
|
for _, s := range droppedIndexes {
|
||||||
_, err := db.Exec(s)
|
_, err := db.Exec(s)
|
||||||
|
@ -19,21 +19,21 @@ func PrepareOldRepository(t *testing.T) (*xorm.Engine, func()) {
|
|||||||
|
|
||||||
type CommitStatus struct {
|
type CommitStatus struct {
|
||||||
ID int64
|
ID int64
|
||||||
ContextHash string
|
ContextHash string `xorm:"char(40) index"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type RepoArchiver struct {
|
type RepoArchiver struct {
|
||||||
ID int64
|
ID int64
|
||||||
RepoID int64
|
RepoID int64 `xorm:"index unique(s)"`
|
||||||
Type int
|
Type int `xorm:"unique(s)"`
|
||||||
CommitID string
|
CommitID string `xorm:"VARCHAR(40) unique(s)"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ReviewState struct {
|
type ReviewState struct {
|
||||||
ID int64
|
ID int64
|
||||||
CommitSHA string
|
UserID int64 `xorm:"NOT NULL UNIQUE(pull_commit_user)"`
|
||||||
UserID int64
|
PullID int64 `xorm:"NOT NULL INDEX UNIQUE(pull_commit_user) DEFAULT 0"`
|
||||||
PullID int64
|
CommitSHA string `xorm:"NOT NULL VARCHAR(40) UNIQUE(pull_commit_user)"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Comment struct {
|
type Comment struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user