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

[backend] Add index for expectations #1669

Merged
merged 2 commits into from
Oct 17, 2024
Merged
Changes from all commits
Commits
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,23 @@
package io.openbas.migration;

import org.flywaydb.core.api.migration.BaseJavaMigration;
import org.flywaydb.core.api.migration.Context;
import org.springframework.stereotype.Component;

import java.sql.Connection;
import java.sql.Statement;

@Component
public class V3_45__Add_indexes_scenario_exercise_latency extends BaseJavaMigration {
@Override
public void migrate(Context context) throws Exception {
Connection connection = context.getConnection();
Statement select = connection.createStatement();
select.execute("CREATE INDEX IF NOT EXISTS idx_inject_expectation_inject_id ON injects_expectations(inject_id);");
select.execute("CREATE INDEX IF NOT EXISTS idx_inject_expectation_team_id ON injects_expectations(team_id);");
select.execute("CREATE INDEX IF NOT EXISTS idx_inject_expectation_user_id ON injects_expectations(user_id);");
select.execute("CREATE INDEX IF NOT EXISTS idx_inject_expectation_asset_group_id ON injects_expectations(asset_group_id);");
select.execute("CREATE INDEX IF NOT EXISTS idx_inject_expectation_asset_id ON injects_expectations(asset_id);");
select.execute("CREATE INDEX IF NOT EXISTS idx_inject_expectation_exercise_id ON injects_expectations(exercise_id);");
}
}