Fix Oracle Table creation default value (#2190)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2190 Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: stevefan1999 <stevefan1999@noreply.gitea.io> Co-committed-by: stevefan1999 <stevefan1999@noreply.gitea.io>
This commit is contained in:
parent
bd58520020
commit
3acabdaf26
|
@ -548,7 +548,14 @@ func (db *oracle) Features() *DialectFeatures {
|
||||||
func (db *oracle) SQLType(c *schemas.Column) string {
|
func (db *oracle) SQLType(c *schemas.Column) string {
|
||||||
var res string
|
var res string
|
||||||
switch t := c.SQLType.Name; t {
|
switch t := c.SQLType.Name; t {
|
||||||
case schemas.Bit, schemas.TinyInt, schemas.SmallInt, schemas.MediumInt, schemas.Int, schemas.Integer, schemas.BigInt, schemas.Bool, schemas.Serial, schemas.BigSerial:
|
case schemas.Bool:
|
||||||
|
if c.Default == "true" {
|
||||||
|
c.Default = "1"
|
||||||
|
} else if c.Default == "false" {
|
||||||
|
c.Default = "0"
|
||||||
|
}
|
||||||
|
res = "NUMBER(1,0)"
|
||||||
|
case schemas.Bit, schemas.TinyInt, schemas.SmallInt, schemas.MediumInt, schemas.Int, schemas.Integer, schemas.BigInt, schemas.Serial, schemas.BigSerial:
|
||||||
res = "NUMBER"
|
res = "NUMBER"
|
||||||
case schemas.Binary, schemas.VarBinary, schemas.Blob, schemas.TinyBlob, schemas.MediumBlob, schemas.LongBlob, schemas.Bytea:
|
case schemas.Binary, schemas.VarBinary, schemas.Blob, schemas.TinyBlob, schemas.MediumBlob, schemas.LongBlob, schemas.Bytea:
|
||||||
return schemas.Blob
|
return schemas.Blob
|
||||||
|
|
Loading…
Reference in New Issue