44 wiersze
1.3 KiB
Plaintext
44 wiersze
1.3 KiB
Plaintext
## Solo per postgres-vector
|
|
|
|
### Setup iniziale (eseguire una volta)
|
|
Abilita pgvector su `template1` così tutti i nuovi database lo avranno automaticamente:
|
|
|
|
```bash
|
|
podman exec -it postgres psql -U postgres -d template1 -c "CREATE EXTENSION IF NOT EXISTS vector;"
|
|
```
|
|
----
|
|
|
|
# Create DB
|
|
|
|
Create User
|
|
```bash
|
|
podman exec -it postgres psql -U postgres -c "CREATE USER [nome_progetto] WITH password '[password_db_progetto]';"
|
|
```
|
|
|
|
Or with CREATEDB
|
|
```bash
|
|
podman exec -it postgres psql -U postgres -c "CREATE USER [nome_progetto] WITH password '[password_db_progetto]' CREATEDB;"
|
|
```
|
|
|
|
Create DB
|
|
```bash
|
|
podman exec -it postgres psql -U postgres -c "CREATE DATABASE [nome_progetto];"
|
|
podman exec -it postgres psql -U postgres -c "GRANT ALL privileges ON DATABASE [nome_progetto] TO [nome_progetto];"
|
|
podman exec -it postgres psql -U postgres -d [nome_progetto] -c "GRANT CREATE ON SCHEMA public TO [nome_progetto];"
|
|
```
|
|
|
|
----
|
|
|
|
# Backup e Restore
|
|
|
|
Backup (pg_dump) del database su file sull'host:
|
|
```bash
|
|
podman exec -e PGPASSWORD="[password_db_progetto]" postgres pg_dump -U [nome_progetto] -d [nome_progetto] > backup.sql
|
|
```
|
|
|
|
Restore da file sull'host nel database:
|
|
```bash
|
|
podman exec -i -e PGPASSWORD="[password_db_progetto]" postgres psql -U [nome_progetto] -d [nome_progetto] < backup.sql
|
|
```
|
|
|