Skip to content

Create a simplified prisma schema for Postgres database with only the tables necessary to store measurements #208

@mikepsinn

Description

@mikepsinn

We may want to update the Prisma schema of the NextJS app with the tables necessary to store measurements, variables, units, reminders, etc. instead of solely depending on the API to store this data.

Schema to Update

Here's the NextJS Prisma Postgres schema to update
https://github.com/FDA-AI/FDAi/blob/eb480b9e50318efeebd30bff6a81b984adace994/apps/nextjs/prisma/schema.prisma

Reference Table Definitions

For reference to the tables we need to add, there's a MySQL Prisma Schema and some SQL files

  1. MySQL Prisma with the measurements table and relations
    https://github.com/FDA-AI/FDAi/blob/d441d67b44f8ef14aec2784cee9ded1fffb5a3dd/apps/api-gateway/prisma/schema.prisma#L1396-L1449

The problem with that schema is that there are a lot of tables that aren't absolutely necessary and complexity to the project

  1. This folder contains the SQL files and documentation
    https://github.com/FDA-AI/FDAi/blob/6055dce1ed1efa625cfc46cde1c98763a3536e4f/apps/dfda-1/database/ddl/quantimodo_test/measurements.sql#L3-L55

Comments

It would probably be nice to have comments from those SQL files in the Prisma schema
https://www.prisma.io/docs/orm/prisma-schema/overview

Approach

You can probably paste the existing necessary tables from the SQL files into Claude and have it convert the table and its comments to a Postgres Prisma-compatible version and then paste it in
https://github.com/FDA-AI/FDAi/blob/eb480b9e50318efeebd30bff6a81b984adace994/apps/nextjs/prisma/schema.prisma

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions