-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
feat: add support for PostgreSQL table inheritance in schema export #493
Conversation
|
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. |
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
1ilit
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking the time to work on this
| <div className="min-w-20 flex-1/3"> | ||
| <div | ||
| className="min-w-20 flex-1/3" | ||
| style={inherited ? { opacity: 0.6 } : {}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| style={inherited ? { opacity: 0.6 } : {}} |
| id={`scroll_table_${tid}_input_${index}`} | ||
| validateStatus={data.name.trim() === "" ? "error" : "default"} | ||
| validateStatus={ | ||
| data.name.trim() === "" && !inherited ? "error" : "default" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
names still shouldnt be empty and overriding an inherited fields should result in an error
| data.name.trim() === "" && !inherited ? "error" : "default" | |
| data.name.trim() === "" || inherited ? "error" : "default" |
| setRedoStack([]); | ||
| }} | ||
| readOnly={inherited} | ||
| style={inherited ? { backgroundColor: "#f5f5f5" } : {}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| style={inherited ? { backgroundColor: "#f5f5f5" } : {}} | ||
| /> | ||
| {inherited && ( | ||
| <span style={{ fontSize: 12, color: "#888" }}>Inherited</span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when an inherited field gets overridden an error should be reported, instead of showing this here please add an issue in issues.js
|
|
||
| return ( | ||
| <div> | ||
| {database === DB.POSTGRES && ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move this below the tablefield list above comments
the table info should start with the most characteristic attributes such as name and columns
| .map((t) => ({ label: t.name, value: t.name }))} | ||
| onChange={(value) => updateTable(data.id, { inherits: value })} | ||
| placeholder="Select parent tables" | ||
| style={{ width: "100%" }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tailwind please
| <div> | ||
| {database === DB.POSTGRES && ( | ||
| <div className="mb-2"> | ||
| <div className="text-md font-semibold break-keep">Inherits:</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use translation please
| <div className="text-md font-semibold break-keep">Inherits:</div> | |
| <div className="text-md font-semibold break-keep">{t('inherits')}:</div> |
| ) | ||
| .join("\n"); | ||
|
|
||
| return `CREATE TABLE "${table.name}" (\n${fieldDefinitions}${primaryKeyClause}${inheritsClause};\n${commentStatements}\n${indexStatements}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.


Summary
This PR adds full support for PostgreSQL table inheritance in the schema export generator (#472).
What's Included
INHERITSclause inCREATE TABLEstatements.PRIMARY KEY,UNIQUE,NOT NULLDEFAULT,CHECK, andARRAYmodifiers.Implementation Notes
table.inheritsarray to determine parent table(s).inheritedFieldNamesfrom parent tables to avoid duplication.PRIMARY KEYgeneration to apply only to non-inherited fields in child tables.🖥️ Screen Recording
