public static Relationship createRelationship(Column primaryColumn, Column foreignColumn) { List<Column> pcols = new ArrayList<>(); pcols.add(primaryColumn); List<Column> fcols = new ArrayList<>(); fcols.add(foreignColumn); return createRelationship(pcols, fcols); }
Table primaryTable = checkSameTable(primaryColumns); Table foreignTable = checkSameTable(foreignColumns); MutableRelationship relation = new MutableRelationship(primaryColumns, foreignColumns);
public void remove() { Table primaryTable = getPrimaryTable(); if (primaryTable instanceof MutableTable) { ((MutableTable) primaryTable).removeRelationship(this); } Table foreignTable = getForeignTable(); if (foreignTable instanceof MutableTable) { ((MutableTable) foreignTable).removeRelationship(this); } }
((MutableRelationship) relationship).remove();
public static Relationship createRelationship(Column primaryColumn, Column foreignColumn) { List<Column> pcols = new ArrayList<>(); pcols.add(primaryColumn); List<Column> fcols = new ArrayList<>(); fcols.add(foreignColumn); return createRelationship(pcols, fcols); }
public void remove() { Table primaryTable = getPrimaryTable(); if (primaryTable instanceof MutableTable) { ((MutableTable) primaryTable).removeRelationship(this); } Table foreignTable = getForeignTable(); if (foreignTable instanceof MutableTable) { ((MutableTable) foreignTable).removeRelationship(this); } }
Table primaryTable = checkSameTable(primaryColumns); Table foreignTable = checkSameTable(foreignColumns); MutableRelationship relation = new MutableRelationship(primaryColumns, foreignColumns);
.createRelationship(ct.getPkCols(), ct.getFkCols()));
.createRelationship(ct.getPkCols(), ct.getFkCols()));
table.addColumn(foreignKeyColumn); MutableRelationship.createRelationship(parentKeyColumn , foreignKeyColumn);
.addColumn(new MutableColumn("foreign_column", ColumnType.VARCHAR, relationshipsTable, 3, false)); MutableRelationship.createRelationship(tablesTable.getColumnByName("name"), columnsTable.getColumnByName("table")); MutableRelationship.createRelationship(tablesTable.getColumnByName("name"), relationshipsTable.getColumnByName("primary_table")); MutableRelationship.createRelationship(tablesTable.getColumnByName("name"), relationshipsTable.getColumnByName("foreign_table")); MutableRelationship.createRelationship(columnsTable.getColumnByName("name"), relationshipsTable.getColumnByName("primary_column")); MutableRelationship.createRelationship(columnsTable.getColumnByName("name"), relationshipsTable.getColumnByName("foreign_column"));
.addColumn(new MutableColumn("foreign_column", ColumnType.VARCHAR, relationshipsTable, 3, false)); MutableRelationship.createRelationship(tablesTable.getColumnByName("name"), columnsTable.getColumnByName("table")); MutableRelationship.createRelationship(tablesTable.getColumnByName("name"), relationshipsTable.getColumnByName("primary_table")); MutableRelationship.createRelationship(tablesTable.getColumnByName("name"), relationshipsTable.getColumnByName("foreign_table")); MutableRelationship.createRelationship(columnsTable.getColumnByName("name"), relationshipsTable.getColumnByName("primary_column")); MutableRelationship.createRelationship(columnsTable.getColumnByName("name"), relationshipsTable.getColumnByName("foreign_column"));