Clause Code : DB Setup
- Will be setting up postgres DB on neon
- it gives upto 10 databases for free ( no need to add credit card )
drizzle ORM https://orm.drizzle.team/docs/get-started-postgresql
https://ui.shadcn.com/ it is a set of beautifully designed components that you can customize, extend, and build on.
if you want to install drizzle into your codebase using claude code all you do is type "install drizzle into the project using the following documentation <paste all data from link below>" https://orm.drizzle.team/docs/get-started-postgresql
Create DB Schema
- switch claude code into plan mode (shift + tab)
- use prompt like "Plan a table schema to log workouts. Each workout can have multiple exercises, and each exercise can have multiple sets. make sure this is normalized. Then, because we're using drizzle for our project, ideally we will inform cloud code that we want to create a drizzle schema."
[prompt 1 / plan mode]:
this is a workout logging app. plan a table schema to log workouts, each workout can have multiple exercises, and each exercise can have multiple sets. make sure this is normalized. the schema must be created using drizzle orm for a postgres db hosted on neon.
[prompt 2 / plan mode]:
this plan looks good, it just needs a few tweaks. add a started_at and completed_at column for the workouts table. also remove the notes and duration.
[prompt 3 / plan mode]:
for the exercises table remove the description, muscle_groups, equipment_type, but add a created_at and updated_at olumn. for the workout_exercises table rename the oder_in_workout to order, remove the notes, and add a created_at column. for the sets table remove the rpe, rest_time and notes, but add a created_at column.
Use Neon MCP in claude code to generate schema db
[terminal]:
npx drizzle-kit push
[terminal]:
npx add-mcp https://mcp.neon.tech/mcp
[prompt 1 / default mode]:
/mcp
[prompt 2 / default mode]:
list all of the available tables within the liftingdiarycourse db on neon
[prompt 3 / default mode]:
generate some example data for the above tables for user id [enter_user_id_here]. do not insert any data just yet into the neon database. I want to check the example data first.
[prompt 4 / default mode]:
this looks great. now insert all of that example data to the liftingdiarycourse db
Comments
Post a Comment