diff --git a/postgres.go b/postgres.go index 5d73d27..9057269 100644 --- a/postgres.go +++ b/postgres.go @@ -189,10 +189,17 @@ func (dialector Dialector) DataTypeOf(field *schema.Field) string { } return "text" case schema.Time: + var timeType string + // Distinguish between schema.Time and tag time + if val, ok := field.TagSettings["TYPE"]; ok { + timeType = val + } else { + timeType = "timestamptz" + } if field.Precision > 0 { - return fmt.Sprintf("timestamptz(%d)", field.Precision) + return fmt.Sprintf("%s(%d)", timeType, field.Precision) } - return "timestamptz" + return timeType case schema.Bytes: return "bytea" default: