-
Notifications
You must be signed in to change notification settings - Fork 974
Closed
Description
- The issue is present in the latest release.
- I have searched the issues of this repository and believe that this is not a duplicate.
Current Behavior 😯
When a field is defined as timestamp
(or any other alternatives, like timestamptz
), the precision in the database type is always 0 (regardless if a precision was specified or not).
Expected Behavior 🤔
When no precision is specified, the database type shouldn't have a precision.
When a precision is specified, the database type should have that precision, not zero.
Steps to Reproduce 🕹
Steps:
- Create a time field
- Enable atlas
- Describe the table
var timeSchema = map[string]string{
dialect.Postgres: "timestamptz",
dialect.SQLite: "timestamp",
dialect.MySQL: "datetime(3)",
}
// ...
field.Time("expiry").
SchemaType(timeSchema),
Your Environment 🌎
Tech | Version |
---|---|
Go | 1.17.3 |
Ent | 0.10.1 |
Database | Postgres |
Driver | https://github.com/lib/pq |
I was able to reproduce the issue in this PR: dexidp/dex#2428
One additional detail (that should probably end up in a separate issue): even when Atlas is disabled, precision values are ignored. Even if I set the type to timestamptz(3)
for example, in the database the type will just be timestamp with time zone
. This is fine in my case because the default is not zero fortunately.
hehex9
Metadata
Metadata
Assignees
Labels
No labels