From 396588f54af8465ea3d34c1d44887b4051d60edf Mon Sep 17 00:00:00 2001 From: Son Chau Date: Wed, 31 Jul 2024 13:52:11 -0700 Subject: [PATCH 1/2] update postgres instruction --- README.md | 42 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index ab30ca228..daf2432f7 100644 --- a/README.md +++ b/README.md @@ -64,13 +64,45 @@ This will install all the packages needed for development. ### Step 4: Set up PostgreSQL -Replace "dbname", "username", and "password" with the values in [local.py](config/settings/local.py): +Install for macOS: -```sql +```bash +# Install PostgreSQL +brew install postgresql@16 + +# Set PATH environment variable +echo 'export PATH="/opt/homebrew/opt/postgresql@16/bin:$PATH"' >> ~/.zshrc +source ~/.zshrc + +# Start PostgreSQL service +brew services start postgresql@16 + +# Log in to PostgreSQL +psql -d postgres +``` + +Install for Linux: + +```bash +# Install PostgreSQL +sudo apt install postgresql + +# Start PostgreSQL service +sudo systemctl start postgresql.service + +# Log in to PostgreSQL sudo -u postgres psql -CREATE DATABASE dbname; -CREATE USER username WITH PASSWORD 'password'; -GRANT ALL PRIVILEGES ON DATABASE dbname TO username; +``` + +Create a Role and Database: + +```sql +CREATE ROLE admin_local WITH LOGIN PASSWORD 'password_local' CREATEDB CREATEROLE; +CREATE DATABASE katsu_local WITH OWNER = admin_local; +GRANT ALL PRIVILEGES ON DATABASE katsu_local TO admin_local; + +-- Quit PostgreSQL +\q ``` ### Step 5: Set up database From 451afd9b2a474222fb209d6cc044ad9b948362e1 Mon Sep 17 00:00:00 2001 From: Son Chau Date: Wed, 31 Jul 2024 13:56:47 -0700 Subject: [PATCH 2/2] add note --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index daf2432f7..2201af3eb 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,8 @@ GRANT ALL PRIVILEGES ON DATABASE katsu_local TO admin_local; \q ``` +Note: In some cases, existing PostgreSQL might cause issues. You may need to clean them up manually. + ### Step 5: Set up database With the database configured, run the following command to create the necessary database tables: