Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Primary key icon #108

Merged
merged 4 commits into from
Nov 29, 2024
Merged

Primary key icon #108

merged 4 commits into from
Nov 29, 2024

Conversation

hoshinotsuyoshi
Copy link
Member

@hoshinotsuyoshi hoshinotsuyoshi commented Nov 28, 2024

Summary

Added Primary key icon

スクリーンショット 2024-11-28 19 04 16

Related Issue

N/A

Changes

  • Updated the parser to mark id fields as primary keys (PK: true) when no explicit primary key is defined in schema.rb.
  • Updated the convertToDBStructure function to correctly handle primary key attributes.
  • Adjusted test snapshots and test cases to reflect the inclusion of primary key information.
  • Added a new PrimaryKeyIcon component to visually indicate primary keys in the ERD renderer.
  • Integrated the PrimaryKeyIcon into the TableNode component in the ERD renderer.
  • Included PrimaryKeyIcon in the icon library and Storybook for documentation and testing.

Testing

Run:

pnpm dev

However, there might be some development cache issues.

For my part, I tested it with:

$ git clean -fdx && asdf local nodejs 22.11.0 && pnpm i && pnpm build && pnpm dev

But as a reviewer, you don't need to go that far. 👌

Other Information

N/A

@hoshinotsuyoshi hoshinotsuyoshi self-assigned this Nov 28, 2024
@hoshinotsuyoshi hoshinotsuyoshi changed the base branch from main to Switch-from-using-pgsql-parser-to-pg-query-emscripten November 29, 2024 05:22
- Updated the parser to mark `id` fields as primary keys (`PK: true`) when no explicit primary key is defined in `schema.rb`.
- Updated the `convertToDBStructure` function to correctly handle primary key attributes.
- Adjusted test snapshots and test cases to reflect the inclusion of primary key information.
- Added a new `PrimaryKeyIcon` component to visually indicate primary keys in the ERD renderer.
- Integrated the `PrimaryKeyIcon` into the `TableNode` component in the ERD renderer.
- Included `PrimaryKeyIcon` in the icon library and Storybook for documentation and testing.
The setup process might take some time for now.
Comment on lines -2321 to +2322
type: { type_name: "varchar" }
type: { type_name: "varchar" },
PK: true,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOTE: src/parser/postgres have already primary-key handling logic.

@hoshinotsuyoshi hoshinotsuyoshi changed the title Primary key icon (work in progress) Primary key icon Nov 29, 2024
@hoshinotsuyoshi hoshinotsuyoshi marked this pull request as ready for review November 29, 2024 05:41
@hoshinotsuyoshi hoshinotsuyoshi requested a review from a team as a code owner November 29, 2024 05:41
@hoshinotsuyoshi hoshinotsuyoshi requested review from FunamaYukina, junkisai, MH4GF and sasamuku and removed request for a team November 29, 2024 05:41
Copy link
Member

@sasamuku sasamuku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM👍


Please note that pegjs will be replaced to prism.
In prism parser, primary_key is supported so it will be easy to switch.
see: #114.

Copy link
Member

@MH4GF MH4GF left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have any questions, please call me at huddle!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copying the code is hard, so I would like you to add a package and use that! example:

import { PrimaryKeyIcon } from 'lucide-react'

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 commit pushed 🙏

How about this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hoshinotsuyoshi Thanks for adjusting!
I don't see much reason to wrap the component, and I was wondering if I could export directly here?

https://github.com/liam-hq/liam/pull/108/files#diff-9d7f1f83ab8062353f054ddd7ce5e8c461dc0919d57a14e957d71414e6f08c63R5

example:

export { KeyRound } from 'lucide-react'`

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I honestly don't mind either way! I'll make the adjustments.

Copy link
Member Author

@hoshinotsuyoshi hoshinotsuyoshi Nov 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 commit pushed : b6f81fe

Base automatically changed from Switch-from-using-pgsql-parser-to-pg-query-emscripten to main November 29, 2024 08:07
@hoshinotsuyoshi hoshinotsuyoshi added this pull request to the merge queue Nov 29, 2024
Merged via the queue into main with commit 109a2dd Nov 29, 2024
7 checks passed
@hoshinotsuyoshi hoshinotsuyoshi deleted the primary-key-icon branch November 29, 2024 09:37
@hoshinotsuyoshi
Copy link
Member Author

Merging this to fix the flaky test. #94 (comment)

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.

3 participants