Skip to content
This repository has been archived by the owner on Nov 14, 2022. It is now read-only.

postgresq的 schema 问题 #103

Open
sootma opened this issue Jul 5, 2021 · 2 comments
Open

postgresq的 schema 问题 #103

sootma opened this issue Jul 5, 2021 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@sootma
Copy link

sootma commented Jul 5, 2021

在postgresql gf gen dao时,总是使用sql:
SELECT TABLENAME FROM PG_TABLES WHERE SCHEMANAME = 'public' ORDER BY TABLENAME
倒致取不到数据,因为我没有用到public,而是用的其实scheme, 没有找到可以配置这个schema的地方

@gqcn
Copy link
Member

gqcn commented Jul 6, 2021

@sootma 这个地方是在gf框架那边硬编码的,你可以贡献PR

@gqcn gqcn added enhancement New feature or request help wanted Extra attention is needed labels Jul 6, 2021
@sootma
Copy link
Author

sootma commented Jul 8, 2021

我现在是直接临时修改了源码command/gen/gen_dao.go line 233:
tableNames, err = db.Tables(context.TODO()) =>
tableNames, err = db.Tables(context.TODO(), "xxx") xxx为自己的schema。这样可以生成自己需要的schema.

另外,我建议:dao生成的表名,加上schema, 这样就可以不需要user与schema一致了。现在临时的做法是,连接的用户名与schema一致。

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants