Skip to content

Relationship not being added in models when using GenerateAllTable. #1406

@shresthadeepesh

Description

@shresthadeepesh

Description

My generation code setup:

	g := gen.NewGenerator(gen.Config{
		OutPath:           "internal/db/gen/query",
		ModelPkgPath:      "internal/db/gen/model",
		FieldNullable:     true,
		FieldSignable:     true,
		FieldCoverable:    true,
		FieldWithIndexTag: true,
		FieldWithTypeTag:  true,
		Mode:              gen.WithDefaultQuery | gen.WithQueryInterface,
	})

	// Clean model and query folders
	cleanGenFolder()

	// Use the generated dataMap from datamap package
	g.WithDataTypeMap(datamap.BuildDataMap())

	g.UseDB(db.GetInstance())

	g.ApplyBasic(g.GenerateAllTable()...)

	g.Execute()

The above creates a model from the database however the models doesnt contain any relationship between the tables. Is there any configuraion for loading relations that I am missing?

Gorm gen version: 0.3.26

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions