dialect/sql/schema: atlas engine is now default (#2698)

* atlas engine is default, enabled diff by replay

* Apply suggestions from code review

* docs

* apply CR
This commit is contained in:
Jannik Clausen
2022-07-05 12:29:15 +02:00
committed by GitHub
parent 91b643091f
commit 5b67bdab4f
19 changed files with 828 additions and 1475 deletions

View File

@@ -7,6 +7,17 @@ in the LICENSE file in the root directory of this source tree.
{{/* gotype: entgo.io/ent/entc/gen.Graph */}}
{{ define "migrate/diff" }}
// Diff compares the state read from a database connection or migration directory with
// the state defined by the Ent schema. Changes will be written to new migration files.
func Diff(ctx context.Context, url string, opts ...schema.MigrateOption) error {
return NamedDiff(ctx, url, "changes", opts...)
}
// NamedDiff compares the state read from a database connection or migration directory with
// the state defined by the Ent schema. Changes will be written to new named migration files.
func NamedDiff(ctx context.Context, url, name string, opts ...schema.MigrateOption) error {
return schema.Diff(ctx, url, name, Tables, opts...)
}
// Diff creates a migration file containing the statements to resolve the diff
// between the Ent schema and the connected database.
func (s *Schema) Diff(ctx context.Context, opts ...schema.MigrateOption) error {