liveBook · Manning

Schema

As explained in Developer Experience on Kubernetes

A database schema is the structural definition of a database's tables, columns, relationships, and constraints.

A database schema defines the structure of application data. Treating schema changes as versioned migrations lets developers evolve tables without breaking existing production deployments. section 2.3.2 section 2.4.2

Use a migration-centered workflow when changing an application’s data model:

  • Name: write an ordered SQL migration, such as adding a nullable category column to the appointments table. section 2.3.2
  • What: let Goose or Flyway apply pending migrations at application startup and skip migrations already applied. section 2.3.2 section 2.4.2
  • Why: coordinate the schema with application records, INSERT statements, SELECT statements, and deployment compatibility. section 2.3.2 section 2.4.2
  • Defer mandatory constraints when existing rows cannot satisfy them; backfill values through a data migration before enforcing the constraint later. section 2.3.2

Adding appointment categories

Create a migration that adds a nullable category column, update the Appointment record, include category in INSERT and SELECT operations, then start the application so Goose applies the change. A request can create an appointment with category "cardiology". section 2.3.2

Listing 2.4 Schema migration to add a new column to Appointments.
-- +goose Up
ALTER TABLE appointments ADD COLUMN category VARCHAR(255);
 
-- +goose Down
ALTER TABLE appointments DROP COLUMN category;

Inspect the up/down SQL migration for adding or removing the appointments category column. section 2.3.2

How Developer Experience on Kubernetes covers it

How deep it goes
Explains migration ordering, startup application, model alignment, and staged constraints, but stops short of database-engine internals.
Examples
Uses an appointments table, a category column, Goose and Flyway migrations, Go and Java records, and corresponding SQL operations.
What it assumes
Assumes an existing application, appointments table, user story, and acceptance criteria while teaching migration-based schema evolution.
What you can do after
Apply it via Goose or Flyway to evolve an appointments schema and keep application reads, writes, and records aligned.
How it connects
Connects database schemas to database migrations, data migration, version control, application startup, SQL, and deployment compatibility.

Also explained in

Compare how 54 books explain schema →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Developer Experience on Kubernetes. The section links point to the parts of the book it draws on.