Created
January 16, 2025 22:25
-
-
Save stephenlacy/cd3248506b8ce6cd88c4b352555f608a to your computer and use it in GitHub Desktop.
because I need to google this each time...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Create the database | |
CREATE DATABASE your_database_name; | |
-- Create the user with a password | |
CREATE USER your_username WITH PASSWORD 'your_password'; | |
-- Grant all current and future permissions on the database to the user | |
GRANT ALL PRIVILEGES ON DATABASE your_database_name TO your_username; | |
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO your_username; | |
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO your_username; | |
GRANT ALL PRIVILEGES ON ALL FUNCTIONS IN SCHEMA public TO your_username; | |
-- Grant permissions on future tables/sequences/functions | |
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON TABLES TO your_username; | |
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON SEQUENCES TO your_username; | |
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON FUNCTIONS TO your_username; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment