Skip to content

PRJ2: Database Guide

Your Database

You will run your own database on your own computer while developing. But your deployed app will have its own database.


How init.sql Works

Every time you push code, your database:

  1. Gets deleted (clean slate)
  2. Gets recreated
  3. Runs your db/init.sql

Your db/init.sql should create all tables and test data:

CREATE TABLE customers (
    id SERIAL PRIMARY KEY,
    name VARCHAR(100) NOT NULL,
    email VARCHAR(255)
);

CREATE TABLE orders (
    id SERIAL PRIMARY KEY,
    customer_id INTEGER REFERENCES customers(id),
    total DECIMAL(10,2)
);

INSERT INTO customers (name, email) VALUES ('Test User', 'test@example.com');

Tip

Test your SQL locally before pushing. Syntax errors will break deployment.


Using pgAdmin

pgAdmin lets you browse your database in a web browser.

  1. Go to pgadmin.prod.fontysvenlo.dev
  2. Login with your team credentials (username is your team name (e.g., 2026-group01) you received your password from your lecturer)
  3. Find your database in the left panel

Useful for:

  • Checking if tables were created correctly
  • Viewing data
  • Running test queries
  • Debugging issues

FAQ

Why did my data disappear? Database resets on every deploy. This is intentional—your db/init.sql is always the source of truth.

Can I keep data between deploys? In a real life situation, it would be disastrous if production data gets lost every a deployment. Instead of resetting the database, developers do 'migrations'. However, this is not in scope of PRJ2.

My init.sql has an error? Check pgAdmin or fix your SQL and push again.