mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-11-03 20:36:07 +01:00 
			
		
		
		
	Add deprecated log when using MySQL with utf8 charset (#19952)
This commit is contained in:
		@@ -13,6 +13,8 @@ import (
 | 
				
			|||||||
	"path/filepath"
 | 
						"path/filepath"
 | 
				
			||||||
	"strings"
 | 
						"strings"
 | 
				
			||||||
	"time"
 | 
						"time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						"code.gitea.io/gitea/modules/log"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var (
 | 
					var (
 | 
				
			||||||
@@ -83,6 +85,10 @@ func InitDBConfig() {
 | 
				
			|||||||
	Database.Schema = sec.Key("SCHEMA").String()
 | 
						Database.Schema = sec.Key("SCHEMA").String()
 | 
				
			||||||
	Database.SSLMode = sec.Key("SSL_MODE").MustString("disable")
 | 
						Database.SSLMode = sec.Key("SSL_MODE").MustString("disable")
 | 
				
			||||||
	Database.Charset = sec.Key("CHARSET").In(defaultCharset, []string{"utf8", "utf8mb4"})
 | 
						Database.Charset = sec.Key("CHARSET").In(defaultCharset, []string{"utf8", "utf8mb4"})
 | 
				
			||||||
 | 
						if Database.UseMySQL && defaultCharset != "utf8mb4" {
 | 
				
			||||||
 | 
							log.Error("Deprecated database mysql charset utf8 support, please use utf8mb4 or convert utf8 to utf8mb4.")
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	Database.Path = sec.Key("PATH").MustString(filepath.Join(AppDataPath, "gitea.db"))
 | 
						Database.Path = sec.Key("PATH").MustString(filepath.Join(AppDataPath, "gitea.db"))
 | 
				
			||||||
	Database.Timeout = sec.Key("SQLITE_TIMEOUT").MustInt(500)
 | 
						Database.Timeout = sec.Key("SQLITE_TIMEOUT").MustInt(500)
 | 
				
			||||||
	Database.MaxIdleConns = sec.Key("MAX_IDLE_CONNS").MustInt(2)
 | 
						Database.MaxIdleConns = sec.Key("MAX_IDLE_CONNS").MustInt(2)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user