-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add postgres schema support #518
Conversation
Thanks for the PR @danieltdt - going to wait on merging this right away to compare some of these changes with #316 - I was holding off on that because I wanted to make sure the API was the clearest possible. @tkellen you seem to utilize more of the full PG feature set than I, any opinions on either of these PR's. |
I think both PR can be merged with small changes. This PR only includes {
client: 'pg',
connection: 'postgress://postgres@localhost:5432/knex',
searchPath: 'myschema, public'
} |
Agreed 100% on setting the search path in the connection. |
eb9b67b
to
6dd8434
Compare
Added |
Any news on including schema support? About this, or #316 Issue |
So... Any thoughts about it? |
Sorry for keeping you waiting for so long. I appreciate your patience. The steps to getting this merged are:
Re #316, I'm not concerned w/ the schema builder methods for creating new schemas or modifying. Just want to make sure that anything that any good ideas with respect to using schemas introduced there are reflected here. I'll work on extracting the schema builder functionality from #316 separately. |
1030329
to
2ddff0d
Compare
Ok! I'll check this later at home. |
2ddff0d
to
0d1f0ed
Compare
I'd love to see this rebased so it can be merged. |
lol I totally forgot about this PR 🙊 |
👍 seconded on getting this pull request rebased and in |
Can be any help provided for branch merging? Waiting this patch already for 10 months :) |
Hi @danieltdt. Looks like there's a few people waiting on this. Are you still interested in getting it merged? If you can satisfy @bendrucker's requests, I'll accept the PR. |
Sorry about the delay, guys... The codebase of knex has changed deeply and the rebase is not so simple as I expected. I had given up this PR but, since people seems interested on it, I'll try to rebase it on this weekend. |
0d1f0ed
to
8d7555f
Compare
8d7555f
to
70e4692
Compare
Please, take a look and let me know if it is good to merge :) |
Hi @danieltdt, thanks for coming back to this. I am primarily focused on Bookshelf, so I do not know the internals of knex very well. Also I've never worked with multiple schemas before in Postgres, but I checked the docs and the concept is simple enough. Your changes look very clean superficially, and the tests seem good, but beyond that I can't really comment on the correctness of the implementation. I'm happy to defer to your judgement. Sorry I didn't mention this in the last comment, but I think this really requires documentation. Would you be able to also update Also, I'm not sold on the method name |
Hey @rhys-vdw, |
True. And also would it not conflict with I still fear However, I can't think of anything sufficiently terse. |
Maybe |
@danieltdt: Yes, please. :-) Sorry for the slow response. |
@rhys-vdw Done! (sorry about slow commits 🙈) |
8c988f6
to
9b94cfa
Compare
Looks solid. Nice one. 👍 |
Hello,
I've been using knex for many projects and I see that it didn't have a good support for postgres schemas. So, I created this pull request adding a new method
.using
which allows to scope table names within a schema (and adding the schema to the metadata queries).Since many databases allows the "qualified name" structure for table names, I decided to put it into the generic objects
builder
andcompiler
, since it does not broken any API.I added a few tests also and it seems to run fine (I don't have oracle/mariadb to run integration tests 😞 ).
So, do you guys think it is good to merge?