@Test void getSqlDropForeignKey() { Attribute refIdAttr = when(mock(Attribute.class).getName()).thenReturn("refIdAttr").getMock(); when(refIdAttr.getIdentifier()).thenReturn("refIdAttrId"); EntityType refEntityType = when(mock(EntityType.class).getId()).thenReturn("refEntity").getMock(); when(refEntityType.getId()).thenReturn("refEntityId"); when(refEntityType.getIdAttribute()).thenReturn(refIdAttr); EntityType entityType = when(mock(EntityType.class).getId()).thenReturn("entity").getMock(); when(entityType.getId()).thenReturn("entityTypeId"); Attribute refAttr = when(mock(Attribute.class).getName()).thenReturn("attr").getMock(); when(refAttr.getIdentifier()).thenReturn("refAttrId"); when(refAttr.getDataType()).thenReturn(XREF); when(refAttr.getRefEntity()).thenReturn(refEntityType); String expectedSql = "ALTER TABLE \"entityTypeId#c34894ba\" DROP CONSTRAINT \"entityTypeId#c34894ba_attr_fkey\""; assertEquals(expectedSql, PostgreSqlQueryGenerator.getSqlDropForeignKey(entityType, refAttr)); }
static String getSqlDropForeignKey(EntityType entityType, Attribute attr) { return "ALTER TABLE " + getTableName(entityType) + " DROP CONSTRAINT " + getForeignKeyName(entityType, attr); }
PostgreSqlQueryGenerator { static String getSqlDropForeignKey(EntityType entityType, Attribute attr) { return "ALTER TABLE " + getTableName(entityType) + " DROP CONSTRAINT " + getForeignKeyName(entityType, attr); } }
PostgreSqlQueryGenerator { static String getSqlDropForeignKey(EntityType entityType, Attribute attr) { return "ALTER TABLE " + getTableName(entityType) + " DROP CONSTRAINT " + getForeignKeyName(entityType, attr); } private  PostgreSqlQueryGenerator(); }
PostgreSqlQueryGenerator { static String getSqlDropForeignKey(EntityType entityType, Attribute attr) { return "ALTER TABLE " + getTableName(entityType) + " DROP CONSTRAINT " + getForeignKeyName(entityType, attr); } private  PostgreSqlQueryGenerator();  }
PostgreSqlQueryGenerator { static String getSqlDropForeignKey(EntityType entityType, Attribute attr) { return "ALTER TABLE " + getTableName(entityType) + " DROP CONSTRAINT " + getForeignKeyName(entityType, attr); } private  PostgreSqlQueryGenerator();   }