liam icon indicating copy to clipboard operation
liam copied to clipboard

💥 Migrate to `snake_case` table/column name in frontend/apps/app

Open hoshinotsuyoshi opened this issue 7 months ago • 8 comments
trafficstars

Issue

  • resolve:

Why is this change needed?

  • We decided to make frontend/apps/app 's table/column name to use snake_case
  • We decided to use timestamp with time zone

What would you like reviewers to focus on?

  • CI passes
  • Ensure that all timestamp columns have been updated to use with time zone consistently.
  • Confirm that no unintended schema changes were introduced in the process.

Testing Verification

I'll do in staging before merge.

tested in staging

trigger.dev : スクリーンショット 2025-04-17 19 02 35

review completed: https://github.com/liam-hq/liam/pull/1383#issuecomment-2812315596

スクリーンショット 2025-04-17 19 03 09

What was done

🤖 Generated by PR Agent at 06661f853dd1b17ed08dae3cb25f6b62f3602326

  • Migrated all table and column names to snake_case across the database schema and application logic.
  • Updated timestamp columns to use with time zone for consistency.
  • Refactored logic and UI components to align with the updated schema structure.
  • Adjusted test cases to reflect the new snake_case schema and ensure correctness.
  • Updated schema override configuration to match the new naming conventions.
  • Ensured no unintended schema changes were introduced and verified CI passes.

Detailed Changes

Relevant files
Enhancement
54 files
database.types.ts
Refactor database types to use snake_case naming convention.

frontend/packages/db/supabase/database.types.ts

  • Migrated table and column names to snake_case.
  • Updated foreign key references and enums to align with new naming
    conventions.
  • Added new tables and relationships for improved schema structure.
  • Adjusted enums to use snake_case naming.
  • +348/-348
    approveKnowledgeSuggestion.ts
    Update approveKnowledgeSuggestion logic for snake_case schema.

    frontend/apps/app/features/projects/actions/approveKnowledgeSuggestion.ts

  • Updated table and column references to snake_case.
  • Adjusted logic to align with new schema structure.
  • +21/-21 
    savePullRequest.ts
    Refactor savePullRequest logic for snake_case schema.       

    frontend/packages/jobs/src/tasks/review/savePullRequest.ts

  • Updated table and column references to snake_case.
  • Refactored logic to align with updated schema structure.
  • +25/-25 
    processCreateKnowledgeSuggestion.ts
    Refactor processCreateKnowledgeSuggestion for snake_case schema.

    frontend/packages/jobs/src/functions/processCreateKnowledgeSuggestion.ts

  • Updated table and column references to snake_case.
  • Adjusted logic to align with new schema structure.
  • +25/-21 
    saveReview.ts
    Refactor saveReview logic for snake_case schema.                 

    frontend/packages/jobs/src/tasks/review/saveReview.ts

  • Updated table and column references to snake_case.
  • Refactored logic to align with updated schema structure.
  • +22/-19 
    postComment.ts
    Update postComment logic for snake_case schema.                   

    frontend/packages/jobs/src/tasks/review/postComment.ts

  • Updated table and column references to snake_case.
  • Adjusted logic to align with new schema structure.
  • +15/-15 
    processGenerateSchemaOverride.ts
    Refactor processGenerateSchemaOverride for snake_case schema.

    frontend/packages/jobs/src/functions/processGenerateSchemaOverride.ts

  • Updated table and column references to snake_case.
  • Adjusted logic to align with updated schema structure.
  • +21/-19 
    addProject.ts
    Update addProject logic for snake_case schema.                     

    frontend/apps/app/features/projects/actions/addProject.ts

  • Updated table and column references to snake_case.
  • Adjusted logic to align with new schema structure.
  • +12/-12 
    getProject.ts
    Refactor getProject logic for snake_case schema.                 

    frontend/apps/app/features/projects/pages/ProjectDetailPage/getProject.ts

  • Updated table and column references to snake_case.
  • Adjusted logic to align with updated schema structure.
  • +19/-19 
    getCurrentOrganization.ts
    Refactor getCurrentOrganization logic for snake_case schema.

    frontend/apps/app/features/projects/pages/ProjectsPage/getCurrentOrganization.ts

  • Updated table and column references to snake_case.
  • Adjusted logic to align with new schema structure.
  • +9/-9     
    route.ts
    Refactor schema override route for snake_case schema.       

    frontend/apps/app/app/api/schema/override/route.ts

  • Updated table and column references to snake_case.
  • Adjusted logic to align with new schema structure.
  • +8/-8     
    getProjectRepository.ts
    Refactor getProjectRepository logic for snake_case schema.

    frontend/apps/app/app/(app)/app/projects/[projectId]/ref/[branchOrCommit]/docs/[...docFilePath]/getProjectRepository.ts

  • Updated table and column references to snake_case.
  • Adjusted logic to align with updated schema structure.
  • +8/-8     
    reviewFeedbackComments.ts
    Update reviewFeedbackComments logic for snake_case schema.

    frontend/apps/app/features/migrations/actions/reviewFeedbackComments.ts

  • Updated table and column references to snake_case.
  • Adjusted logic to align with new schema structure.
  • +10/-10 
    generateReview.ts
    Refactor generateReview logic for snake_case schema.         

    frontend/packages/jobs/src/tasks/review/generateReview.ts

  • Updated table and column references to snake_case.
  • Adjusted logic to align with updated schema structure.
  • +7/-7     
    getOrganizationDetails.ts
    Refactor getOrganizationDetails logic for snake_case schema.

    frontend/apps/app/features/organizations/pages/OrganizationDetailPage/getOrganizationDetails.ts

  • Updated table and column references to snake_case.
  • Adjusted logic to align with new schema structure.
  • +7/-7     
    formatReviewFeedback.ts
    Update formatReviewFeedback logic for snake_case schema. 

    frontend/apps/app/features/migrations/utils/formatReviewFeedback.ts

  • Updated references to feedback fields to use snake_case.
  • Adjusted logic to align with updated schema structure.
  • +4/-4     
    processGenerateDocsSuggestion.ts
    Refactor processGenerateDocsSuggestion for snake_case schema.

    frontend/packages/jobs/src/functions/processGenerateDocsSuggestion.ts

  • Updated table and column references to snake_case.
  • Adjusted logic to align with new schema structure.
  • +7/-7     
    route.ts
    Refactor GitHub webhook route for snake_case schema.         

    frontend/apps/app/app/api/webhook/github/route.ts

  • Updated table and column references to snake_case.
  • Adjusted logic to align with updated schema structure.
  • +5/-5     
    route.ts
    Refactor project search API for snake_case schema.             

    frontend/apps/app/app/api/projects/search/route.ts

  • Updated table and column references to snake_case.
  • Adjusted logic to align with new schema structure.
  • +3/-3     
    getOrganizations.ts
    Refactor getOrganizations logic for snake_case schema.     

    frontend/apps/app/features/organizations/pages/OrganizationsPage/getOrganizations.ts

  • Updated table and column references to snake_case.
  • Adjusted logic to align with updated schema structure.
  • +4/-4     
    resolveReviewFeedback.ts
    Update resolveReviewFeedback logic for snake_case schema.

    frontend/apps/app/features/migrations/actions/resolveReviewFeedback.ts

  • Updated table and column references to snake_case.
  • Adjusted logic to align with new schema structure.
  • +4/-4     
    resolveReviewIssue.ts
    Update resolveReviewIssue logic for snake_case schema.     

    frontend/apps/app/features/migrations/actions/resolveReviewIssue.ts

  • Updated table and column references to snake_case.
  • Adjusted logic to align with updated schema structure.
  • +4/-4     
    getProjects.ts
    Refactor getProjects logic for snake_case schema.               

    frontend/apps/app/features/projects/pages/ProjectsPage/getProjects.ts

  • Updated table and column references to snake_case.
  • Adjusted logic to align with new schema structure.
  • +3/-3     
    useProjectSearch.ts
    Update useProjectSearch hook for snake_case schema.           

    frontend/apps/app/features/projects/hooks/useProjectSearch.ts

  • Updated type references to use snake_case schema.
  • Adjusted logic to align with updated schema structure.
  • +2/-2     
    getGitHubDocFilePaths.ts
    Refactor getGitHubDocFilePaths logic for snake_case schema.

    frontend/apps/app/app/(app)/app/projects/[projectId]/ref/[branchOrCommit]/docs/getGitHubDocFilePaths.ts

  • Updated table and column references to snake_case.
  • Adjusted logic to align with new schema structure.
  • +2/-2     
    getInstallationIdFromRepositoryId.ts
    Update getInstallationIdFromRepositoryId logic for snake_case schema.

    frontend/packages/jobs/src/functions/getInstallationIdFromRepositoryId.ts

  • Updated table and column references to snake_case.
  • Adjusted logic to align with updated schema structure.
  • +3/-3     
    checkSchemaChanges.ts
    Refactor checkSchemaChanges logic for snake_case schema. 

    frontend/apps/app/app/api/webhook/github/utils/checkSchemaChanges.ts

  • Updated table and column references to snake_case.
  • Adjusted logic to align with new schema structure.
  • +2/-2     
    getDocumentContent.ts
    Refactor getDocumentContent logic for snake_case schema. 

    frontend/apps/app/app/(app)/app/projects/[projectId]/ref/[branchOrCommit]/docs/[...docFilePath]/getDocumentContent.ts

  • Updated table and column references to snake_case.
  • Adjusted logic to align with updated schema structure.
  • +1/-1     
    updateKnowledgeSuggestionContent.ts
    Update updateKnowledgeSuggestionContent logic for snake_case schema.

    frontend/apps/app/features/projects/actions/updateKnowledgeSuggestionContent.ts

  • Updated table and column references to snake_case.
  • Adjusted logic to align with new schema structure.
  • +1/-1     
    getOriginalDocumentContent.ts
    Refactor getOriginalDocumentContent logic for snake_case schema.

    frontend/apps/app/features/projects/utils/getOriginalDocumentContent.ts

  • Updated table and column references to snake_case.
  • Adjusted logic to align with updated schema structure.
  • +1/-1     
    githubFileUtils.ts
    Update githubFileUtils logic for snake_case schema.           

    frontend/packages/jobs/src/utils/githubFileUtils.ts

  • Updated table and column references to snake_case.
  • Adjusted logic to align with updated schema structure.
  • +1/-1     
    MigrationDetailPage.tsx
    Refactor MigrationDetailPage for snake_case schema.           

    frontend/apps/app/features/migrations/pages/MigrationDetailPage/MigrationDetailPage.tsx

  • Updated table and column references to snake_case.
  • Adjusted logic and UI to align with updated schema structure.
  • +61/-57 
    ReviewFeedbackList.tsx
    Update ReviewFeedbackList component for snake_case schema.

    frontend/apps/app/features/migrations/components/ReviewFeedbackList/ReviewFeedbackList.tsx

  • Updated references to feedback fields to use snake_case.
  • Adjusted logic and UI to align with updated schema structure.
  • +13/-13 
    KnowledgeSuggestionDetailPage.tsx
    Refactor KnowledgeSuggestionDetailPage for snake_case schema.

    frontend/apps/app/features/projects/pages/KnowledgeSuggestionDetailPage/KnowledgeSuggestionDetailPage.tsx

  • Updated table and column references to snake_case.
  • Adjusted logic and UI to align with updated schema structure.
  • +19/-16 
    ContentForSchema.tsx
    Update ContentForSchema component for snake_case schema. 

    frontend/apps/app/features/projects/pages/KnowledgeSuggestionDetailPage/ContentForSchema.tsx

  • Updated table and column references to snake_case.
  • Adjusted logic to align with updated schema structure.
  • +8/-7     
    OrganizationDetailPage.tsx
    Refactor OrganizationDetailPage for snake_case schema.     

    frontend/apps/app/features/organizations/pages/OrganizationDetailPage/OrganizationDetailPage.tsx

  • Updated table and column references to snake_case.
  • Adjusted logic and UI to align with updated schema structure.
  • +6/-6     
    BranchDetailPage.tsx
    Refactor BranchDetailPage for snake_case schema.                 

    frontend/apps/app/features/projects/pages/BranchDetailPage/BranchDetailPage.tsx

  • Updated table and column references to snake_case.
  • Adjusted logic to align with updated schema structure.
  • +8/-8     
    SchemaPage.tsx
    Refactor SchemaPage for snake_case schema.                             

    frontend/apps/app/features/schemas/pages/SchemaPage/SchemaPage.tsx

  • Updated table and column references to snake_case.
  • Adjusted logic to align with updated schema structure.
  • +9/-9     
    KnowledgeSuggestionsListPage.tsx
    Refactor KnowledgeSuggestionsListPage for snake_case schema.

    frontend/apps/app/features/projects/pages/KnowledgeSuggestionsListPage/KnowledgeSuggestionsListPage.tsx

  • Updated table and column references to snake_case.
  • Adjusted logic and UI to align with updated schema structure.
  • +10/-8   
    ProjectBranchesListPage.tsx
    Refactor ProjectBranchesListPage for snake_case schema.   

    frontend/apps/app/features/projects/pages/ProjectBranchesListPage/ProjectBranchesListPage.tsx

  • Updated table and column references to snake_case.
  • Adjusted logic to align with updated schema structure.
  • +7/-7     
    page.tsx
    Refactor main page logic for snake_case schema.                   

    frontend/apps/app/app/(app)/app/page.tsx

  • Updated table and column references to snake_case.
  • Adjusted logic to align with updated schema structure.
  • +4/-4     
    OrganizationNewPage.tsx
    Update OrganizationNewPage logic for snake_case schema.   

    frontend/apps/app/features/organizations/pages/OrganizationNewPage/OrganizationNewPage.tsx

  • Updated table and column references to snake_case.
  • Adjusted logic to align with updated schema structure.
  • +4/-4     
    ProjectItem.tsx
    Update ProjectItem component for snake_case schema.           

    frontend/apps/app/features/projects/components/ProjectItem/ProjectItem.tsx

  • Updated references to project fields to use snake_case.
  • Adjusted UI to align with updated schema structure.
  • +2/-2     
    page.tsx
    Refactor new project page for snake_case schema.                 

    frontend/apps/app/app/(app)/app/organizations/[organizationId]/projects/new/page.tsx

  • Updated table and column references to snake_case.
  • Adjusted logic to align with updated schema structure.
  • +1/-1     
    CommentList.tsx
    Update CommentList component for snake_case schema.           

    frontend/apps/app/features/migrations/components/ReviewFeedbackComments/CommentList/CommentList.tsx

  • Updated references to comment fields to use snake_case.
  • Adjusted UI to align with updated schema structure.
  • +1/-1     
    page.tsx
    Refactor organization projects page for snake_case schema.

    frontend/apps/app/app/(app)/app/organizations/[organizationId]/projects/page.tsx

  • Updated table and column references to snake_case.
  • Adjusted logic to align with updated schema structure.
  • +1/-1     
    DocsListPage.tsx
    Refactor DocsListPage for snake_case schema.                         

    frontend/apps/app/app/(app)/app/projects/[projectId]/ref/[branchOrCommit]/docs/DocsListPage.tsx

  • Updated table and column references to snake_case.
  • Adjusted logic to align with updated schema structure.
  • +1/-1     
    20250416105745_initial_squash.sql
    Standardized database schema with snake_case naming and timezone
    support.

    frontend/packages/db/supabase/migrations/20250416105745_initial_squash.sql

  • Migrated table and column names to snake_case for consistency.
  • Updated timestamp columns to use with time zone.
  • Adjusted constraints, indexes, and foreign keys to align with new
    naming conventions.
  • Updated policies and grants to reflect the renamed tables and columns.
  • +299/-338
    schema.sql
    Schema adjustments for `snake_case` and timezone consistency.

    frontend/packages/db/schema/schema.sql

  • Renamed table and column names to snake_case.
  • Updated timestamp columns to use with time zone.
  • Adjusted constraints, indexes, and foreign keys to match new naming
    conventions.
  • Updated policies and grants to reflect schema changes.
  • +308/-308
    ContentForDoc.tsx
    Adjusted property access for `snake_case` compliance.       

    frontend/apps/app/features/projects/pages/KnowledgeSuggestionDetailPage/ContentForDoc.tsx

    • Updated property access to use snake_case for approved_at.
    +1/-1     
    ReviewFeedbackContext.tsx
    Updated type definitions for `snake_case` compliance.       

    frontend/apps/app/features/migrations/contexts/ReviewFeedbackContext.tsx

  • Updated type definitions to use snake_case for review_feedbacks and
    review_suggestion_snippets.
  • +2/-2     
    AppBar.tsx
    Adjusted `Project` type definition for `snake_case`.         

    frontend/apps/app/components/AppBar/AppBar.tsx

    • Updated type definition for Project to use snake_case.
    +1/-1     
    ClientSearchWrapper.tsx
    Adjusted `initialProjects` type definition for `snake_case`.

    frontend/apps/app/features/projects/pages/ProjectsPage/ClientSearchWrapper.tsx

    • Updated type definition for initialProjects to use snake_case.
    +1/-1     
    ClientAppBar.tsx
    Adjusted `Project` type definition for `snake_case`.         

    frontend/apps/app/components/CommonLayout/ClientAppBar.tsx

    • Updated type definition for Project to use snake_case.
    +1/-1     
    Tests
    6 files
    postComment.test.ts
    Adjust postComment test cases for snake_case schema.         

    frontend/packages/jobs/src/tasks/review/tests/postComment.test.ts

  • Updated test data to use snake_case table and column names.
  • Adjusted assertions to match new schema structure.
  • +32/-32 
    processSaveReview.test.ts
    Update processSaveReview test cases for snake_case schema.

    frontend/packages/jobs/src/tasks/review/tests/processSaveReview.test.ts

  • Updated test data and logic to use snake_case schema.
  • Adjusted assertions to match updated schema structure.
  • +28/-28 
    getProjectRepository.test.ts
    Update getProjectRepository test cases for snake_case schema.

    frontend/apps/app/app/(app)/app/projects/[projectId]/ref/[branchOrCommit]/docs/[...docFilePath]/getProjectRepository.test.ts

  • Updated test data to use snake_case schema.
  • Adjusted assertions to match updated schema structure.
  • +10/-10 
    getGitHubDocFilePaths.test.ts
    Update getGitHubDocFilePaths test cases for snake_case schema.

    frontend/apps/app/app/(app)/app/projects/[projectId]/ref/[branchOrCommit]/docs/getGitHubDocFilePaths.test.ts

  • Updated test data to use snake_case schema.
  • Adjusted assertions to match updated schema structure.
  • +8/-8     
    checkSchemaChanges.test.ts
    Update checkSchemaChanges test cases for snake_case schema.

    frontend/apps/app/app/api/webhook/github/utils/tests/checkSchemaChanges.test.ts

  • Updated test data to use snake_case schema.
  • Adjusted assertions to match updated schema structure.
  • +7/-7     
    getProjects.test.ts
    Update getProjects test cases for snake_case schema.         

    frontend/apps/app/features/projects/pages/ProjectsPage/getProjects.test.ts

  • Updated test data to use snake_case schema.
  • Adjusted assertions to match updated schema structure.
  • +3/-3     
    Configuration changes
    1 files
    schema-override.yml
    Update schema override configuration for snake_case schema.

    .liam/schema-override.yml

  • Updated schema override configuration to use snake_case table and
    column names.
  • Adjusted comments to reflect new naming conventions.
  • +19/-19 

    Additional Notes


    Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • hoshinotsuyoshi avatar Apr 17 '25 06:04 hoshinotsuyoshi

    ⚠️ No Changeset found

    Latest commit: da246faeaea485e937398468f10a29a16f5f1194

    Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

    This PR includes no changesets

    When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

    Click here to learn what changesets are, and how to add one.

    Click here if you're a maintainer who wants to add a changeset to this PR

    changeset-bot[bot] avatar Apr 17 '25 06:04 changeset-bot[bot]

    The latest updates on your projects. Learn more about Vercel for Git ↗︎

    Name Status Preview Comments Updated (UTC)
    liam-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 17, 2025 11:34pm
    liam-erd-sample ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 17, 2025 11:34pm
    1 Skipped Deployment
    Name Status Preview Comments Updated (UTC)
    liam-docs ⬜️ Ignored (Inspect) Visit Preview Apr 17, 2025 11:34pm

    vercel[bot] avatar Apr 17 '25 06:04 vercel[bot]

    This migration renames tables, columns, indexes, and constraints from CamelCase to snake_case across the codebase. There is a critical risk that some references or foreign keys may be missed, potentially affecting rollback and data integrity. Overall, the changes improve consistency and readability, which will benefit long-term maintainability and audits.

    Migration URL: https://liam-app-git-staging-route-06-core.vercel.app/app/projects/6/ref/snake_case-postgres-objects/migrations/187

    ER Diagram:

    • View ERD for frontend/packages/db/schema/schema.sql: https://liam-app-git-staging-route-06-core.vercel.app/app/projects/6/ref/snake_case-postgres-objects/schema/frontend/packages/db/schema/schema.sql

    frontend/packages/prompt-test result:

    visit: https://cloud.langfuse.com/project/cm8ii4o5o03fpad078o638g1d/datasets/cm99wciaz070ead07rgjr88ou/runs/cm9lzw4l000u7ad074q3p0dtt

    run items length
    3

    github-actions[bot] avatar Apr 17 '25 06:04 github-actions[bot]

    This migration refactors the entire codebase and SQL schema to use snake_case for table, column and key names, and updates all timestamp fields to use with time zone. A critical issue is the potential for missed legacy camelCase references and misaligned foreign keys that may disrupt data integrity and rollback safety. Overall, the consistent adherence to naming conventions and comprehensive refactoring is positive; however, thorough testing and review of RLS policies and indexing are recommended to ensure system stability and performance.

    Migration URL: https://liam-erd-web.vercel.app/app/projects/6/ref/snake_case-postgres-objects/migrations/190

    ER Diagram:

    • View ERD for frontend/packages/db/schema/schema.sql: https://liam-erd-web.vercel.app/app/projects/6/ref/snake_case-postgres-objects/schema/frontend/packages/db/schema/schema.sql

    liam-migration[bot] avatar Apr 17 '25 07:04 liam-migration[bot]

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
    🧪 PR contains tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Inconsistent Field Names
    The function is still using old camelCase field names (projectId, installationId) when querying the database, but the database schema has been migrated to snake_case. This could cause runtime errors.

    Inconsistent Field Names

    The function is still using old camelCase field names (projectId, isReviewEnabled) when querying the database, but the database schema has been migrated to snake_case. This could cause runtime errors.

    .from('github_doc_file_paths')
    .select('*')
    .eq('projectId', payload.projectId)
    .eq('isReviewEnabled', true)
    
    

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Impact
    Possible issue
    Use snake_case column name
    Suggestion Impact:The commit implemented exactly what was suggested - changing the column name in the query from 'projectId' to 'project_id' to match the snake_case naming convention used in the database schema

    code diff:

    -      .eq('projectId', projectId)
    +      .eq('project_id', projectId)
    

    The column name should be updated to project_id to match the snake_case naming
    convention being applied throughout the codebase. This ensures consistency with
    the database schema changes.

    frontend/packages/jobs/src/utils/githubFileUtils.ts [25-27]

     .from('github_schema_file_paths')
       .select('path, format')
    -  .eq('projectId', projectId)
    +  .eq('project_id', projectId)
    

    [To ensure code accuracy, apply this suggestion manually]

    Suggestion importance[1-10]: 8

    __

    Why: The suggestion correctly identifies an inconsistency where the column name in the query is still using camelCase ('projectId') while the table name has been updated to snake_case. This needs to be fixed for the query to work properly with the updated schema.

    Medium
    General
    Auto-update timestamp fields

    Consider adding a trigger to automatically update the "updated_at" timestamp
    whenever a record is modified. This will ensure the field is always current
    without requiring manual updates in application code.

    frontend/packages/db/supabase/migrations/20250416105745_initial_squash.sql [156-157]

     "created_at" timestamp(3) with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    -"updated_at" timestamp(3) with time zone NOT NULL
    +"updated_at" timestamp(3) with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    +CONSTRAINT "trigger_update_timestamp" BEFORE UPDATE ON "table_name" FOR EACH ROW EXECUTE FUNCTION update_timestamp()
    

    [To ensure code accuracy, apply this suggestion manually]

    Suggestion importance[1-10]: 7

    __

    Why: The suggestion to add an automatic timestamp update trigger is valuable as it would ensure consistent timestamp management across all tables without relying on application code. This would prevent potential data integrity issues from forgotten manual updates.

    Medium
    Consistent parameter naming convention
    Suggestion Impact:The commit changed the column name in the query from 'projectId' to 'project_id' to match the snake_case naming convention of the database column, which was exactly what the suggestion recommended

    code diff:

    -      .eq('projectId', projectId)
    +      .eq('project_id', projectId)
    

    The query parameter projectId should be renamed to match the snake_case naming
    convention being used for column names. While this won't cause immediate issues,
    it's better to maintain consistent naming between parameters and column names.

    frontend/packages/jobs/src/utils/githubFileUtils.ts [25-28]

     .from('github_schema_file_paths')
       .select('path, format')
    -  .eq('project_id', projectId)
    +  .eq('project_id', project_id)
       .single()
    

    [To ensure code accuracy, apply this suggestion manually]

    Suggestion importance[1-10]: 3

    __

    Why: While the suggestion promotes consistency in naming conventions, it's not critical for functionality. The parameter name doesn't need to match the column name exactly as it's just a variable in the code. Changing function parameters would require broader changes across the codebase.

    Low
    Learned
    best practice
    Maintain consistent naming conventions in error messages that match database field naming patterns

    The PR is migrating from camelCase to snake_case for database table and column
    names, but this error message still uses "Pull request" with a space instead of
    the consistent "pull_request" naming convention being established throughout the
    codebase. Update the error message to use the same naming convention as the
    database fields.

    frontend/packages/jobs/src/tasks/review/postComment.ts [115-119]

     if (!prRecord.migrations || !prRecord.migrations[0]) {
       throw new Error(
    -    `Migration for Pull request with ID ${pullRequestId} not found`,
    +    `Migration for pull_request with ID ${pullRequestId} not found`,
       )
     }
    

    [To ensure code accuracy, apply this suggestion manually]

    Suggestion importance[1-10]: 6
    Low
    • [ ] Update

    This PR migrates all database identifiers from camelCase to snake_case and standardizes timestamp columns with time zone support. A critical issue is that legacy camelCase references still appear in many queries and tests, risking migration safety and data integrity. Overall, the changes enhance consistency and maintainability, but clarifications on automatic trigger use and post-migration index checks are recommended.

    Migration URL: https://liam-app-git-staging-route-06-core.vercel.app/app/projects/9d777f64-400a-42f3-a60e-98a59fc97279/ref/snake_case-postgres-objects/migrations/39d69dd6-163a-4f47-b93a-d56a3c6f8a68

    ER Diagram:

    • View ERD for frontend/packages/db/schema/schema.sql: https://liam-app-git-staging-route-06-core.vercel.app/app/projects/9d777f64-400a-42f3-a60e-98a59fc97279/ref/snake_case-postgres-objects/schema/frontend/packages/db/schema/schema.sql

    Thank you! I want to merge today

    hoshinotsuyoshi avatar Apr 18 '25 00:04 hoshinotsuyoshi