File tree 7 files changed +29
-17
lines changed
EditorSidePanel/RelationshipsTab
7 files changed +29
-17
lines changed Original file line number Diff line number Diff line change @@ -431,9 +431,9 @@ export default function Canvas() {
431
431
cardinality : Cardinality . ONE_TO_ONE ,
432
432
updateConstraint : Constraint . NONE ,
433
433
deleteConstraint : Constraint . NONE ,
434
- name : `${ tables [ linkingLine . startTableId ] . name } _${
434
+ name : `fk_ ${ tables [ linkingLine . startTableId ] . name } _${
435
435
tables [ linkingLine . startTableId ] . fields [ linkingLine . startFieldId ] . name
436
- } _fk `,
436
+ } _ ${ tables [ hoveredTable . tableId ] . name } `,
437
437
id : relationships . length ,
438
438
} ;
439
439
delete newRelationship . startX ;
Original file line number Diff line number Diff line change @@ -61,9 +61,9 @@ export default function RelationshipInfo({ data }) {
61
61
idx === data . id
62
62
? {
63
63
...e ,
64
- name : `${ tables [ e . startTableId ] . name } _${
65
- tables [ e . startTableId ] . fields [ e . startFieldId ] . name
66
- } _fk `,
64
+ name : `fk_ ${ tables [ e . endTableId ] . name } _${
65
+ tables [ e . endTableId ] . fields [ e . endFieldId ] . name
66
+ } _ ${ tables [ e . startTableId ] . name } `,
67
67
startTableId : e . endTableId ,
68
68
startFieldId : e . endFieldId ,
69
69
endTableId : e . startTableId ,
Original file line number Diff line number Diff line change @@ -126,7 +126,8 @@ export function fromMariaDB(ast, diagramDb = DB.GENERIC) {
126
126
) ;
127
127
if ( startFieldId === - 1 ) return ;
128
128
129
- relationship . name = startTable + "_" + startField + "_fk" ;
129
+ relationship . name =
130
+ "fk_" + startTable + "_" + startField + "_" + endTable ;
130
131
relationship . startTableId = startTableId ;
131
132
relationship . endTableId = endTableId ;
132
133
relationship . endFieldId = endFieldId ;
@@ -187,7 +188,8 @@ export function fromMariaDB(ast, diagramDb = DB.GENERIC) {
187
188
e . expr . forEach ( ( expr ) => {
188
189
if (
189
190
expr . action === "add" &&
190
- expr . create_definitions . constraint_type . toLowerCase ( ) === "foreign key"
191
+ expr . create_definitions . constraint_type . toLowerCase ( ) ===
192
+ "foreign key"
191
193
) {
192
194
const relationship = { } ;
193
195
const startTable = e . table [ 0 ] . table ;
@@ -230,7 +232,8 @@ export function fromMariaDB(ast, diagramDb = DB.GENERIC) {
230
232
) ;
231
233
if ( startFieldId === - 1 ) return ;
232
234
233
- relationship . name = startTable + "_" + startField + "_fk" ;
235
+ relationship . name =
236
+ "fk_" + startTable + "_" + startField + "_" + endTable ;
234
237
relationship . startTableId = startTableId ;
235
238
relationship . startFieldId = startFieldId ;
236
239
relationship . endTableId = endTableId ;
Original file line number Diff line number Diff line change @@ -138,7 +138,8 @@ export function fromMSSQL(ast, diagramDb = DB.GENERIC) {
138
138
) ;
139
139
if ( startFieldId === - 1 ) return ;
140
140
141
- relationship . name = startTable + "_" + startField + "_fk" ;
141
+ relationship . name =
142
+ "fk_" + startTable + "_" + startField + "_" + endTable ;
142
143
relationship . startTableId = startTableId ;
143
144
relationship . endTableId = endTableId ;
144
145
relationship . endFieldId = endFieldId ;
@@ -243,7 +244,8 @@ export function fromMSSQL(ast, diagramDb = DB.GENERIC) {
243
244
) ;
244
245
if ( startFieldId === - 1 ) return ;
245
246
246
- relationship . name = startTable + "_" + startField + "_fk" ;
247
+ relationship . name =
248
+ "fk_" + startTable + "_" + startField + "_" + endTable ;
247
249
relationship . startTableId = startTableId ;
248
250
relationship . startFieldId = startFieldId ;
249
251
relationship . endTableId = endTableId ;
Original file line number Diff line number Diff line change @@ -126,7 +126,8 @@ export function fromMySQL(ast, diagramDb = DB.GENERIC) {
126
126
) ;
127
127
if ( startFieldId === - 1 ) return ;
128
128
129
- relationship . name = startTable + "_" + startField + "_fk" ;
129
+ relationship . name =
130
+ "fk_" + startTable + "_" + startField + "_" + endTable ;
130
131
relationship . startTableId = startTableId ;
131
132
relationship . endTableId = endTableId ;
132
133
relationship . endFieldId = endFieldId ;
@@ -187,7 +188,8 @@ export function fromMySQL(ast, diagramDb = DB.GENERIC) {
187
188
e . expr . forEach ( ( expr ) => {
188
189
if (
189
190
expr . action === "add" &&
190
- expr . create_definitions . constraint_type . toLowerCase ( ) === "foreign key"
191
+ expr . create_definitions . constraint_type . toLowerCase ( ) ===
192
+ "foreign key"
191
193
) {
192
194
const relationship = { } ;
193
195
const startTable = e . table [ 0 ] . table ;
@@ -230,7 +232,8 @@ export function fromMySQL(ast, diagramDb = DB.GENERIC) {
230
232
) ;
231
233
if ( startFieldId === - 1 ) return ;
232
234
233
- relationship . name = startTable + "_" + startField + "_fk" ;
235
+ relationship . name =
236
+ "fk_" + startTable + "_" + startField + "_" + endTable ;
234
237
relationship . startTableId = startTableId ;
235
238
relationship . startFieldId = startFieldId ;
236
239
relationship . endTableId = endTableId ;
Original file line number Diff line number Diff line change @@ -129,7 +129,8 @@ export function fromPostgres(ast, diagramDb = DB.GENERIC) {
129
129
) ;
130
130
if ( startFieldId === - 1 ) return ;
131
131
132
- relationship . name = startTable + "_" + startField + "_fk" ;
132
+ relationship . name =
133
+ "fk_" + startTable + "_" + startField + "_" + endTable ;
133
134
relationship . startTableId = startTableId ;
134
135
relationship . endTableId = endTableId ;
135
136
relationship . endFieldId = endFieldId ;
@@ -199,7 +200,8 @@ export function fromPostgres(ast, diagramDb = DB.GENERIC) {
199
200
) ;
200
201
if ( startFieldId === - 1 ) return ;
201
202
202
- relationship . name = startTable + "_" + startField + "_fk" ;
203
+ relationship . name =
204
+ "fk_" + startTable + "_" + startField + "_" + endTable ;
203
205
relationship . startTableId = startTableId ;
204
206
relationship . startFieldId = startFieldId ;
205
207
relationship . endTableId = endTableId ;
@@ -326,7 +328,8 @@ export function fromPostgres(ast, diagramDb = DB.GENERIC) {
326
328
) ;
327
329
if ( startFieldId === - 1 ) return ;
328
330
329
- relationship . name = startTable + "_" + startField + "_fk" ;
331
+ relationship . name =
332
+ "fk_" + startTable + "_" + startField + "_" + endTable ;
330
333
relationship . startTableId = startTableId ;
331
334
relationship . startFieldId = startFieldId ;
332
335
relationship . endTableId = endTableId ;
Original file line number Diff line number Diff line change @@ -62,7 +62,8 @@ export function fromSQLite(ast, diagramDb = DB.GENERIC) {
62
62
) ;
63
63
if ( startFieldId === - 1 ) return ;
64
64
65
- relationship . name = startTable . name + "_" + startFieldName + "_fk" ;
65
+ relationship . name =
66
+ "fk_" + startTable . name + "_" + startFieldName + "_" + endTableName ;
66
67
relationship . startTableId = startTable . id ;
67
68
relationship . endTableId = endTableId ;
68
69
relationship . endFieldId = endFieldId ;
You can’t perform that action at this time.
0 commit comments