33## Connecting to the DB through Docker (externally)
44
55``` bash
6- docker compose exec -it rubbergod-postgres psql -U rubbergod
6+ docker compose exec -it db psql -U rubbergod
77```
88
99PostgreSQL prompt will open and you can now run any SQL (or Postgre-specific) commands you want. To quit, press Ctrl+D.
@@ -71,13 +71,13 @@ That way, the module gets imported on startup and creates the table automaticall
7171> For most of these operations you need the database container running.
7272> ``` bash
7373> docker compose down # first make sure the bot is not running
74- > docker compose up -d rubbergod-postgres
74+ > docker compose up -d db
7575> ` ` `
7676
7777To backup the database, run the following command:
7878
7979` ` ` bash
80- docker compose exec rubbergod-postgres pg_dump -U rubbergod -d rubbergod > backup.sql
80+ docker compose exec db pg_dump -U rubbergod -d rubbergod > backup.sql
8181```
8282
8383Restore the database from the backup file automatically by running the following commands:
@@ -95,21 +95,21 @@ To manually restore the database, run the following commands:
9595
9696``` bash
9797# drop and recreate the database must be separate commands
98- docker compose exec rubbergod-postgres psql -U rubbergod -d postgres -c " DROP DATABASE rubbergod;"
99- docker compose exec rubbergod-postgres psql -U rubbergod -d postgres -c " CREATE DATABASE rubbergod WITH OWNER rubbergod;"
98+ docker compose exec db psql -U rubbergod -d postgres -c " DROP DATABASE rubbergod;"
99+ docker compose exec db psql -U rubbergod -d postgres -c " CREATE DATABASE rubbergod WITH OWNER rubbergod;"
100100
101101# restore the database from the backup file
102- docker compose exec -T rubbergod-postgres psql -U rubbergod < backup.sql
102+ docker compose exec -T db psql -U rubbergod < backup.sql
103103```
104104
105105You can drop specific table using this command:
106106
107107``` bash
108- docker compose exec rubbergod-postgres psql -U rubbergod -c " DROP TABLE [table_name] CASCADE;"
108+ docker compose exec db psql -U rubbergod -c " DROP TABLE [table_name] CASCADE;"
109109```
110110
111111To get only specific table and it's data use this command:
112112
113113``` bash
114- docker compose exec rubbergod-postgres pg_dump -U rubbergod -d rubbergod -t [table_name] > [table_name].sql
114+ docker compose exec db pg_dump -U rubbergod -d rubbergod -t [table_name] > [table_name].sql
115115```
0 commit comments