feat: use the new atlas engine for migrations
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
This commit is contained in:
parent
20b03b3f6d
commit
0c3c577b52
@ -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
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user