entry("uuid", "U2"),
entry("branchType", "BRANCH"),
entry("kee", "feature/foo"),
- entry("isMain", true),
entry("mergeBranchUuid", null),
entry("pullRequestBinary", null),
entry("createdAt", 1_000L),
entry("updatedAt", 1_000L));
+ assertThat(map.get("isMain")).isIn(true, 1L); // Oracle returns 1L instead of true
}
@Test
return executeLargeInputs(branchKeys, partition -> mapper(dbSession).selectByKeys(projectUuid, branchKeys));
}
+ /*
+ * Returns collection of branches that are in the same project as the component
+ */
public Collection<BranchDto> selectByComponent(DbSession dbSession, ComponentDto component) {
String projectUuid = component.getMainBranchProjectUuid();
if (projectUuid == null) {
protected void execute(Context context) throws SQLException {
MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select uuid, uuid = project_uuid from project_branches");
+ // we need to use case/when/then because Oracle doesn't accept simple solution uuid = project_uuid here
+ massUpdate.select("select uuid, case when uuid = project_uuid then 'true' else 'false' end from project_branches");
massUpdate.update("update project_branches set is_main = ? where uuid = ?");
massUpdate.execute((row, update) -> {
String uuid = row.getString(1);