Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependency io.hypersistence:hypersistence-utils-hibernate-63 to v3.8.2 #589

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
3fda8b6
[backend] Small fix on filters when filtering on an enum (#1728)
Dimfacion Oct 23, 2024
f4ae81f
[frontend/backend] Chaining injects logically (#1385)
Dimfacion Oct 23, 2024
00d051a
[backend/frontend] Improv team performance
RomuDeuxfois Oct 23, 2024
778a7ee
[frontend] Allow update inject without mandatory fields (#1600)
savacano28 Oct 23, 2024
7273c2c
[backend] Simulations never ends if no inject / disabled injects / de…
isselparra Oct 23, 2024
8768b3e
[backend/frontend] Prevent users from deleting SP logos (#1660)
Dimfacion Oct 23, 2024
8981a4e
[frontend] Small fix on adding a new parent using the tab
Dimfacion Oct 23, 2024
7f8a478
[backend] Assets are not well displayed
Dimfacion Oct 24, 2024
6798b30
[frontend] align UI buttons for injector contract
MarineLeM Oct 24, 2024
404d0be
[backend] Update an atomic testing is not working (#1737)
isselparra Oct 24, 2024
f178c65
[backend] Add validation for default score value
savacano28 Oct 24, 2024
d03b23a
[frontend] Setting edges to a bezier curve in timeline
Dimfacion Oct 24, 2024
5007932
Update dependency io.hypersistence:hypersistence-utils-hibernate-63 t…
renovate[bot] Jun 21, 2024
bb60c19
[backend] Remove hypersistence type to use native array type
RomuDeuxfois Jun 24, 2024
d51767a
Fix
RomuDeuxfois Oct 24, 2024
0a01de0
Fix
RomuDeuxfois Oct 24, 2024
4d66830
Re put the @Type annotation
RomuDeuxfois Oct 24, 2024
5278c78
Upgrade hypersistence
RomuDeuxfois Oct 24, 2024
b01ab17
Upgrade spring boot starter
RomuDeuxfois Oct 24, 2024
3952630
Upgrade spring boot starter
RomuDeuxfois Oct 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package io.openbas.migration;

import com.fasterxml.jackson.databind.ObjectMapper;
import io.openbas.database.model.InjectDependencyConditions;
import org.flywaydb.core.api.migration.BaseJavaMigration;
import org.flywaydb.core.api.migration.Context;
import org.springframework.stereotype.Component;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.List;

@Component
public class V3_46__Add_table_inject_dependencies extends BaseJavaMigration {

@Override
public void migrate(Context context) throws Exception {
ObjectMapper mapper = new ObjectMapper();
Statement select = context.getConnection().createStatement();
select.execute("""
CREATE TABLE injects_dependencies (
inject_parent_id VARCHAR(255) NOT NULL REFERENCES injects(inject_id) ON DELETE CASCADE,
inject_children_id VARCHAR(255) NOT NULL REFERENCES injects(inject_id) ON DELETE CASCADE,
dependency_condition JSONB,
dependency_created_at TIMESTAMP DEFAULT now(),
dependency_updated_at TIMESTAMP DEFAULT now(),
PRIMARY KEY(inject_parent_id, inject_children_id)
);
CREATE INDEX idx_injects_dependencies ON injects_dependencies(inject_children_id);
""");

// Migration datas
ResultSet results = select.executeQuery("SELECT * FROM injects WHERE inject_depends_from_another IS NOT NULL");
PreparedStatement statement = context.getConnection().prepareStatement(
"""
INSERT INTO injects_dependencies(inject_parent_id, inject_children_id, dependency_condition)
VALUES (?, ?, to_json(?::json))
"""
);
while (results.next()) {
String injectId = results.getString("inject_id");
String parentId = results.getString("inject_depends_from_another");
InjectDependencyConditions.InjectDependencyCondition injectDependencyCondition = new InjectDependencyConditions.InjectDependencyCondition();
injectDependencyCondition.setMode(InjectDependencyConditions.DependencyMode.and);
InjectDependencyConditions.Condition condition = new InjectDependencyConditions.Condition();
condition.setKey("Execution");
condition.setOperator(InjectDependencyConditions.DependencyOperator.eq);
condition.setValue(true);
injectDependencyCondition.setConditions(List.of(condition));
statement.setString(1, parentId);
statement.setString(2, injectId);
statement.setString(3, mapper.writeValueAsString(injectDependencyCondition));
statement.addBatch();
}
statement.executeBatch();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@
import java.util.List;

@RestController
@RequestMapping("/api/atomic-testings")
@RequestMapping(AtomicTestingApi.ATOMIC_TESTING_URI)
@PreAuthorize("isAdmin()")
@RequiredArgsConstructor
public class AtomicTestingApi extends RestBehavior {

public static final String ATOMIC_TESTING_URI = "/api/atomic-testings";

private final AtomicTestingService atomicTestingService;
private final InjectExpectationService injectExpectationService;

Expand Down
Loading