You can represent types with both shared and type-specific attributes as a discriminated union in TypeScript. Let's model that relationship in a database.
Using prisma.$queryRaw, I was able to write a basic query that returned the data I needed. However, I also needed the query to filter and order the data.
If you use iMessage, you can access and query the database where all of the messages are stored. All you need is a Mac and some basic SQL skills to begin!
I developed a method of logging the queries executed by Knex.js and the execution times for each query. It can be applied to nearly any app that uses Knex.