Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat (dashboard): postgres create with custom types#3148

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
dbm03 wants to merge1 commit intomain
base:main
Choose a base branch
Loading
fromfeat/postgres-support-custom-types

Conversation

dbm03
Copy link
Member

@dbm03dbm03 commentedJan 20, 2025
edited by github-actionsbot
Loading

User description

Resolves#2978


PR Type

Enhancement


Description

  • Add custom column type support in Postgres

  • Implement freeSolo option for column type selection

  • Update create column query to handle custom types

  • Add test for custom column type handling


Changes walkthrough 📝

Relevant files
Enhancement
BaseColumnForm.tsx
Enhance column type selection with custom type support     

dashboard/src/features/orgs/projects/database/dataGrid/components/BaseColumnForm/BaseColumnForm.tsx

  • Added freeSolo and showCustomOption props to column type selection
  • Implemented custom option label for user-defined types
  • Removed noOptionsText prop
  • +3/-1     
    createColumn.ts
    Modify createColumn function to support custom types         

    dashboard/src/features/orgs/projects/database/dataGrid/hooks/useCreateColumnMutation/createColumn.ts

  • Added actualColumn object to handle custom column types
  • Updated prepareCreateColumnQuery call with actualColumn
  • +8/-1     
    Tests
    prepareCreateColumnQuery.test.ts
    Add test for custom column type handling                                 

    dashboard/src/features/orgs/projects/database/dataGrid/hooks/useCreateColumnMutation/prepareCreateColumnQuery.test.ts

  • Added import for ColumnType
  • Implemented new test case for custom column type (varchar(10))
  • +23/-1   
    Miscellaneous
    prepareCreateColumnQuery.ts
    Add debug logging in prepareCreateColumnQuery                       

    dashboard/src/features/orgs/projects/database/dataGrid/hooks/useCreateColumnMutation/prepareCreateColumnQuery.ts

  • Added console.log statements for debugging
  • No functional changes to the query preparation logic
  • +4/-0     

    💡PR-Agent usage: Comment/help "your question" on any pull request to receive relevant information

    @changeset-botchangeset-bot
    Copy link

    ⚠️ No Changeset found

    Latest commit:11c15c7

    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

    @vercelVercel
    Copy link

    vercelbot commentedJan 20, 2025
    edited
    Loading

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

    NameStatusPreviewUpdated (UTC)
    dashboard-staging✅ Ready (Inspect)Visit PreviewJan 20, 2025 11:51am
    example-nextjs-server-components✅ Ready (Inspect)Visit PreviewJan 20, 2025 11:51am
    example-react-apollo✅ Ready (Inspect)Visit PreviewJan 20, 2025 11:51am
    example-sveltekit✅ Ready (Inspect)Visit PreviewJan 20, 2025 11:51am
    example-vue-apollo✅ Ready (Inspect)Visit PreviewJan 20, 2025 11:51am
    1 Skipped Deployment
    NameStatusPreviewUpdated (UTC)
    dashboard⬜️ Ignored (Inspect)Visit PreviewJan 20, 2025 11:51am

    @github-actionsGitHub Actions
    Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    🎫 Ticket compliance analysis 🔶

    2978 - Partially compliant

    Fully compliant requirements:

    • Provide information on how to specify the max character count for varchar

    Not compliant requirements:

    • Clarify the difference between "text" and "varchar" in the documentation
    • Explain the differences in coercions and string functions between text and varchar
    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 PR contains tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Commented Code

    There is a commented out line of code that should be removed or explained if it's intentionally left for future reference.

    constactualColumn={  ...column,type:{    ...column.type,// value: 'varchar(10)' as ColumnType,},};
    Console Logs

    There are console.log statements that should be removed before merging to production.

    console.log('schema, table, column',schema,table,column);letargs:ReturnType<typeofgetPreparedHasuraQuery>[]=[getPreparedHasuraQuery(dataSource,'ALTER TABLE %I.%I ADD %I %I %s %s %s',schema,table,column.name,column.type.value,defaultClause,notNullClause,uniqueClause,),];console.log('args',args);

    @github-actionsGitHub Actions
    Copy link
    Contributor

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                   Score
    Security
    Remove debug console logs

    Remove theconsole.log statements as they are not suitable for production code and
    may expose sensitive information.

    dashboard/src/features/orgs/projects/database/dataGrid/hooks/useCreateColumnMutation/prepareCreateColumnQuery.ts [51-67]

    -console.log('schema, table, column', schema, table, column);- let args: ReturnType<typeof getPreparedHasuraQuery>[] = [   getPreparedHasuraQuery(     dataSource,     'ALTER TABLE %I.%I ADD %I %I %s %s %s',-...--console.log('args', args);-
    Suggestion importance[1-10]: 8

    Why: Removing console.log statements is crucial for production code. These logs could potentially expose sensitive information and impact performance. The suggestion correctly identifies this security and best practice issue.

    8
    Possible issue
    Remove unnecessary type modification

    Remove the commented-out line and ensure that thetype property is correctly set.
    The current implementation might lead to unexpected behavior if thetype object is
    not properly handled.

    dashboard/src/features/orgs/projects/database/dataGrid/hooks/useCreateColumnMutation/createColumn.ts [28-34]

     const actualColumn = {   ...column,-  type: {-    ...column.type,-    // value: 'varchar(10)' as ColumnType,-  },+  type: column.type, };
    Suggestion importance[1-10]: 7

    Why: The suggestion correctly identifies an unnecessary and potentially problematic type modification. Removing it simplifies the code and prevents potential issues with type handling.

    7

    Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
    Reviewers

    @nunopatonunopatoAwaiting requested review from nunopatonunopato will be requested when the pull request is marked ready for reviewnunopato is a code owner

    At least 1 approving review is required to merge this pull request.

    Assignees

    @dbm03dbm03

    Labels
    Projects
    None yet
    Milestone
    No milestone
    Development

    Successfully merging this pull request may close these issues.

    Clarify the difference between “text” and “varchar” (no way to set length?)
    2 participants
    @dbm03@nhost-build

    [8]ページ先頭

    ©2009-2025 Movatter.jp