-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rsc: Optimize blob eviction deletion (#1615)
* rsc: Optimize blob eviction deletion * cleanup
- Loading branch information
Showing
4 changed files
with
99 additions
and
84 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
53 changes: 53 additions & 0 deletions
53
rust/migration/src/m20240731_201632_create_job_blob_timestamp_index.rs
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,53 @@ | ||
use sea_orm_migration::prelude::*; | ||
|
||
#[derive(DeriveMigrationName)] | ||
pub struct Migration; | ||
|
||
#[async_trait::async_trait] | ||
impl MigrationTrait for Migration { | ||
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> { | ||
manager | ||
.get_connection() | ||
.execute_unprepared( | ||
" | ||
CREATE INDEX IF NOT EXISTS blob_updated_at_idx | ||
ON blob(updated_at) | ||
", | ||
) | ||
.await?; | ||
|
||
manager | ||
.get_connection() | ||
.execute_unprepared( | ||
" | ||
CREATE INDEX IF NOT EXISTS job_created_at_idx | ||
ON job(created_at) | ||
", | ||
) | ||
.await?; | ||
|
||
Ok(()) | ||
} | ||
|
||
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> { | ||
manager | ||
.get_connection() | ||
.execute_unprepared( | ||
" | ||
DROP INDEX IF EXISTS job_created_at_idx | ||
", | ||
) | ||
.await?; | ||
|
||
manager | ||
.get_connection() | ||
.execute_unprepared( | ||
" | ||
DROP INDEX IF EXISTS blob_updated_at_idx | ||
", | ||
) | ||
.await?; | ||
|
||
Ok(()) | ||
} | ||
} |
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