Skip to content

Commit

Permalink
Support this into MSSQL.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tang8330 committed Oct 16, 2024
1 parent 3a2e340 commit ebaa657
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions clients/mssql/dialect/dialect.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ func (MSSQLDialect) DataTypeForKind(kindDetails typing.KindDetails, isPk bool) s
case typing.ETime.Kind:
switch kindDetails.ExtendedTimeDetails.Type {
case ext.TimestampTzKindType:
return "datetimeoffset"
case ext.TimestampNTZKindType:
// Using datetime2 because it's the recommendation, and it provides more precision: https://stackoverflow.com/a/1884088
return "datetime2"
case ext.DateKindType:
Expand Down Expand Up @@ -114,6 +116,8 @@ func (MSSQLDialect) KindForDataType(rawType string, stringPrecision string) (typ
case
"datetime",
"datetime2":
return typing.NewKindDetailsFromTemplate(typing.ETime, ext.TimestampNTZKindType), nil
case "datetimeoffset":
return typing.NewKindDetailsFromTemplate(typing.ETime, ext.TimestampTzKindType), nil
case "time":
return typing.NewKindDetailsFromTemplate(typing.ETime, ext.TimeKindType), nil
Expand Down

0 comments on commit ebaa657

Please sign in to comment.