@Test void getSqlSetDataType() { EntityType entityType = when(mock(EntityType.class).getId()).thenReturn("entity").getMock(); when(entityType.getId()).thenReturn("entityTypeId"); Attribute attr = when(mock(Attribute.class).getName()).thenReturn("attr").getMock(); when(attr.getIdentifier()).thenReturn("attrId"); when(attr.getDataType()).thenReturn(LONG); assertEquals( "ALTER TABLE \"entityTypeId#c34894ba\" ALTER COLUMN \"attr\" SET DATA TYPE bigint USING \"attr\"::bigint", PostgreSqlQueryGenerator.getSqlSetDataType(entityType, attr)); }
static String getSqlSetDataType(EntityType entityType, Attribute attr) { return "ALTER TABLE " + getTableName(entityType) + " ALTER COLUMN " + getColumnName(attr) + " SET DATA TYPE " + getPostgreSqlType(attr) + " USING " + getColumnName(attr) + "::" + getPostgreSqlType(attr); }
PostgreSqlQueryGenerator { static String getSqlSetDataType(EntityType entityType, Attribute attr) { return "ALTER TABLE " + getTableName(entityType) + " ALTER COLUMN " + getColumnName(attr) + " SET DATA TYPE " + getPostgreSqlType(attr) + " USING " + getColumnName(attr) + "::" + getPostgreSqlType(attr); } }
PostgreSqlQueryGenerator { static String getSqlSetDataType(EntityType entityType, Attribute attr) { return "ALTER TABLE " + getTableName(entityType) + " ALTER COLUMN " + getColumnName(attr) + " SET DATA TYPE " + getPostgreSqlType(attr) + " USING " + getColumnName(attr) + "::" + getPostgreSqlType(attr); } private  PostgreSqlQueryGenerator(); }
PostgreSqlQueryGenerator { static String getSqlSetDataType(EntityType entityType, Attribute attr) { return "ALTER TABLE " + getTableName(entityType) + " ALTER COLUMN " + getColumnName(attr) + " SET DATA TYPE " + getPostgreSqlType(attr) + " USING " + getColumnName(attr) + "::" + getPostgreSqlType(attr); } private  PostgreSqlQueryGenerator();  }
PostgreSqlQueryGenerator { static String getSqlSetDataType(EntityType entityType, Attribute attr) { return "ALTER TABLE " + getTableName(entityType) + " ALTER COLUMN " + getColumnName(attr) + " SET DATA TYPE " + getPostgreSqlType(attr) + " USING " + getColumnName(attr) + "::" + getPostgreSqlType(attr); } private  PostgreSqlQueryGenerator();   }