Building apps
What is a database schema?
A database schema is the blueprint of your data: which tables exist, what fields each one has, what type each field holds, and how the tables relate to each other.
New to Bolt? Sign up free.
Technical definition
A database schema is the formal definition of a database's structure: table and column names, data types, constraints such as required fields and uniqueness, default values, indexes, and the foreign keys that define relationships between tables.
The schema is enforced by the database itself, which is what distinguishes it from convention. A column defined as a required date will reject a missing value or a piece of text, regardless of what the application sends.
Changes to a live schema are applied through migrations, which alter structure without losing the data already stored.
In plain terms
A schema is the set of columns in your data, and the rules about what can go in them.
Deciding that a customer has a name, an email, and a phone number, that the email is required and unique, and that each customer can have many bookings: that is a schema.
Why it matters
The schema is the decision that is cheap to make and expensive to change.
Everything else in an application can be revised. A schema with a year of real data in it cannot be reorganized without a migration, and migrations on live data are where things get lost.
The mistakes that cost the most are structural rather than cosmetic. Storing a customer's address as one text field, then needing to filter by city. Putting several values in one column, then needing to search them separately. Modeling a relationship as one-to-one when the business is one-to-many, which is what happens when someone assumes a customer will only ever have one of something.
With AI building, the schema is the decision the AI makes for you unless you make it. It will infer a reasonable structure from your description, and reasonable is not the same as right for your business.
