Skip to content

Feat/postgres table inheritance fixed #524

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

Merged

Conversation

kishansinghifs1
Copy link
Contributor

Summary
This PR adds full support for PostgreSQL table inheritance in the schema export generator (#472 ).

What's Included
✅ Proper generation of INHERITS clause in CREATE TABLE statements.
✅ Child tables only include non-inherited fields in SQL output.
✅ Parent table fields are automatically inherited by child tables.
✅ Maintains correct handling of:
PRIMARY KEY, UNIQUE, NOT NULL
DEFAULT, CHECK, and ARRAY modifiers.
✅ Table and column comments are still supported.

Implementation Notes
Used table.inherits array to determine parent table(s).
Computed inheritedFieldNames from parent tables to avoid duplication.
Adjusted PRIMARY KEY generation to apply only to non-inherited fields in child tables.

🖥️ Screen Recording

Screen.Recording.2025-07-02.145149.mp4

Copy link

vercel bot commented Jul 2, 2025

Someone is attempting to deploy a commit to the dottle's projects Team on Vercel.

A member of the Team first needs to authorize it.

@1ilit
Copy link
Member

1ilit commented Jul 2, 2025

Thanks for the work but you don't need to open a new pull request when changes are requested. Just apply the changes to your already existing branch and the pull request will be automatically updated. Then mark the comments as resolved.

For now I'll go with this. But for future prs please don't do this please

Copy link

vercel bot commented Jul 2, 2025

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

Name Status Preview Comments Updated (UTC)
drawdb ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 4, 2025 9:39am

Copy link
Member

@1ilit 1ilit left a comment

Choose a reason for hiding this comment

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

Thanks for the PR.

Left some comments. Please also resolve the merge conflicts and make sure to format the files according to the defined prettier config

Please apply the changes on this branch

Also, out of curiosity how much of this is AI generated?

@kishansinghifs1 kishansinghifs1 requested a review from 1ilit July 3, 2025 06:20
@kishansinghifs1
Copy link
Contributor Author

Thanks for the PR.

Left some comments. Please also resolve the merge conflicts and make sure to format the files according to the defined prettier config

Please apply the changes on this branch

Also, out of curiosity how much of this is AI generated?

Almost 30-40%

@kishansinghifs1
Copy link
Contributor Author

@1ilit kindly review the pr.

Copy link
Member

@1ilit 1ilit left a comment

Choose a reason for hiding this comment

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

Great job! Left a few minor suggestions

@kishansinghifs1
Copy link
Contributor Author

Hey @1ilit,
Thanks a ton for your thorough review and helpful suggestions — really appreciate the effort you put in! 🙌
I’ve pushed the changes based on your feedback. Please take a look when you get a chance and let me know if anything else needs tweaking.
Thanks again! 😊

Copy link
Member

@1ilit 1ilit left a comment

Choose a reason for hiding this comment

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

LGTM!

Thank you

@1ilit 1ilit linked an issue Jul 4, 2025 that may be closed by this pull request
@1ilit 1ilit merged commit 47caa29 into drawdb-io:main Jul 4, 2025
4 checks passed
ewqazxc pushed a commit to ewqazxc/drawdb that referenced this pull request Jul 7, 2025
* feat: add support for PostgreSQL table inheritance in schema export

* fixed the suggested changes in the inheritance feature

* Update src/components/EditorSidePanel/TablesTab/TableField.jsx

Co-authored-by: 1ilit <1ilit@proton.me>

* fixed all the comments

* feat: finalize Postgres table inheritance support with fixes and formatting

---------

Co-authored-by: kishansinghifs1 <kishansingh956196@gmai.com>
Co-authored-by: 1ilit <1ilit@proton.me>
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.

[FEATURE] Add support for PostgreSQL "CREATE TABLE INHERITS"
2 participants