Skip to content

Commit

Permalink
revert: atlas and precision change
Browse files Browse the repository at this point in the history
Looks like Atlas (the new migration library under Ent) cannot
handle precision properly.

An issue has been reported to Ent: ent/ent#2454

Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
  • Loading branch information
sagikazarmark committed Apr 6, 2022
1 parent 6aa2c76 commit 05b8331
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion storage/ent/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion storage/ent/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion storage/ent/schema/dialects.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
}
2 changes: 1 addition & 1 deletion storage/ent/sqlite.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 05b8331

Please sign in to comment.