Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Set COMPATIBILITY_LEVEL in MSSQL testing #16628

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions integrations/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,10 @@ func initIntegrationTest() {
if _, err := db.Exec(fmt.Sprintf("If(db_id(N'%s') IS NULL) BEGIN CREATE DATABASE %s; END;", setting.Database.Name, setting.Database.Name)); err != nil {
log.Fatal("db.Exec: %v", err)
}
// set COMPATIBILITY_LEVEL to the lowest we will support
if _, err := db.Exec(fmt.Sprintf("BEGIN ALTER DATABASE %s SET COMPATIBILITY_LEVEL = 100; END;", setting.Database.Name)); err != nil {
log.Fatal("db.Exec: %v", err)
}
defer db.Close()
}
routers.GlobalInit(graceful.GetManager().HammerContext())
Expand Down
4 changes: 4 additions & 0 deletions models/migrations/migrations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ func deleteDB() error {
if _, err = db.Exec(fmt.Sprintf("CREATE DATABASE [%s]", setting.Database.Name)); err != nil {
return err
}
// set COMPATIBILITY_LEVEL to the lowest we will support
if _, err := db.Exec(fmt.Sprintf("BEGIN ALTER DATABASE %s SET COMPATIBILITY_LEVEL = 100; END;", setting.Database.Name)); err != nil {
return err
}
}

return nil
Expand Down