{{/* Copyright 2019-present Facebook Inc. All rights reserved. This source code is licensed under the Apache 2.0 license found in the LICENSE file in the root directory of this source tree. */}} {{/* gotype: entgo.io/ent/entc/gen.Graph */}} {{ define "migrate/diff" }} // 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 { migrate, err := schema.NewMigrate(s.drv, opts...) if err != nil { return fmt.Errorf("ent/migrate: %w", err) } return migrate.Diff(ctx, Tables...) } // NamedDiff creates a named migration file containing the statements to resolve the diff // between the Ent schema and the connected database. func (s *Schema) NamedDiff(ctx context.Context, name string, opts ...schema.MigrateOption) error { migrate, err := schema.NewMigrate(s.drv, opts...) if err != nil { return fmt.Errorf("ent/migrate: %w", err) } return migrate.NamedDiff(ctx, name, Tables...) } {{ end }}