Skip to content
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

Digital Ocean sqlx migrate error - Chapter 5 #272

Open
mitchr1598 opened this issue Jan 22, 2025 · 0 comments
Open

Digital Ocean sqlx migrate error - Chapter 5 #272

mitchr1598 opened this issue Jan 22, 2025 · 0 comments

Comments

@mitchr1598
Copy link

I think it's possible Digital Ocean have changed how they do things, or I just goofed up.

When trying to run the migration on page 157 (last of chapter 5), I get an error that I don't have permission on public schema.

I used the psql command with the same connection string to confirm the string was correct, psql also confirmed the "newsletter" user can connect to the DB, but doesn't have permissions on public.

I either goofed up, or Digital Ocean changed things.

If anyone else has this issue, this is the workaround I found:
Digital Ocean doesn't give us a connection string for an admin user to the db, however we can get it through their API

curl -X GET
-H "Content-Type: application/json"
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN"
"https://api.digitalocean.com/v2/databases/<DB_ID>/users"

The DB_ID is in the databases settings on the console

This should return two users, and their passwords. The "newsletter" user, and a "doadmin" user. Connect to the DB with the "doadmin" login using psql, and update the permissions on the schema. You may need to set default permissions on tables in the schema as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant