mirror of
https://github.com/jbranchaud/til
synced 2026-01-17 05:58:01 +00:00
Compare commits
3 Commits
fc59befb28
...
235b1e060c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
235b1e060c | ||
|
|
6b9ec224b8 | ||
|
|
295fe153ad |
@@ -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).
|
||||
|
||||
_1444 TILs and counting..._
|
||||
_1445 TILs and counting..._
|
||||
|
||||
---
|
||||
|
||||
@@ -390,6 +390,7 @@ _1444 TILs and counting..._
|
||||
|
||||
### Heroku
|
||||
|
||||
- [Connect To A Database By Color](heroku/connect-to-a-database-by-color.md)
|
||||
- [Deploy A Review App To A Different Stack](heroku/deploy-a-review-app-to-a-different-stack.md)
|
||||
- [Diagnose Problems In A Heroku Postgres Database](heroku/diagnose-problems-in-a-heroku-postgres-database.md)
|
||||
- [Open Dashboard For Specific Add-On](heroku/open-dashboard-for-specific-add-on.md)
|
||||
|
||||
29
heroku/connect-to-a-database-by-color.md
Normal file
29
heroku/connect-to-a-database-by-color.md
Normal file
@@ -0,0 +1,29 @@
|
||||
# Connect To A Database By Color
|
||||
|
||||
All of your PostgreSQL databases in Heroku are given attachment names that use
|
||||
a random color. This might be _pink_, _brown_, _cobalt_, etc. And the
|
||||
attachment names then look like `HEROKU_POSTGRESQL_PINK`,
|
||||
`HEROKU_POSTGRESQL_BROWN`, `HEROKU_POSTGRESQL_COBALT`, etc.
|
||||
|
||||
We can connect to a Heroku-managed PostgreSQL instance from the command-line
|
||||
like so:
|
||||
|
||||
```bash
|
||||
$ heroku pg:psql --app my-app
|
||||
```
|
||||
|
||||
This is going to connect to the _default_ database which is the one with the
|
||||
`DATABASE_URL` attachment.
|
||||
|
||||
There are lots of instances where we may have other databases besides the
|
||||
primary (e.g. let's say we have a read replica follower). If we want to connect
|
||||
to that one, we can do so by _color_.
|
||||
|
||||
If that database's attachment is `HEROKU_POSTGRESQL_IVORY`, then we'd connect
|
||||
to it like so:
|
||||
|
||||
```bash
|
||||
$ heroku pg:psql ivory --app my-app
|
||||
```
|
||||
|
||||
[source](https://devcenter.heroku.com/articles/managing-heroku-postgres-using-cli#pg-psql)
|
||||
@@ -5,6 +5,8 @@ an array-like object with all of the arguments to the function. Even if not
|
||||
all of the arguments are referenced in the function signature, they can
|
||||
still be accessed via the `arguments` object.
|
||||
|
||||
> For ES6+ compatibility, the `spread` operator used via [rest parameters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters) is preferred over the `arugments` object when accessing an abritrary number of function arguments.
|
||||
|
||||
```javascript
|
||||
function argTest(one) {
|
||||
console.log(one);
|
||||
|
||||
Reference in New Issue
Block a user