Skip to content

Commit

Permalink
[backend] Fix on deleted injector contract (#2203)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimfacion authored Jan 14, 2025
1 parent df8ed7b commit 51f58ec
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package io.openbas.migration;

import java.sql.Connection;
import java.sql.Statement;
import org.flywaydb.core.api.migration.BaseJavaMigration;
import org.flywaydb.core.api.migration.Context;
import org.springframework.stereotype.Component;

@Component
public class V3_60__Alter_xls_mapper_table extends BaseJavaMigration {

@Override
public void migrate(Context context) throws Exception {
Connection connection = context.getConnection();
Statement statement = connection.createStatement();

statement.execute(
"ALTER TABLE inject_importers alter column importer_mapper_id drop not null;");
statement.execute(
"ALTER TABLE inject_importers alter column importer_injector_contract_id drop not null;");
statement.execute(
"ALTER TABLE rule_attributes alter column attribute_inject_importer_id drop not null;");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class InjectImporter implements Base {
@NotBlank
private String importTypeValue;

@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true)
@OneToOne
@JoinColumn(name = "importer_injector_contract_id")
@JsonProperty("inject_importer_injector_contract")
@JsonSerialize(using = MonoIdDeserializer.class)
Expand Down

0 comments on commit 51f58ec

Please sign in to comment.