generate model from database with multischema

11 Views Asked by At

im trying to generate the model using the tool. but in my case i have more than 1 schema and the app crash.

g.UseDB(db) // reuse your gorm db

g.ApplyBasic( // Generate struct User based on table users // g.GenerateModel("area"), // Generate all tables multischema

g.GenerateAllTable(),

Anyone with this issue?

[error] generate struct from table fail: mssql: Invalid object name 'payment_card'. panic: generate struct fail

goroutine 1 [running]: gorm.io/gen.(*Generator).GenerateModelAs(0x14000326ff0, {0x140000103d0, 0xc}, {0x140005a8f70?, 0x1330?}, {0x0?, 0x104f97b01?, 0x14000364100?}) /Users/gcortinez/Projects/go-projects/gogen/vendor/gorm.io/gen/generator.go:118 +0x230 gorm.io/gen.(*Generator).GenerateModel(0x14000326ff0, {0x140000103d0, 0xc}, {0x0, 0x0, 0x0}) /Users/gcortinez/Projects/go-projects/gogen/vendor/gorm.io/gen/generator.go:110 +0x70 gorm.io/gen.(*Generator).GenerateAllTable(0x14000326ff0, {0x0, 0x0, 0x0}) /Users/gcortinez/Projects/go-projects/gogen/vendor/gorm.io/gen/generator.go:141 +0x13c main.main() /Users/gcortinez/Projects/go-projects/gogen/main.go:46 +0x168

0

There are 0 best solutions below