Skip to content

Conversation

@jacob-local-kevin
Copy link
Contributor

Summary:

Background

We need to enhance the projects table to store evaluation data for project assessments. This data needs to be persisted in a structured format using a JSONb field, allowing for flexible storage of evaluation metrics and results.

Requirements

  1. Database Changes:

    • Create a new migration file to add an evaluationData JSONb column to the projects table
    • The column should be nullable to maintain compatibility with existing records
    • The JSONb field will store structured evaluation data including metrics, scores, and assessment results
  2. Table Updates:

    • Update the projects table definition in /src/server/db/tables/projects.table.ts to include the new JSONb field
    • Ensure proper TypeScript typing for the new field
  3. TRPC Route Enhancement:

    • Update the project creation route to handle evaluation data storage
    • Add capability to save evaluation data during project creation process
    • Maintain backwards compatibility for existing project creation flows

Expected Outcome

When implemented, the system will be able to:

  • Store structured evaluation data alongside project information
  • Persist evaluation results in a flexible JSONb format
  • Save evaluation data automatically during project creation
  • Maintain existing functionality while adding this new capability

The database structure will be updated to accommodate this new data storage requirement without breaking existing functionality or requiring data migration for existing records.

Technical Details

This implementation involves:

  • Creating a new database migration
  • Updating the projects table schema
  • Enhancing the TRPC route for project creation
  • Ensuring proper typing and validation for the new JSONb field

@jacob-ai-bot --skip-build

Plan:

Step 1: Create /src/server/db/migrations/20241018000000_addEvaluationDataToProjects.ts

Task: Create migration to add 'evaluationData' JSONb column to 'projects' table

Instructions:
Create a new migration file that adds a nullable JSONb column named 'evaluationData' to the 'projects' table. The column should have a default value of NULL to maintain compatibility with existing records. Follow the existing migration file structure and naming conventions as shown in the codebase (e.g., 'add_settings_to_project.ts').

Exit Criteria:
Applying the new migration adds the 'evaluationData' column to the 'projects' table successfully without errors, and existing data remains intact.

Step 2: Edit /src/server/db/tables/projects.table.ts

Task: Update 'ProjectsTable' schema to include 'evaluationData' field

Instructions:
In the file '/src/server/db/tables/projects.table.ts', update the 'ProjectsTable' class by adding a new column definition for 'evaluationData'. Use 't.json().nullable()' to define the column as a nullable JSON field. Ensure TypeScript types 'Project', 'NewProject', and 'ProjectUpdate' are updated to include the new 'evaluationData' field with appropriate typing.

Exit Criteria:
The 'ProjectsTable' class includes the 'evaluationData' field with correct TypeScript typings, and the project builds without any type errors.

Step 3: Edit /src/server/api/routers/onboarding.ts

Task: Enhance TRPC onboarding router to handle 'evaluationData'

Instructions:
In '/src/server/api/routers/onboarding.ts', modify the TRPC procedures related to project creation and settings update to accept an optional 'evaluationData' field. Update the input schema using Zod to include 'evaluationData' as a nullable field. In the 'saveSettings' mutation and any other relevant procedures, adjust the database operations to save 'evaluationData' to the 'projects' table when it is provided. Ensure that the existing functionality remains unaffected when 'evaluationData' is not included.

Exit Criteria:
The TRPC routes handling project creation and updates can now accept and store 'evaluationData' without disrupting existing workflows. All existing functionalities operate as before, and new projects can include 'evaluationData' in their creation process.

@jacob-local-kevin
Copy link
Contributor Author

Hello human! 👋

This PR was created by JACoB to address the issue Add Evaluation Data Storage to Projects Table Using JSONb

Next Steps

  1. Please review the PR carefully. Auto-generated code can and will contain subtle bugs and mistakes.

  2. If you identify code that needs to be changed, please reject the PR with a specific reason.
    Be as detailed as possible in your comments. JACoB will take these comments, make changes to the code and push up changes.
    Please note that this process will take a few minutes.

  3. Once the code looks good, approve the PR and merge the code.

@kleneway
Copy link
Owner

@jacob-ai-bot --fix-errors

@jacob-local-kevin
Copy link
Contributor Author

JACoB here...

You mentioned me, but I don't understand what you want me to do.
At this time, I can only respond to specific commands.

Please check the docs for more information.

@kleneway
Copy link
Owner

@jacob-ai-bot fix error

@jacob-local-kevin
Copy link
Contributor Author

JACoB here...

I'm busy working on this error.

I'll continue to comment on this pull request with status as I make progress.

3 similar comments
@jacob-local-kevin
Copy link
Contributor Author

JACoB here...

I'm busy working on this error.

I'll continue to comment on this pull request with status as I make progress.

@jacob-local-kevin
Copy link
Contributor Author

JACoB here...

I'm busy working on this error.

I'll continue to comment on this pull request with status as I make progress.

@jacob-local-kevin
Copy link
Contributor Author

JACoB here...

I'm busy working on this error.

I'll continue to comment on this pull request with status as I make progress.

@jacob-local-kevin
Copy link
Contributor Author

Hello human! 👋

This PR was updated by JACoB

Next Steps

  1. Please review the PR carefully. Auto-generated code can and will contain subtle bugs and mistakes.

  2. If you identify code that needs to be changed, please reject the PR with a specific reason.
    Be as detailed as possible in your comments. JACoB will take these comments, make changes to the code and push up changes.
    Please note that this process will take a few minutes.

  3. Once the code looks good, approve the PR and merge the code.

kleneway added a commit that referenced this pull request Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants