Browse Source

models: add ROW_FORMAT=DYNAMIC when creating table for supports mysql 5.6 (#4913)

* Add ROW_FORMAT=DYNAMIC when creating table for supports mysql 5.6 (fix #4894)

* Update models.go

Rename NewEngine2 to NewEngineWithParams

* Rename NewEngine2 to NewEngineWithParams

Please update vendor when https://github.com/go-xorm/xorm/pull/798 closed.

* Update dialect_mysql.go

* Update dialect_mysql.go

* Update models.go
pull/5126/head
m2nlight 7 years ago committed by jc
parent
commit
aa53d0978c
  1. 2
      models/models.go
  2. 3
      scripts/mysql.sql

2
models/models.go

@ -140,6 +140,8 @@ func getEngine() (*xorm.Engine, error) {
connStr = fmt.Sprintf("%s:%s@tcp(%s)/%s%scharset=utf8mb4&parseTime=true", connStr = fmt.Sprintf("%s:%s@tcp(%s)/%s%scharset=utf8mb4&parseTime=true",
DbCfg.User, DbCfg.Passwd, DbCfg.Host, DbCfg.Name, Param) DbCfg.User, DbCfg.Passwd, DbCfg.Host, DbCfg.Name, Param)
} }
var engineParams = map[string]string{"rowFormat": "DYNAMIC"}
return xorm.NewEngineWithParams(DbCfg.Type, connStr, engineParams)
case "postgres": case "postgres":
host, port := parsePostgreSQLHostPort(DbCfg.Host) host, port := parsePostgreSQLHostPort(DbCfg.Host)
if host[0] == '/' { // looks like a unix socket if host[0] == '/' { // looks like a unix socket

3
scripts/mysql.sql

@ -1,2 +1,5 @@
SET GLOBAL innodb_file_per_table = ON,
innodb_file_format = Barracuda,
innodb_large_prefix = ON;
DROP DATABASE IF EXISTS gogs; DROP DATABASE IF EXISTS gogs;
CREATE DATABASE IF NOT EXISTS gogs CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; CREATE DATABASE IF NOT EXISTS gogs CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

Loading…
Cancel
Save