fix: published to addressing index for faster tls
This commit is contained in:
parent
2ac0ca8a38
commit
c68adc7030
2 changed files with 84 additions and 0 deletions
|
@ -0,0 +1,82 @@
|
||||||
|
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
|
||||||
|
.drop_index(Index::drop().name("addressing-actor-index").to_owned())
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
manager
|
||||||
|
.create_index(
|
||||||
|
Index::create()
|
||||||
|
.name("addressing-actor-index")
|
||||||
|
.table(Addressing::Table)
|
||||||
|
.col(Addressing::Actor)
|
||||||
|
.col(Addressing::Published)
|
||||||
|
.to_owned()
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
manager
|
||||||
|
.drop_index(Index::drop().name("addressing-server-index").to_owned())
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
manager
|
||||||
|
.create_index(
|
||||||
|
Index::create()
|
||||||
|
.name("addressing-server-index")
|
||||||
|
.table(Addressing::Table)
|
||||||
|
.col(Addressing::Server)
|
||||||
|
.col(Addressing::Published)
|
||||||
|
.to_owned()
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||||
|
manager
|
||||||
|
.drop_index(Index::drop().name("addressing-actor-index").to_owned())
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
manager
|
||||||
|
.create_index(
|
||||||
|
Index::create()
|
||||||
|
.name("addressing-actor-index")
|
||||||
|
.table(Addressing::Table)
|
||||||
|
.col(Addressing::Actor)
|
||||||
|
.to_owned()
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
manager
|
||||||
|
.drop_index(Index::drop().name("addressing-server-index").to_owned())
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
manager
|
||||||
|
.create_index(
|
||||||
|
Index::create()
|
||||||
|
.name("addressing-server-index")
|
||||||
|
.table(Addressing::Table)
|
||||||
|
.col(Addressing::Server)
|
||||||
|
.to_owned()
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(DeriveIden)]
|
||||||
|
enum Addressing {
|
||||||
|
Table,
|
||||||
|
Actor,
|
||||||
|
Server,
|
||||||
|
Published,
|
||||||
|
}
|
|
@ -15,6 +15,7 @@ mod m20240424_000001_add_sensitive_field;
|
||||||
mod m20240429_000001_add_relays_table;
|
mod m20240429_000001_add_relays_table;
|
||||||
mod m20240502_000001_add_object_updated;
|
mod m20240502_000001_add_object_updated;
|
||||||
mod m20240512_000001_add_url_to_objects;
|
mod m20240512_000001_add_url_to_objects;
|
||||||
|
mod m20240520_000001_add_published_to_addressing_actor_index;
|
||||||
|
|
||||||
pub struct Migrator;
|
pub struct Migrator;
|
||||||
|
|
||||||
|
@ -37,6 +38,7 @@ impl MigratorTrait for Migrator {
|
||||||
Box::new(m20240429_000001_add_relays_table::Migration),
|
Box::new(m20240429_000001_add_relays_table::Migration),
|
||||||
Box::new(m20240502_000001_add_object_updated::Migration),
|
Box::new(m20240502_000001_add_object_updated::Migration),
|
||||||
Box::new(m20240512_000001_add_url_to_objects::Migration),
|
Box::new(m20240512_000001_add_url_to_objects::Migration),
|
||||||
|
Box::new(m20240520_000001_add_published_to_addressing_actor_index::Migration),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue