Merge pull request 'feat/postgres' (#9) from feat/postgres into main
Reviewed-on: #9
This commit is contained in:
@@ -119,6 +119,14 @@ export default defineConfig({
|
||||
{ text: 'Custom Fetch', link: '/nuxt/custom-fetch' },
|
||||
]
|
||||
},
|
||||
{
|
||||
text: 'Postgres',
|
||||
link: '/postgres/',
|
||||
collapsed: true,
|
||||
items: [
|
||||
{ text: 'Dump and Restore', link: '/postgres/dump-and-restore' },
|
||||
]
|
||||
},
|
||||
{
|
||||
text: 'PowerShell',
|
||||
link: '/powershell/',
|
||||
|
@@ -46,6 +46,10 @@ hero:
|
||||
text: Nuxt
|
||||
link: /nuxt/
|
||||
|
||||
- theme: alt
|
||||
text: Postgres
|
||||
link: /postgres/
|
||||
|
||||
- theme: alt
|
||||
text: PowerShell
|
||||
link: /powershell/
|
||||
|
21
docs/postgres/dump-and-restore.md
Normal file
21
docs/postgres/dump-and-restore.md
Normal file
@@ -0,0 +1,21 @@
|
||||
# Dump and Restore
|
||||
|
||||
Handy commands for dumping and restoring Postgres databases.
|
||||
|
||||
:::info
|
||||
Most of these commands are run using Docker as then we don't need to have Postgres installed locally.
|
||||
|
||||
If a different version of Postgres is needed, just change the version number in the Docker image tag.
|
||||
:::
|
||||
|
||||
## Dumping a Database
|
||||
|
||||
```bash
|
||||
docker run --network host --rm -v .:/tmp -e PGPASSWORD=mysecretpassword postgres:16 pg_dump -h localhost -U myuser -d mydb > /tmp/dump.sql
|
||||
```
|
||||
|
||||
## Restoring a Database
|
||||
|
||||
```bash
|
||||
docker run --network host --rm -v .:/tmp -e PGPASSWORD=mysecretpassword postgres:16 psql -h localhost -U myuser -d mydb < /tmp/dump.sql
|
||||
```
|
3
docs/postgres/index.md
Normal file
3
docs/postgres/index.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Postgres Snippets and Musings
|
||||
|
||||
#### [Dump and Restore](./dump-and-restore.md)
|
Reference in New Issue
Block a user