mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
dialect/sql/schema: option to enable atlas sum file (#2470)
* dialect/sql/schema: option to enable atlas checksum file * entc/integration/migrate: add integration tests for versioned migrations * entc/integration/migrate: apply CR
This commit is contained in:
@@ -264,6 +264,13 @@ func WithFormatter(fmt migrate.Formatter) MigrateOption {
|
||||
}
|
||||
}
|
||||
|
||||
// WithSumFile instructs atlas to generate a migration directory integrity sum file as well.
|
||||
func WithSumFile() MigrateOption {
|
||||
return func(m *Migrate) {
|
||||
m.atlas.genSum = true
|
||||
}
|
||||
}
|
||||
|
||||
type (
|
||||
// atlasOptions describes the options for atlas.
|
||||
atlasOptions struct {
|
||||
@@ -273,6 +280,7 @@ type (
|
||||
skip ChangeKind
|
||||
dir migrate.Dir
|
||||
fmt migrate.Formatter
|
||||
genSum bool
|
||||
}
|
||||
|
||||
// atBuilder must be implemented by the different drivers in
|
||||
|
||||
@@ -186,7 +186,9 @@ func (m *Migrate) NamedDiff(ctx context.Context, name string, tables ...*Table)
|
||||
}
|
||||
opts := []migrate.PlannerOption{
|
||||
migrate.WithFormatter(m.atlas.fmt),
|
||||
migrate.DisableChecksum(),
|
||||
}
|
||||
if !m.atlas.genSum {
|
||||
opts = append(opts, migrate.DisableChecksum())
|
||||
}
|
||||
return migrate.NewPlanner(nil, m.atlas.dir, opts...).WritePlan(plan)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user