[MM-36995] Start using db native JSON datatypes (#17930)
* Start using db native JSON datatypes * Fix syntax to work on MySQL 5.7.12
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
1c63e6a848
Коммит
1ae1c38c9f
9
vendor/github.com/mattermost/gorp/column.go
сгенерированный
поставляемый
9
vendor/github.com/mattermost/gorp/column.go
сгенерированный
поставляемый
@@ -41,6 +41,9 @@ type ColumnMap struct {
|
||||
|
||||
DefaultValue string
|
||||
|
||||
// The column data type. If set it overrides the one converted from the Go type.
|
||||
DataType string
|
||||
|
||||
fieldName string
|
||||
gotype reflect.Type
|
||||
isPK bool
|
||||
@@ -86,6 +89,12 @@ func (c *ColumnMap) SetMaxSize(size int) *ColumnMap {
|
||||
return c
|
||||
}
|
||||
|
||||
// SetDataType allows to specify a custom data type for the column.
|
||||
func (c *ColumnMap) SetDataType(dataType string) *ColumnMap {
|
||||
c.DataType = dataType
|
||||
return c
|
||||
}
|
||||
|
||||
// SetDefaultConstraint adds " default 'value'" to the create table statements for this
|
||||
// column, if value is not nil. Not used elsewhere
|
||||
func (c *ColumnMap) SetDefaultConstraint(value *string) *ColumnMap {
|
||||
|
||||
7
vendor/github.com/mattermost/gorp/table.go
сгенерированный
поставляемый
7
vendor/github.com/mattermost/gorp/table.go
сгенерированный
поставляемый
@@ -215,7 +215,12 @@ func (t *TableMap) SqlForCreate(ifNotExists bool) string {
|
||||
if x > 0 {
|
||||
s.WriteString(", ")
|
||||
}
|
||||
stype := dialect.ToSqlType(col.gotype, col.MaxSize, col.isAutoIncr)
|
||||
|
||||
stype := col.DataType
|
||||
if stype == "" {
|
||||
stype = dialect.ToSqlType(col.gotype, col.MaxSize, col.isAutoIncr)
|
||||
}
|
||||
|
||||
s.WriteString(fmt.Sprintf("%s %s", dialect.QuoteField(col.ColumnName), stype))
|
||||
|
||||
if col.isPK || col.isNotNull {
|
||||
|
||||
Ссылка в новой задаче
Block a user