Skip to content

Commit 6a8b3c7

Browse files
chore: add back advisory_vuln index
1 parent 91cf5ce commit 6a8b3c7

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

migration/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ mod m0000060_perf_adv_vuln3;
1313
mod m0000070_perf_adv_vuln4;
1414
mod m0000080_get_purl_refactor;
1515
mod m0000090_release_perf;
16+
mod m0000100_perf_adv_vuln5;
1617
mod m0000970_alter_importer_add_heartbeat;
1718

1819
pub struct Migrator;
@@ -31,6 +32,7 @@ impl MigratorTrait for Migrator {
3132
Box::new(m0000070_perf_adv_vuln4::Migration),
3233
Box::new(m0000080_get_purl_refactor::Migration),
3334
Box::new(m0000090_release_perf::Migration),
35+
Box::new(m0000100_perf_adv_vuln5::Migration),
3436
]
3537
}
3638
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
use sea_orm_migration::prelude::*;
2+
3+
#[derive(DeriveMigrationName)]
4+
pub struct Migration;
5+
6+
#[async_trait::async_trait]
7+
#[allow(deprecated)]
8+
impl MigrationTrait for Migration {
9+
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
10+
manager
11+
.get_connection()
12+
.execute_unprepared(
13+
"
14+
DROP INDEX IF EXISTS advisory_vulnerability_vulnerability_id_gist;
15+
CREATE INDEX advisory_vulnerability_vulnerability_id_gist ON advisory_vulnerability USING GIST (vulnerability_id gist_trgm_ops);
16+
")
17+
.await
18+
.map(|_| ())?;
19+
20+
Ok(())
21+
}
22+
23+
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
24+
manager
25+
.get_connection()
26+
.execute_unprepared(
27+
"
28+
DROP INDEX IF EXISTS advisory_vulnerability_vulnerability_id_gist;
29+
",
30+
)
31+
.await
32+
.map(|_| ())?;
33+
34+
Ok(())
35+
}
36+
}
37+
38+
#[allow(clippy::enum_variant_names)]
39+
#[derive(DeriveIden)]
40+
#[allow(dead_code)]
41+
pub enum Indexes {
42+
AdvisoryVulnerabilityVulnerabilityIdGistIdx,
43+
}
44+
45+
#[derive(DeriveIden)]
46+
#[allow(dead_code)]
47+
pub enum AdvisoryVulnerability {
48+
Table,
49+
VulnerabilityId,
50+
}

0 commit comments

Comments
 (0)