Bit and tinyint data types support
This commit is contained in:
parent
54af37ef9a
commit
2d3983b992
1 changed files with 6 additions and 12 deletions
|
@ -279,13 +279,10 @@ func (m *MSSQLDriver) ForeignKeyInfo(schema, tableName string) ([]bdb.ForeignKey
|
||||||
func (m *MSSQLDriver) TranslateColumnType(c bdb.Column) bdb.Column {
|
func (m *MSSQLDriver) TranslateColumnType(c bdb.Column) bdb.Column {
|
||||||
if c.Nullable {
|
if c.Nullable {
|
||||||
switch c.DBType {
|
switch c.DBType {
|
||||||
|
case "bit":
|
||||||
|
c.Type = "bool"
|
||||||
case "tinyint":
|
case "tinyint":
|
||||||
// map tinyint(1) to bool if TinyintAsBool is true
|
c.Type = "int8"
|
||||||
if TinyintAsBool && c.FullDBType == "tinyint(1)" {
|
|
||||||
c.Type = "null.Bool"
|
|
||||||
} else {
|
|
||||||
c.Type = "null.Int8"
|
|
||||||
}
|
|
||||||
case "smallint":
|
case "smallint":
|
||||||
c.Type = "null.Int16"
|
c.Type = "null.Int16"
|
||||||
case "mediumint":
|
case "mediumint":
|
||||||
|
@ -311,13 +308,10 @@ func (m *MSSQLDriver) TranslateColumnType(c bdb.Column) bdb.Column {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch c.DBType {
|
switch c.DBType {
|
||||||
|
case "bit":
|
||||||
|
c.Type = "bool"
|
||||||
case "tinyint":
|
case "tinyint":
|
||||||
// map tinyint(1) to bool if TinyintAsBool is true
|
c.Type = "int8"
|
||||||
if TinyintAsBool && c.FullDBType == "tinyint(1)" {
|
|
||||||
c.Type = "bool"
|
|
||||||
} else {
|
|
||||||
c.Type = "int8"
|
|
||||||
}
|
|
||||||
case "smallint":
|
case "smallint":
|
||||||
c.Type = "int16"
|
c.Type = "int16"
|
||||||
case "mediumint":
|
case "mediumint":
|
||||||
|
|
Loading…
Add table
Reference in a new issue