-
-
Notifications
You must be signed in to change notification settings - Fork 304
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
fix: Migration error for Cloud SQL #617
Conversation
@nkreiger is attempting to deploy a commit to the Supabase Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be best to make this a separate migration that create or replaces
the function rather than editing an existing migration
EXECUTE 'create or replace function realtime.list_changes(publication name, slot_name name, max_changes int, max_record_bytes int) | ||
returns setof realtime.wal_rls | ||
language sql | ||
set log_min_messages to ''fatal'' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if this is the only line of difference, can the if statement be moved into a separate posters query and add/remove this line using string interpolation?
@nkreiger thanks for your contribution! can you also create a fresh migration file and move this in there? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see: #617 (comment)
@w3b6x9 yep, I was going to actually comment that since its the only change maybe it could be broken out. I'll do this now |
Signed-off-by: Noah Kreiger <[email protected]>
@olirice @w3b6x9 I broke out the steps. If I were to remove the Maybe cleaner than the if statement if I just catch and ignore an exception? Let me know if thats preferable or you have alternative ideas. |
could you please provide the full error message you're seeing? |
@olirice sorry I had to pull it out because of the error and haven't had a chance to setup an example environment, will hopefully get back to you asap later this week or early next! |
@olirice apologies for the delay, this is the error:
let me know what you think! Thanks. In a Cloud SQL instance, it is impossible to achieve these permissions, because its abstracted by the owner (in this case GCP). They provide a cloud sql super role, but it doesn't have the permissions to set this, this is set at the configuration level by terraform, or manually through the UI. So its impossible to avoid this error without updating the DB migration. |
@nkreiger It's been awhile so just wanted to confirm we're on the same page:
We're not going to do step 1 b/c it would change an existing migration file that's already been run on hosted and self-hosted Realtime projects. We recommend that you move forward with these migrations on your forked Realtime so you're not blocked when using it against a Cloud SQL database. |
What kind of change does this PR introduce?
Bug fix/Chore.
What is the current behavior?
The function realtime.list_changes is created, and sets the log_min_messages to 'fatal' for each session it runs.
What is the new behavior?
The function realtime.list_changes is created, and if the your permissions are not a super use, it does not set the log_min_messages to 'fatal', but relies on the admin of the DB to set this at the appropriate level
Additional context
This allows the migration to proceed for Cloud SQL setups that do not allow you to have a super user.