diff --git a/README.md b/README.md index 518364c..0433f97 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ pairing with smart people at Hashrocket. For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186). -_1675 TILs and counting..._ +_1676 TILs and counting..._ See some of the other learning resources I work on: @@ -942,6 +942,7 @@ If you've learned something here, support my efforts writing daily TILs by - [Set Inclusion With hstore](postgres/set-inclusion-with-hstore.md) - [Set A Seed For The Random Number Generator](postgres/set-a-seed-for-the-random-number-generator.md) - [Set A Statement Timeout Threshold For A Session](postgres/set-a-statement-timeout-threshold-for-a-session.md) +- [Set Up A Project-Local Cluster With Postgres.app](postgres/set-up-a-project-local-cluster-with-postgres-app.md) - [Sets With The Values Command](postgres/sets-with-the-values-command.md) - [Shorthand Absolute Value Operator](postgres/shorthand-absolute-value-operator.md) - [Show All Versions Of An Operator](postgres/show-all-versions-of-an-operator.md) diff --git a/postgres/set-up-a-project-local-cluster-with-postgres-app.md b/postgres/set-up-a-project-local-cluster-with-postgres-app.md new file mode 100644 index 0000000..bf91ead --- /dev/null +++ b/postgres/set-up-a-project-local-cluster-with-postgres-app.md @@ -0,0 +1,35 @@ +# Set Up A Project-Local Cluster With Postgres.app + +I want to set up a PostgreSQL cluster in my project directory. This helps +provide some separation and clarity that this cluster and its databases are just +for this project. + +This can be done with `Postgres.app` (on Mac) hitting the `+` button in the +bottom left corner of the app. This will pop open a "Create new server" modal. + +From there, you'll want to give the server a name that you can identify within +`Postgres.app`. E.g. " Cluster" + +Then select the Postgres version. My existing project is still on 17, so I'll +select that. + +The not so intuitive part is the _Data Directory_. Use the "Choose..." file +picker to find the root directory of your project. Select that. Then click into +the text input for the data directory and append the name of the data directory +_to be created_ to that path. If I want it to all go in `postgres-data`, then my +path will look like: + +``` +/Users/me/dev/my-app/postgres-data +``` + +The `postgres-data` directory doesn't exist yet. But it will in a moment. + +You probably want the default port, so leave that at `5432` unless you know +otherwise. + +Click `Create server`, though that won't actually create the server yet. Now +with that server selected in `Postgres.app` click the `Initialize` button. That +will create the `postgres-data` directory and then run `initdb` under the hood +which will add everything your server needs. It will now be running at that +port, ready to connect.