Skip to content

Commit

Permalink
Remove the config for default varchar since it's unnecessary
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny committed Jul 20, 2020
1 parent 1be881e commit 5fe2453
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 10 deletions.
3 changes: 0 additions & 3 deletions custom/conf/app.example.ini
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,6 @@ SSL_MODE = disable
; For MySQL only, either "utf8" or "utf8mb4", default is "utf8mb4".
; NOTICE: for "utf8mb4" you must use MySQL InnoDB > 5.6. Gitea is unable to check this.
CHARSET = utf8mb4
; For Mssql only, either "varchar" or "nvarchar", default is "nvarchar"
; NOTICE: if you changed the config, you have to convert the original columns type manually
DEFAULT_VARCHAR = nvarchar
; For "sqlite3" and "tidb", use an absolute path when you start gitea as service
PATH = data/gitea.db
; For "sqlite3" only. Query timeout
Expand Down
1 change: 0 additions & 1 deletion docs/content/doc/advanced/config-cheat-sheet.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
- `verify-ca`: Enable TLS with verification of the database server certificate against its root certificate.
- `verify-full`: Enable TLS and verify the database server name matches the given certificate in either the `Common Name` or `Subject Alternative Name` fields.
- `CHARSET`: **utf8mb4**: For MySQL only, either "utf8" or "utf8mb4". NOTICE: for "utf8mb4" you must use MySQL InnoDB > 5.6. Gitea is unable to check this.
- `DEFAULT_VARCHAR`: **nvarchar**: For Mssql only, either "varchar" or "nvarchar"; If you changed the config, you have to convert the original columns type manually.
- `PATH`: **data/gitea.db**: For SQLite3 only, the database file path.
- `LOG_SQL`: **true**: Log the executed SQL.
- `DB_RETRIES`: **10**: How many ORM init / DB connect attempts allowed.
Expand Down
1 change: 0 additions & 1 deletion docs/content/doc/advanced/config-cheat-sheet.zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ menu:
- `PASSWD`: 数据库用户密码。
- `SSL_MODE`: MySQL 或 PostgreSQL数据库是否启用SSL模式。
- `CHARSET`: **utf8mb4**: 仅当数据库为 MySQL 时有效, 可以为 "utf8" 或 "utf8mb4"。注意:如果使用 "utf8mb4",你的 MySQL InnoDB 版本必须在 5.6 以上。
- `DEFAULT_VARCHAR`: **nvarchar**: 仅当数据库为 Mssql 时有效, 可以为 "varchar" 或 "nvarchar"。如果改变了此项配置,你需要手动修改数据库中所有已创建的字段为指定的类型。
- `PATH`: Tidb 或者 SQLite3 数据文件存放路径。
- `LOG_SQL`: **true**: 显示生成的SQL,默认为真。
- `MAX_IDLE_CONNS` **0**: 最大空闲数据库连接
Expand Down
2 changes: 1 addition & 1 deletion models/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func getEngine() (*xorm.Engine, error) {
if setting.Database.Type == "mysql" {
engine.Dialect().SetParams(map[string]string{"rowFormat": "DYNAMIC"})
} else if setting.Database.Type == "mssql" {
engine.Dialect().SetParams(map[string]string{"DEFAULT_VARCHAR": setting.Database.DefaultVarchar})
engine.Dialect().SetParams(map[string]string{"DEFAULT_VARCHAR": "nvarchar"})
}
engine.SetSchema(setting.Database.Schema)
return engine, nil
Expand Down
5 changes: 1 addition & 4 deletions modules/setting/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ var (
Path string
LogSQL bool
Charset string
DefaultVarchar string
Timeout int // seconds
UseSQLite3 bool
UseMySQL bool
Expand All @@ -48,8 +47,7 @@ var (
ConnMaxLifetime time.Duration
IterateBufferSize int
}{
DefaultVarchar: "nvarchar",
Timeout: 500,
Timeout: 500,
}
)

Expand Down Expand Up @@ -81,7 +79,6 @@ func InitDBConfig() {
Database.Schema = sec.Key("SCHEMA").String()
Database.SSLMode = sec.Key("SSL_MODE").MustString("disable")
Database.Charset = sec.Key("CHARSET").In("utf8", []string{"utf8", "utf8mb4"})
Database.DefaultVarchar = sec.Key("DEFAULT_VARCHAR").In("varchar", []string{"varchar", "nvarchar"})
Database.Path = sec.Key("PATH").MustString(filepath.Join(AppDataPath, "gitea.db"))
Database.Timeout = sec.Key("SQLITE_TIMEOUT").MustInt(500)
Database.MaxIdleConns = sec.Key("MAX_IDLE_CONNS").MustInt(2)
Expand Down

0 comments on commit 5fe2453

Please sign in to comment.