@@ -392,7 +392,7 @@ export class SQLiteLayout {
392392 return { dot : parts . join ( "\n" ) , id : tableId , mappings, extraMappings } ;
393393 }
394394
395- private getDotForeignKey ( foreignKey : ForeignKey , tables : { [ name : string ] : DotTable } ) : string {
395+ private getDotForeignKey ( foreignKey : ForeignKey , tables : { [ name : string ] : DotTable } , displayActions : boolean ) : string {
396396 const fromTable = tables [ foreignKey . from . name ] ;
397397 const toTable = tables [ foreignKey . to . name ] ;
398398
@@ -412,11 +412,15 @@ export class SQLiteLayout {
412412
413413 const [ tailLabel , headLabel ] = foreignKeyTypeToTuple ( this . getForeignKeyType ( foreignKey ) ) ;
414414
415- // label= <<I>{ ${foreignKey.onUpdate}, ${foreignKey.onDelete}} </I>>
416- return `"${ foreignKey . from . name } ":${ fromColumnId } -> "${ foreignKey . to . name } ":${ toColumnId } [dir=forward, penwidth=4, color="#29235c", headlabel="${ headLabel } ", taillabel="${ tailLabel } " labeldistance=3.5, labelfontsize=52, arrowhead=open, arrowsize=2];` ;
415+ const label = displayActions ? `label= <<I>${ foreignKey . onUpdate } , ${ foreignKey . onDelete } </I>>, fontsize=42, ` : "" ;
416+ return `"${ foreignKey . from . name } ":${ fromColumnId } -> "${ foreignKey . to . name } ":${ toColumnId } [dir=forward, penwidth=4, color="#29235c", ${ label } headlabel="${ headLabel } ", taillabel="${ tailLabel } " labeldistance=3.5, labelfontsize=52, arrowhead=open, arrowsize=2];` ;
417417 }
418418
419- public getDot ( ) : string {
419+ public getDot (
420+ options ?: {
421+ displayActions ?: boolean ;
422+ }
423+ ) : string {
420424 this . dotIdCounter = 1 ;
421425 const parts : string [ ] = [ ] ;
422426 parts . push ( "digraph SQLiteLayout {" ) ;
@@ -430,7 +434,7 @@ export class SQLiteLayout {
430434 } , { } as { [ name : string ] : DotTable } ) ;
431435 parts . push ( ...Object . values ( tables ) . map ( ( table ) => table . dot ) ) ;
432436
433- const foreignKeys = this . getForeignKeys ( ) . map ( ( foreignKey ) => this . getDotForeignKey ( foreignKey , tables ) ) . filter ( ( fk ) => fk . length > 0 ) ;
437+ const foreignKeys = this . getForeignKeys ( ) . map ( ( foreignKey ) => this . getDotForeignKey ( foreignKey , tables , options ?. displayActions || false ) ) . filter ( ( fk ) => fk . length > 0 ) ;
434438 parts . push ( ...foreignKeys ) ;
435439 parts . push ( "}" ) ;
436440
0 commit comments