Skip to content

PostgreSQL DB

Sandra Monnier edited this page Mar 27, 2026 · 4 revisions

PostgreSQL DB

Wegas stores its main data in a postgres relational database.

locally

install

Install a postgres container (wegas_postgres) in docker with

  • a user (user),
  • a database for your data (wegas_dev)
  • a database for the automated tests (wegas_test)

following the wegas install procedure.

access

Run the command docker exec -it wegas_postgres psql -U user wegas_dev

or docker exec -it wegas_postgres psql -U user wegas_test

Now you can execute SQL or PSQL commands.

dev + prod

install

Done through the helm chart.

access

Run the command kubectl exec -it -n wegas <pod-name-like-wegas-psql-xxx> -- psql -U user wegas_dev

liquibase

Liquibase is used to update the database structure. See the liquibase wiki page.

cheat sheet + tips

PSQL commands

If you add a + after the \d[.], you will have extra information.

\d : list of tables + sequences

\d <a-table-name> : detail of the table : columns, indexes, foreign keys

\dt : list of tables

\ds : list of sequences

\di : list of indexes

\l : list of databases

\dn : list of schemas

\du : list of database roles

\db : list of tablespaces

\q or exit : quit

SQL

A command always ends with a ;

select version(); : to get the version of PostgreSQL

references

Clone this wiki locally