Skip to content

feat: add support for PostgreSQL table inheritance in schema export #493

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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

![Watch demo](

freecompress-Recording.2025-06-14.112023.mp4

)

Copy link

vercel bot commented Jun 14, 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.

Copy link

vercel bot commented Jun 14, 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 Jun 14, 2025 9:56am

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.

1 participant