Tech Blog

The Choice Not to Design Tables from Scratch — Development on the PostgreSQL Sample DB dvdrental

by Tech Writer
PostgreSQL Spring Boot Java

Introduction

When you decide to “build a web app” as a personal project, most people start with “DB design.” Drawing ER diagrams, creating tables, inserting sample data… that phase alone takes considerable time.

This time, we intentionally skipped that step.

We used the PostgreSQL learning sample database dvdrental as the foundation and built the app on top of it.


What is dvdrental?

It’s the sample DB used in the official PostgreSQL tutorial. It contains data modeled after a DVD rental shop, with tables such as:

  • film, actor, category
  • customer, staff, store
  • rental, payment, inventory

About 15 tables with relational data and thousands of records included from the start.

Available for download from the official page:
https://www.postgresqltutorial.com/postgresql-getting-started/postgresql-sample-database/


Why We Didn’t Design from Scratch

To be honest, “I didn’t have the energy to do DB design from scratch” is not the main reason.

I wanted to see a working app as soon as possible.

In personal development, no one sets deadlines for you. Many people give up when they get stuck on table design or sample data creation.

With dvdrental, you can display real data on the app screen from day one. Being able to see “what kind of app am I building” from the very start makes a huge difference in development motivation.


What We Actually Did

① Start dvdrental with Docker

# compose.yml (excerpt)
services:
  postgres:
    image: postgres:16
    environment:
      POSTGRES_DB: dvdrental
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
    volumes:
      - ./docker/postgres/init:/docker-entrypoint-initdb.d
    ports:
      - "15433:5432"

Just place the dvdrental .tar file and initialization script in docker-entrypoint-initdb.d, and it will auto-restore when the container starts.

② Connect from Spring Boot and display on screen

// FilmRepository.java (excerpt)
public interface FilmRepository extends JpaRepository<Film, Integer> {
    List<Film> findAllByOrderByTitleAsc();
}

Since the tables already exist, just define @Entity and point JPA at it — it works right away.

③ Incrementally add necessary features with Flyway

Additional requirements like “want to add Japanese” or “want to add tags” were added incrementally with Flyway migrations.

-- V2__add_japanese_title.sql
ALTER TABLE film ADD COLUMN title_ja VARCHAR(255);

This allows incremental extension without breaking existing data.


What We Learned

What worked well

Starting from “a state with data”
When displaying the film list, there are already about 1,000 movie records. When implementing search and filtering, you can test with realistic data volumes.

Learning relationships
Multi-to-many between filmfilm_actoractor, chains like rentalinventoryfilm — realistic relational structures are built in from the start, making it a good exercise for JOINs.

Feeling like a real business app
When starting from scratch, data tends to become Test Taro or Sample Movie 1. dvdrental contains real actor names (in English) and film titles, so the screens look completely different when displayed.

Points to note

Sample data is English-first
Names, addresses, and descriptions are all in English. For a Japanese UI, Japanese localization work is needed separately (covered in another article).

Amounts are in USD
payment_amount etc. are sample data in USD. If you want Japanese yen specifications, conversion and rounding handling needs to be considered.


The Concept of “Borrowing a Foundation”

Building from “an existing 1 to 10” has a lower initial hurdle than “creating 0 to 1.”

This is a way of thinking that applies not just to app development, but to how you approach work in general. dvdrental is a sample for learning, but it models a “real business data structure.” The experience of building your app on top of it gives you a sense close to real-world work.


Summary

  • Using the PostgreSQL sample DB dvdrental as a foundation allowed development to start at zero DB design cost
  • Easy to start with Docker, so a working app with real data could be confirmed from day one
  • Missing features were added incrementally with Flyway, enabling extension without breaking existing data
  • The concept of “borrowing a foundation” greatly reduces the burnout points in personal development

Building a DVD Rental End-User App Alongside the Admin Dashboard — Vue 3 + Spring Boot Architecture Overview

Feel free to send a message

Please send a message if you have any technical questions, feedback, or inquiries.