From 9b1a8409f109eb3e60a3de9ec44e2b32e02a06df Mon Sep 17 00:00:00 2001 From: Mark Sagi-Kazar Date: Wed, 6 Apr 2022 14:18:32 +0200 Subject: [PATCH] revert: atlas and precision change Looks like Atlas (the new migration library under Ent) cannot handle precision properly. An issue has been reported to Ent: https://github.com/ent/ent/issues/2454 Signed-off-by: Mark Sagi-Kazar --- storage/ent/mysql.go | 2 +- storage/ent/postgres.go | 2 +- storage/ent/schema/dialects.go | 2 +- storage/ent/sqlite.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/storage/ent/mysql.go b/storage/ent/mysql.go index c0036656..c922eb16 100644 --- a/storage/ent/mysql.go +++ b/storage/ent/mysql.go @@ -57,7 +57,7 @@ func (m *MySQL) Open(logger log.Logger) (storage.Storage, error) { client.WithTxIsolationLevel(sql.LevelSerializable), ) - if err := databaseClient.Schema().Create(context.TODO(), schema.WithAtlas(true)); err != nil { + if err := databaseClient.Schema().Create(context.TODO(), schema.WithAtlas(false)); err != nil { return nil, err } diff --git a/storage/ent/postgres.go b/storage/ent/postgres.go index e30c18b1..3e8df441 100644 --- a/storage/ent/postgres.go +++ b/storage/ent/postgres.go @@ -57,7 +57,7 @@ func (p *Postgres) Open(logger log.Logger) (storage.Storage, error) { client.WithTxIsolationLevel(sql.LevelSerializable), ) - if err := databaseClient.Schema().Create(context.TODO(), schema.WithAtlas(true)); err != nil { + if err := databaseClient.Schema().Create(context.TODO(), schema.WithAtlas(false)); err != nil { return nil, err } diff --git a/storage/ent/schema/dialects.go b/storage/ent/schema/dialects.go index 051fbd9b..2e5be8fb 100644 --- a/storage/ent/schema/dialects.go +++ b/storage/ent/schema/dialects.go @@ -15,7 +15,7 @@ var textSchema = map[string]string{ } var timeSchema = map[string]string{ - dialect.Postgres: "timestamptz(3)", + dialect.Postgres: "timestamptz", dialect.SQLite: "timestamp", dialect.MySQL: "datetime(3)", } diff --git a/storage/ent/sqlite.go b/storage/ent/sqlite.go index 5943bc4f..3e54e1b7 100644 --- a/storage/ent/sqlite.go +++ b/storage/ent/sqlite.go @@ -44,7 +44,7 @@ func (s *SQLite3) Open(logger log.Logger) (storage.Storage, error) { client.WithHasher(sha256.New), ) - if err := databaseClient.Schema().Create(context.TODO(), schema.WithAtlas(true)); err != nil { + if err := databaseClient.Schema().Create(context.TODO(), schema.WithAtlas(false)); err != nil { return nil, err }