fix code
This commit is contained in:
parent
269811a497
commit
21b54e5d61
|
@ -320,8 +320,11 @@ func (db *mssql) SQLType(c *schemas.Column) string {
|
|||
res += "(MAX)"
|
||||
}
|
||||
case schemas.TimeStamp, schemas.DateTime:
|
||||
c.Length = 7
|
||||
return "DATETIME2"
|
||||
if c.Length > 3 {
|
||||
res = "DATETIME2"
|
||||
} else {
|
||||
return schemas.DateTime
|
||||
}
|
||||
case schemas.TimeStampz:
|
||||
res = "DATETIMEOFFSET"
|
||||
c.Length = 7
|
||||
|
|
|
@ -1209,7 +1209,7 @@ func TestInsertNotDeleted(t *testing.T) {
|
|||
|
||||
type TestInsertNotDeletedStructNotRight struct {
|
||||
ID uint64 `xorm:"'ID' pk autoincr"`
|
||||
DeletedAt time.Time `xorm:"'DELETED_AT' deleted notnull"`
|
||||
DeletedAt time.Time `xorm:"'DELETED_AT' DATETIME(6) deleted notnull"`
|
||||
}
|
||||
// notnull tag will be ignored
|
||||
err := testEngine.Sync(new(TestInsertNotDeletedStructNotRight))
|
||||
|
@ -1217,7 +1217,7 @@ func TestInsertNotDeleted(t *testing.T) {
|
|||
|
||||
type TestInsertNotDeletedStruct struct {
|
||||
ID uint64 `xorm:"'ID' pk autoincr"`
|
||||
DeletedAt time.Time `xorm:"'DELETED_AT' deleted"`
|
||||
DeletedAt time.Time `xorm:"'DELETED_AT' DATETIME(6) deleted"`
|
||||
}
|
||||
|
||||
assert.NoError(t, testEngine.Sync(new(TestInsertNotDeletedStruct)))
|
||||
|
|
Loading…
Reference in New Issue