Modeling Example
Learn about schema and MVP through an example.
We'll cover the following...
Now that we have some data to play with, we can test some application queries for known user stories in the MVP, such as listing the most recent articles per category with the first three comments on each article.
Playing with schema
That’s when we realize our previous schema design misses publication timestamps for articles and comments. We need to add this information to our draft model. As it’s all a draft with random data, the easiest way around this—you already committed the data previously (by editing the script)—is to simply drop schema cascade as shown here:
The next version of our schema then looks like this:
Random timestamp entries
To be able to generate random timestamp entries, the script uses another function that’s not provided by default in PostgreSQL, and here’s its definition:
Now we can have a go at solving the first query of the product’s MVP, as specified before, on this schema draft version. That should provide a taste of the schema and how well it implements the business rules.
Enlist the data
The following query lists the most recent articles per category with the first three comments on ...