smallnest / gen

Converts a database into gorm structs and RESTful api
Apache License 2.0
1.43k stars 234 forks source link

unable to generate gorm models for postgres db #157

Closed swarupdonepudi closed 3 years ago

swarupdonepudi commented 3 years ago

gen fails to generate gorm models for my postgres db.

go version: go1.15.5 darwin/amd64

gen version: v0.9.27 (08/04/2020)

postgres version: 11

command:

gen --sqltype=postgres --connstr "host=<hostname> port=5432 user=<username> dbname=<db-name> password=<password> sslmode=disable search_path=<schema-name>" --database <db-name> --table <table-name> --gorm --run-gofmt

output:

Warning - LoadMeta skipping table info for <table-name> error: pq: relation "<db-name>.<table-name>" does not exist
No tables loaded

expected output: gorm model generated for .

I verified that the table indeed exists. In fact, my go application is able to fetch the records from the table using exactly the same connection string inside the go program.

danysz commented 3 years ago

I just fixed it, hope a new version will be released soon https://github.com/smallnest/gen/pull/158

swarupdonepudi commented 3 years ago

ok. working. thanks for the quick fix.