diff --git a/entc/gen/feature.go b/entc/gen/feature.go index c2f7eaafe..bb536ded3 100644 --- a/entc/gen/feature.go +++ b/entc/gen/feature.go @@ -142,13 +142,14 @@ var ( FeatureNamedEdges, FeatureSnapshot, FeatureSchemaConfig, - featureMultiSchema, FeatureLock, FeatureModifier, FeatureExecQuery, FeatureUpsert, FeatureVersionedMigration, } + // allFeatures includes all public and private features. + allFeatures = append(AllFeatures, featureMultiSchema) ) // FeatureStage describes the stage of the codegen feature. diff --git a/entc/gen/graph.go b/entc/gen/graph.go index 639142106..d21cbcad3 100644 --- a/entc/gen/graph.go +++ b/entc/gen/graph.go @@ -249,7 +249,7 @@ func generate(g *Graph) error { } assets.add(filepath.Join(g.Config.Target, tmpl.Format), b.Bytes()) } - for _, f := range AllFeatures { + for _, f := range allFeatures { if f.cleanup == nil || g.featureEnabled(f) { continue } @@ -979,7 +979,7 @@ func (Config) ModuleInfo() (m debug.Module) { // ... // {{ end }} func (c Config) FeatureEnabled(name string) (bool, error) { - for _, f := range AllFeatures { + for _, f := range allFeatures { if name == f.Name { return c.featureEnabled(f), nil } diff --git a/entc/gen/graph_test.go b/entc/gen/graph_test.go index 6dd30b724..171a1c852 100644 --- a/entc/gen/graph_test.go +++ b/entc/gen/graph_test.go @@ -434,18 +434,7 @@ func TestGraph_Gen(t *testing.T) { Storage: drivers[0], Templates: []*Template{external, skipped}, IDType: &field.TypeInfo{Type: field.TypeInt}, - Features: []Feature{ - FeaturePrivacy, - FeatureIntercept, - FeatureEntQL, - FeatureNamedEdges, - FeatureSnapshot, - FeatureSchemaConfig, - FeatureLock, - FeatureModifier, - FeatureExecQuery, - FeatureUpsert, - }, + Features: AllFeatures, }, schemas...) require.NoError(err) require.NotNil(graph) @@ -493,18 +482,7 @@ func TestGraph_Gen(t *testing.T) { Storage: drivers[0], Templates: []*Template{external, skipped}, IDType: &field.TypeInfo{Type: field.TypeInt}, - Features: []Feature{ - FeaturePrivacy, - FeatureIntercept, - FeatureEntQL, - FeatureNamedEdges, - FeatureSnapshot, - FeatureSchemaConfig, - FeatureLock, - FeatureModifier, - FeatureExecQuery, - FeatureUpsert, - }, + Features: AllFeatures, }, schemas...) require.NoError(err) require.NotNil(graph)