-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[backend|frontend]Add the ability to customize the expiration time fo…
…r expectations
- Loading branch information
Showing
11 changed files
with
271 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...pi/src/main/java/io/openbas/migration/V3_40__Add_column_expiration_time_expectations.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package io.openbas.migration; | ||
|
||
import org.flywaydb.core.api.migration.BaseJavaMigration; | ||
import org.flywaydb.core.api.migration.Context; | ||
|
||
import java.sql.Connection; | ||
import java.sql.Statement; | ||
|
||
public class V3_40__Add_column_expiration_time_expectations extends BaseJavaMigration { | ||
|
||
@Override | ||
public void migrate(Context context) throws Exception { | ||
Statement select = context.getConnection().createStatement(); | ||
Connection connection = context.getConnection(); | ||
Statement statement = connection.createStatement(); | ||
long technicalMinutesExpirationTime = 60L; | ||
long manualMinutesExpirationTime = 360L; | ||
|
||
select.execute("ALTER TABLE injects_expectations ADD inject_expiration_time bigint;"); | ||
select.execute( | ||
"UPDATE injects_expectations SET inject_expiration_time = " + technicalMinutesExpirationTime + " " | ||
+ "WHERE inject_expectation_type = 'DETECTION' OR inject_expectation_type = 'PREVENTION';"); | ||
|
||
select.execute( | ||
"UPDATE injects_expectations SET inject_expiration_time = " + manualMinutesExpirationTime + " " | ||
+ "WHERE inject_expectation_type = 'MANUAL' OR inject_expectation_type = 'CHALLENGE' " | ||
+ "OR inject_expectation_type = 'ARTICLE' OR inject_expectation_type = 'DOCUMENT' OR inject_expectation_type = 'TEXT';"); | ||
|
||
select.execute( | ||
"ALTER TABLE injects_expectations ALTER COLUMN inject_expiration_time SET NOT NULL;"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.