Skip to content

Commit

Permalink
[backend] Fix on deleting a type representation deletes injector cont…
Browse files Browse the repository at this point in the history
…ract (#2203)
  • Loading branch information
Dimfacion committed Jan 13, 2025
1 parent e3da48d commit 290076d
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_54__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 290076d

Please sign in to comment.