public inbox for [email protected]
help / color / mirror / Atom feed[pgAdmin][RM7275] Error when creating table in ERD
2+ messages / 2 participants
[nested] [flat]
* [pgAdmin][RM7275] Error when creating table in ERD
@ 2022-03-30 12:44 Aditya Toshniwal <[email protected]>
2022-03-31 06:27 ` Re: [pgAdmin][RM7275] Error when creating table in ERD Akshay Joshi <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: Aditya Toshniwal @ 2022-03-30 12:44 UTC (permalink / raw)
To: pgadmin-hackers
Hi Hackers,
Attached is the patch for the fix.
Please review.
--
Thanks,
Aditya Toshniwal
pgAdmin Hacker | Software Architect | *edbpostgres.com*
<http://edbpostgres.com;
"Don't Complain about Heat, Plant a TREE"
Attachments:
[application/octet-stream] RM7275.patch (1.8K, 3-RM7275.patch)
download | inline diff:
diff --git a/web/pgadmin/tools/erd/static/js/erd_tool/ERDCore.js b/web/pgadmin/tools/erd/static/js/erd_tool/ERDCore.js
index 5048ffb3c..29f650eb9 100644
--- a/web/pgadmin/tools/erd/static/js/erd_tool/ERDCore.js
+++ b/web/pgadmin/tools/erd/static/js/erd_tool/ERDCore.js
@@ -267,11 +267,12 @@ export default class ERDCore {
});
}
- syncTableLinks(tableNode, oldTableData) {
+ syncColDrop(tableNode, oldTableData) {
let self = this;
+ if(!oldTableData) {
+ return;
+ }
let tableData = tableNode.getData();
- const tableNodesDict = this.getModel().getNodesDict();
-
/* Remove the links if column dropped or primary key removed */
_.differenceWith(oldTableData.columns, tableData.columns, function(existing, incoming) {
if(existing.attnum == incoming.attnum && existing.is_primary_key && !incoming.is_primary_key) {
@@ -287,7 +288,13 @@ export default class ERDCore {
}
tableNode.removePort(existPort);
});
+ }
+ syncFkRefNames(tableNode, oldTableData) {
+ if(!oldTableData) {
+ return;
+ }
+ let tableData = tableNode.getData();
/* Sync the name changes in references FK */
Object.values(tableNode.getPorts()).forEach((port)=>{
if(port.getSubtype() != 'one') {
@@ -312,9 +319,17 @@ export default class ERDCore {
});
});
});
+ }
+ syncTableLinks(tableNode, oldTableData) {
+ if(oldTableData) {
+ this.syncColDrop(tableNode, oldTableData);
+ this.syncFkRefNames(tableNode, oldTableData);
+ }
/* Sync the changed/removed/added foreign keys */
- tableData = tableNode.getData();
+ let tableData = tableNode.getData();
+ let tableNodesDict = this.getModel().getNodesDict();
+
const addLink = (theFk)=>{
if(!theFk) return;
let newData = {
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: [pgAdmin][RM7275] Error when creating table in ERD
2022-03-30 12:44 [pgAdmin][RM7275] Error when creating table in ERD Aditya Toshniwal <[email protected]>
@ 2022-03-31 06:27 ` Akshay Joshi <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Akshay Joshi @ 2022-03-31 06:27 UTC (permalink / raw)
To: Aditya Toshniwal <[email protected]>; +Cc: pgadmin-hackers
Thanks, the patch applied.
On Wed, Mar 30, 2022 at 6:15 PM Aditya Toshniwal <
[email protected]> wrote:
> Hi Hackers,
>
> Attached is the patch for the fix.
> Please review.
>
> --
> Thanks,
> Aditya Toshniwal
> pgAdmin Hacker | Software Architect | *edbpostgres.com*
> <http://edbpostgres.com;
> "Don't Complain about Heat, Plant a TREE"
>
--
*Thanks & Regards*
*Akshay Joshi*
*pgAdmin Hacker | Principal Software Architect*
*EDB Postgres <http://edbpostgres.com>*
*Mobile: +91 976-788-8246*
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2022-03-31 06:27 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-03-30 12:44 [pgAdmin][RM7275] Error when creating table in ERD Aditya Toshniwal <[email protected]>
2022-03-31 06:27 ` Akshay Joshi <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox