Skip to content

Database

Splines edited this page Oct 3, 2024 · 8 revisions

We use PostgreSQL as database.

pgadmin

The Rails console is great. But sometimes, it's easier to see database-related things in a nice UI. This is what pgadmin is for. Note that changing data directly there does not ensure any data integrity or data validations. These rules are only enforced on a higher level which is managed by Ruby. Therefore, pgadmin is probably just useful for viewing the tables and the data inside it and to get some statistics. If you really want to, you can of course change the data in pgadmin directly (in a local dev setup!) to see the effects.

Access on localhost:5050 with these credentials:

  • Mail: admin@mampf.edu
  • Pass: pgmampf

Once you have successfully logged in, you might be prompted to enter a password to connect to the database. Just enter no password and click ok. Note that passwords cannot be exported/imported as config, see here:

Password fields cannot be imported or exported.

That's why you get this "Enter password" popup (but only once when the pgadmin Docker container is freshly initialized).


You can find the tables under mampf > Schemas > public > Tables. Then, right-click on a table name and choose "View/Edit Data". You can also execute custom SQL queries.

image

Entity-relationship diagrams (ERD)

Entity-relationship diagrams (ERD) have long been a very powerful tool for gaining insights and an overview of how the tables in a database are structured and associated to each other. We use Rails ERD to create such diagrams for our codebase.

just utils erd
Clone this wiki locally