From 47caa29f78ce51a7e4937e68110bdf3b106ffa07 Mon Sep 17 00:00:00 2001 From: Kishan_Singh <147229665+kishansinghifs1@users.noreply.github.com> Date: Fri, 4 Jul 2025 16:27:20 +0530 Subject: [PATCH] Add support for PostgreSQL "CREATE TABLE INHERITS" (#524) * 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 Co-authored-by: 1ilit <1ilit@proton.me> --- .../EditorSidePanel/TablesTab/TableField.jsx | 19 ++- .../EditorSidePanel/TablesTab/TableInfo.jsx | 83 ++++++++-- src/data/schemas.js | 4 + src/i18n/locales/en.js | 2 + src/utils/exportSQL/postgres.js | 154 ++++++++++-------- src/utils/issues.js | 65 ++++---- 6 files changed, 208 insertions(+), 119 deletions(-) diff --git a/src/components/EditorSidePanel/TablesTab/TableField.jsx b/src/components/EditorSidePanel/TablesTab/TableField.jsx index 7c744f4..13369fe 100644 --- a/src/components/EditorSidePanel/TablesTab/TableField.jsx +++ b/src/components/EditorSidePanel/TablesTab/TableField.jsx @@ -8,7 +8,7 @@ import { dbToTypes } from "../../../data/datatypes"; import { DragHandle } from "../../SortableList/DragHandle"; import FieldDetails from "./FieldDetails"; -export default function TableField({ data, tid, index }) { +export default function TableField({ data, tid, index, inherited }) { const { updateField } = useDiagram(); const { types } = useTypes(); const { enums } = useEnums(); @@ -21,12 +21,15 @@ export default function TableField({ data, tid, index }) { return (
+
updateField(tid, data.id, { name: value })} onFocus={(e) => setEditField({ name: e.target.value })} onBlur={(e) => { @@ -51,13 +54,14 @@ export default function TableField({ data, tid, index }) { }} />
+
+ { - setTables((prev) => { - return prev.map((t) => + onChange={(newFields) => + setTables((prev) => + prev.map((t) => t.id === data.id ? { ...t, fields: newFields } : t, - ); - }); - }} + ), + ) + } afterChange={() => setSaveState(State.SAVING)} renderItem={(item, i) => ( - + )} /> + + {database === DB.POSTGRES && ( +
+
+ {t("inherits")}: +
+