mirror of
https://github.com/go-gitea/gitea
synced 2025-09-28 03:28:13 +00:00
Add support for database schema in PostgreSQL (#8819)
* Add support for database schema * Require setting search_path for the db user * Add schema setting to admin/config.tmpl * Use a schema different from default for psql tests * Update postgres scripts to use custom schema * Update to xorm/core 0.7.3 and xorm/xorm c37aff9b3a * Fix migration test Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
committed by
Antoine GIRARD
parent
6d6f1d568e
commit
ad1b6d439f
120
vendor/xorm.io/core/.drone.yml
generated
vendored
120
vendor/xorm.io/core/.drone.yml
generated
vendored
@@ -1,128 +1,8 @@
|
||||
---
|
||||
kind: pipeline
|
||||
name: go1.10
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
clone:
|
||||
disable: true
|
||||
|
||||
workspace:
|
||||
base: /go
|
||||
path: src/xorm.io/core
|
||||
|
||||
steps:
|
||||
- name: git
|
||||
pull: default
|
||||
image: plugins/git:next
|
||||
settings:
|
||||
depth: 50
|
||||
tags: true
|
||||
|
||||
- name: test
|
||||
pull: default
|
||||
image: golang:1.10
|
||||
commands:
|
||||
- go get github.com/stretchr/testify/assert
|
||||
- go get github.com/go-xorm/sqlfiddle
|
||||
- go get github.com/go-sql-driver/mysql
|
||||
- go get github.com/mattn/go-sqlite3
|
||||
- go vet
|
||||
- "go test -v -race -coverprofile=coverage.txt -covermode=atomic -dbConn=\"root:@tcp(mysql:3306)/core_test?charset=utf8mb4\""
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
- tag
|
||||
- pull_request
|
||||
|
||||
services:
|
||||
- name: mysql
|
||||
pull: default
|
||||
image: mysql:5.7
|
||||
environment:
|
||||
MYSQL_ALLOW_EMPTY_PASSWORD: yes
|
||||
MYSQL_DATABASE: core_test
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
- tag
|
||||
- pull_request
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
name: go1.11
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
clone:
|
||||
disable: true
|
||||
|
||||
workspace:
|
||||
base: /go
|
||||
path: src/xorm.io/core
|
||||
|
||||
steps:
|
||||
- name: git
|
||||
pull: default
|
||||
image: plugins/git:next
|
||||
settings:
|
||||
depth: 50
|
||||
tags: true
|
||||
|
||||
- name: test
|
||||
pull: default
|
||||
image: golang:1.11
|
||||
commands:
|
||||
- go vet
|
||||
- "go test -v -race -coverprofile=coverage.txt -covermode=atomic -dbConn=\"root:@tcp(mysql:3306)/core_test?charset=utf8mb4\""
|
||||
environment:
|
||||
GO111MODULE: "on"
|
||||
GOPROXY: https://goproxy.cn
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
- tag
|
||||
- pull_request
|
||||
|
||||
services:
|
||||
- name: mysql
|
||||
pull: default
|
||||
image: mysql:5.7
|
||||
environment:
|
||||
MYSQL_ALLOW_EMPTY_PASSWORD: yes
|
||||
MYSQL_DATABASE: core_test
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
- tag
|
||||
- pull_request
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
name: go1.12
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
clone:
|
||||
disable: true
|
||||
|
||||
workspace:
|
||||
base: /go
|
||||
path: src/xorm.io/core
|
||||
|
||||
steps:
|
||||
- name: git
|
||||
pull: default
|
||||
image: plugins/git:next
|
||||
settings:
|
||||
depth: 50
|
||||
tags: true
|
||||
|
||||
- name: test
|
||||
pull: default
|
||||
|
2
vendor/xorm.io/core/README.md
generated
vendored
2
vendor/xorm.io/core/README.md
generated
vendored
@@ -1,7 +1,7 @@
|
||||
Core is a lightweight wrapper of sql.DB.
|
||||
|
||||
[](https://drone.gitea.com/xorm/core)
|
||||
[](http://gocover.io/xorm.io/core)
|
||||
[](https://gocover.io/xorm.io/core)
|
||||
[](https://goreportcard.com/report/xorm.io/core)
|
||||
|
||||
# Open
|
||||
|
4
vendor/xorm.io/core/column.go
generated
vendored
4
vendor/xorm.io/core/column.go
generated
vendored
@@ -37,7 +37,7 @@ type Column struct {
|
||||
IsDeleted bool
|
||||
IsCascade bool
|
||||
IsVersion bool
|
||||
DefaultIsEmpty bool
|
||||
DefaultIsEmpty bool // false means column has no default set, but not default value is empty
|
||||
EnumOptions map[string]int
|
||||
SetOptions map[string]int
|
||||
DisableTimeZone bool
|
||||
@@ -65,7 +65,7 @@ func NewColumn(name, fieldName string, sqlType SQLType, len1, len2 int, nullable
|
||||
IsDeleted: false,
|
||||
IsCascade: false,
|
||||
IsVersion: false,
|
||||
DefaultIsEmpty: false,
|
||||
DefaultIsEmpty: true, // default should be no default
|
||||
EnumOptions: make(map[string]int),
|
||||
Comment: "",
|
||||
}
|
||||
|
4
vendor/xorm.io/core/index.go
generated
vendored
4
vendor/xorm.io/core/index.go
generated
vendored
@@ -26,8 +26,8 @@ type Index struct {
|
||||
func (index *Index) XName(tableName string) string {
|
||||
if !strings.HasPrefix(index.Name, "UQE_") &&
|
||||
!strings.HasPrefix(index.Name, "IDX_") {
|
||||
tableName = strings.Replace(tableName, `"`, "", -1)
|
||||
tableName = strings.Replace(tableName, `.`, "_", -1)
|
||||
tableParts := strings.Split(strings.Replace(tableName, `"`, "", -1), ".")
|
||||
tableName = tableParts[len(tableParts)-1]
|
||||
if index.Type == UniqueType {
|
||||
return fmt.Sprintf("UQE_%v_%v", tableName, index.Name)
|
||||
}
|
||||
|
Reference in New Issue
Block a user