From 0c3c577b52650d996cdc535d04c0ec0e07a3f889 Mon Sep 17 00:00:00 2001 From: Mark Sagi-Kazar Date: Mon, 7 Mar 2022 10:18:32 +0100 Subject: [PATCH] feat: use the new atlas engine for migrations Signed-off-by: Mark Sagi-Kazar --- storage/ent/mysql.go | 3 ++- storage/ent/postgres.go | 3 ++- storage/ent/sqlite.go | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/storage/ent/mysql.go b/storage/ent/mysql.go index f7c4909e..c0036656 100644 --- a/storage/ent/mysql.go +++ b/storage/ent/mysql.go @@ -13,6 +13,7 @@ import ( "time" entSQL "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/schema" "github.com/go-sql-driver/mysql" // Register postgres driver. @@ -56,7 +57,7 @@ func (m *MySQL) Open(logger log.Logger) (storage.Storage, error) { client.WithTxIsolationLevel(sql.LevelSerializable), ) - if err := databaseClient.Schema().Create(context.TODO()); err != nil { + if err := databaseClient.Schema().Create(context.TODO(), schema.WithAtlas(true)); err != nil { return nil, err } diff --git a/storage/ent/postgres.go b/storage/ent/postgres.go index 83aca96c..e30c18b1 100644 --- a/storage/ent/postgres.go +++ b/storage/ent/postgres.go @@ -12,6 +12,7 @@ import ( "time" entSQL "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/schema" // Register postgres driver. _ "github.com/lib/pq" @@ -56,7 +57,7 @@ func (p *Postgres) Open(logger log.Logger) (storage.Storage, error) { client.WithTxIsolationLevel(sql.LevelSerializable), ) - if err := databaseClient.Schema().Create(context.TODO()); err != nil { + if err := databaseClient.Schema().Create(context.TODO(), schema.WithAtlas(true)); err != nil { return nil, err } diff --git a/storage/ent/sqlite.go b/storage/ent/sqlite.go index 22866b6f..5943bc4f 100644 --- a/storage/ent/sqlite.go +++ b/storage/ent/sqlite.go @@ -6,6 +6,7 @@ import ( "strings" "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/schema" // Register sqlite driver. _ "github.com/mattn/go-sqlite3" @@ -43,7 +44,7 @@ func (s *SQLite3) Open(logger log.Logger) (storage.Storage, error) { client.WithHasher(sha256.New), ) - if err := databaseClient.Schema().Create(context.TODO()); err != nil { + if err := databaseClient.Schema().Create(context.TODO(), schema.WithAtlas(true)); err != nil { return nil, err }