Skip to content
AI-powered appsNewChat, vision, voice, generationBookings & schedulingAppointments that book themselvesShops & sellingA storefront in every pocketClient & businessRun the operation from one placeCommunities & clubsA home that is not a group chat
Health & wellnessHabits, tracking and calmGames2D, 3D and multiplayerPersonal & toolsThe tool you wish existedInternal toolsThe tool ops never had time for
See all use cases
ArcadeNewPricingSecurity
EngineThe game engine and World EditorHow it worksFrom one sentence to a live productDocsGuides for building and publishingBlogStories, guides and newsChangelogWhat shipped latelyStatusUptime of every serviceSupportGet help from the team
AI-powered appsBookings & schedulingShops & sellingClient & businessCommunities & clubsHealth & wellnessGamesPersonal & toolsInternal tools
See all use cases
ArcadeNewPricingSecurity
EngineHow it worksDocsBlogChangelogStatusSupport
Language
Blog
GlossaryNovember 22, 20263 min read

What is a database schema?

The schema decides what your app can store and how pieces connect. Here is a real example, the rules that keep it clean, and the mistakes that hurt later.

Startbase Team
Editorial ink illustration of an architect's floor plan with labeled rooms and doorways, one doorway in ember orange

Key takeaways

  • A schema defines tables, their columns and types, required fields, and how tables relate through keys.
  • One table per kind of thing, one row per item, and links by ID instead of copied data.
  • Schemas change through migrations, so it is normal for one to grow with the app.

Your database schema is the blueprint of the data: which tables exist, which columns each has, what type of value each column holds, which fields are required, and how tables point at each other. The data itself is the rows; the schema is the shape every row must fit.

A paper filing cabinet makes it concrete. The schema is the decision that there is one drawer for clients and one for appointments, that every appointment card has a date, a time and a client number, and that the client number points to a card in the clients drawer. Without that agreement, the cabinet fills with notes nobody can search.

A worked example: a small booking app

  • profiles: id, full_name (text, required), phone (text), created_at (timestamp).
  • services: id, name (text, required), duration_minutes (integer, required), price_cents (integer, required), active (boolean, default true).
  • bookings: id, profile_id (links to profiles), service_id (links to services), starts_at (timestamp with time zone, required), status (one of pending, confirmed, canceled), notes (text).

A few choices in there are deliberate. Prices are whole cents so arithmetic never produces 19.999999. Times carry a time zone, because "10:00" means nothing across borders. Status is limited to three values so a typo cannot invent a fourth. And bookings store service_id rather than a copy of the service name, so renaming a service fixes every booking at once. The links between tables use primary and foreign keys, which the database enforces: a booking cannot point at a service that does not exist. See how to build a booking system for the full app.

Rules that keep a schema healthy

  1. 01One table per kind of thing. Users, products, orders. If a table has columns like item1, item2, item3, it wants to be a second table.
  2. 02Store facts once. Copying a customer's email into every order means updating it in 400 places later.
  3. 03Pick real types. Numbers as numbers, dates as dates, true/false as booleans. Text for everything breaks sorting and math.
  4. 04Say what is required. NOT NULL on fields the app cannot work without catches bugs at the door.
  5. 05Name plainly. created_at, owner_id, is_published: names a stranger could guess.

Schemas when building with Startbase

Startbase Cloud gives a project a managed Postgres database. The agent designs the schema from your description and changes it through SQL migrations; the Database section shows your tables and a table browser, and the Schema Sync panel lists applied and pending migrations (database docs). Who may read which rows is set by row level security policies on the same tables (row level security explained). The most useful thing you can give the agent is the list of things your app tracks and how they relate.

Design the database for a dog-walking app. Owners have many dogs; walkers accept walks; each walk has one walker, one or more dogs, a start time with time zone, a duration in minutes, a price in cents and a status (requested, accepted, done, canceled). Store photos per walk. Owners see only their own dogs and walks; walkers see walks assigned to them.

Common confusions

  • Schema vs data. Deleting rows leaves the schema; dropping a column removes it from every row.
  • Schema in Postgres. Postgres also uses "schema" for a named folder of tables (public is the default). Same word, narrower meaning.
  • Schemaless. Document databases skip a fixed schema, but the app still assumes one; it just is not enforced. For background, read database basics for non-developers and what is Supabase.

Frequently asked questions

Can I change my database schema later?

Yes. Schemas change through migrations: small, ordered scripts that add or alter tables and columns. Adding is easy; renaming or removing columns needs more care with existing data.

What is the difference between a schema and a table?

A table is one collection of rows, such as bookings. The schema is the whole design: every table, its columns, types, rules and relationships.

On this page

  • A worked example: a small booking app
  • Rules that keep a schema healthy
  • Schemas when building with Startbase
  • Common confusions

Keep reading

More in Glossary
Editorial ink illustration of a hand-cranked music box drum plucking a metal comb, the crank handle in ember orange
GlossaryNovember 22, 2026

What is a game loop?

Every real-time game runs one repeating cycle: read input, update the world, draw it. Here is what that cycle looks like and why it decides how your game feels.

3 min read
Editorial ink illustration of a brass stopwatch beside a small wind-up toy car, the second hand in ember orange
GlossaryNovember 22, 2026

What is delta time?

Delta time is the number that keeps your game the same speed on every screen. Here is how to use it, where it breaks, and how to spot a game that forgot it.

3 min read

Read less. Ship more.

Everything in this post is one prompt away. Describe your app and watch it build.

Start building

Apps, games, backends and publishing from one conversation.

Product

  • Features
  • Use cases
  • Pricing
  • Changelog

Resources

  • Blog
  • Docs
  • Support
  • Status
  • Security

Contact

  • w@startbase.ai
  • X / Twitter
  • LinkedIn
  • Instagram

Legal

  • Terms
  • Privacy

© 2026 Startbase. All rights reserved.