Get the latest tech news

Choosing a Database Schema for Polymorphic Data (2024)


Blog for DoltHub, a website hosting databases made with Dolt, an open-source version-controlled SQL database with Git-like semantics.

And it often requires making decisions before having a clear picture of the exact shape and distribution of your data, or what the common access patterns will look like. If you're more accustomed to object oriented programming, you might implement this same data type via abstract classes and inheritance, like the following Java code: There's value in being able to express our invariants using the specific tools like FOREIGN KEY and NOT NULL constraints instead of arbitrary CHECK s. It makes the schema more readable and easier to maintain.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of polymorphic data

polymorphic data

Photo of database schema

database schema