feat: full-text index on content
This commit is contained in:
parent
2d92f9c355
commit
7a9a6fc245
2 changed files with 32 additions and 0 deletions
|
@ -19,6 +19,7 @@ mod m20240703_000002_add_image_to_objects;
|
|||
mod m20240706_000001_add_error_to_jobs;
|
||||
mod m20240715_000001_add_quote_uri_to_objects;
|
||||
mod m20240715_000002_add_actors_fields_and_aliases;
|
||||
mod m20240811_000001_add_full_text_index;
|
||||
|
||||
pub struct Migrator;
|
||||
|
||||
|
@ -45,6 +46,7 @@ impl MigratorTrait for Migrator {
|
|||
Box::new(m20240706_000001_add_error_to_jobs::Migration),
|
||||
Box::new(m20240715_000001_add_quote_uri_to_objects::Migration),
|
||||
Box::new(m20240715_000002_add_actors_fields_and_aliases::Migration),
|
||||
Box::new(m20240811_000001_add_full_text_index::Migration),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
30
upub/migrations/src/m20240811_000001_add_full_text_index.rs
Normal file
30
upub/migrations/src/m20240811_000001_add_full_text_index.rs
Normal file
|
@ -0,0 +1,30 @@
|
|||
use sea_orm_migration::prelude::*;
|
||||
|
||||
use crate::m20240524_000001_create_actor_activity_object_tables::Objects;
|
||||
|
||||
#[derive(DeriveMigrationName)]
|
||||
pub struct Migration;
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl MigrationTrait for Migration {
|
||||
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||
manager
|
||||
.create_index(
|
||||
Index::create()
|
||||
.name("index-objects-content")
|
||||
.table(Objects::Table)
|
||||
.col(Objects::Audience)
|
||||
.full_text()
|
||||
.to_owned()
|
||||
)
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||
manager
|
||||
.drop_index(Index::drop().name("index-objects-content").table(Objects::Table).to_owned())
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue