-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Public is the default schema but if you use different name your are #5892
Conversation
As far as I understand, this has been working for people with pg since we implemented it. I don't understand enough of what's going on here or why this is a valid fix to merge this. Please take the time to explain it, and I recommend also finding another postgres user to help you test and champion this change so that we can get it merged. |
Looking into this change now. |
First: I disagree with the actual SQL of the change. There's a better query for this. However, that raises a question of what we want to support, exactly, in the way of PostgreSQL schema for Ghost databases. If we want robust support for setting a specific schema for the Ghost application to store its tables in, then just changing the search query for table names is insufficient; you could have a "posts" table for a different application in a different schema. However, having robust schema support would require adding a bunch of plubming to keep track of which schema Ghost is supposed to be in, and I don't really see the use case for it; why not keep Ghost isolated to its own database? |
OK, per discussion on Slack, we're not going to try to implement general non-public schema support at this time. As such, the migration queries should be fixed like this:
Alternately, a simpler query relies on PostgreSQL-specific views:
... either of those will pick up the Ghost tables if you've saved them to a schema other than public. However, they will result in a false positive if you happen to have other apps installed in other schema whose names happen to be the same as Ghost table names. Personally, I'd recommend just keeping Ghost in its own database until full schema support is available. |
@Yanntech hello? Please comment. |
Hi, Sorry for late, I need to configure github notification. First, postgres is not mysql, schema != databases (namespace is like: database.schema.tables). For remember, the current SQL is:
This query work only if database is dedicated to ghost. My new query is compatible with the old (pg specific) :
For example:
|
Yann, The current_schema() solution is nice; we'd want a doc or wiki update somewhere which explained how to set a schema for the ghost user, though. Also, if you're using current_schema, "where table_name not like 'pg%'" is completely unnecessary. |
The where clause is to maintain the backward compat If user still use the default (public) schema. About the documentation, I can explain this good practice but I didn't found anything more than http://support.ghost.org/config/ or you own issue #5878 |
Yeah, we'll need a wiki page or something. I don't see why the checks are failing? I looked at the supposed failed test, and no individual test failed. What's up with that? |
I don't know why, this is a timeout, can you ping someone has wrote this test unit ?
|
I found my previous commit and travis also fail in mysql ... ( https://travis-ci.org/TryGhost/Ghost/builds/82523130 ) |
Anyway, change it to:
... and I'll sign off on it. |
done and travis is happy ;-) |
+1 to merge. |
@jberkus thanks for leading this. @Yanntech could you please update this PR to match our contributing guidelines? Please squash the commits and leave the final commit with a commit message in this format. Thanks 👍 |
…PostgreSQL closes #5891 - use CURRENT_SCHEMA() instead of 'public' - remove the WHERE condition
I fail the rebase, the commit message is OK. |
Travis fail again for no reason :( |
I've restarted the failing build for you. |
Thank you @kevinansfield , travis success ;-) |
Public is the default schema but if you use different name your are
Unable to start the upgrade process.
This new SQL command exclude 'information_schema' instead of 'public'
This PR fix the issue #5891