use sea_orm_migration::prelude::*;
#[derive(DeriveMigrationName)]
pub struct Migration;
const UP: &str = include_str!("sql/0005_search.sql");
#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager.get_connection().execute_unprepared(UP).await?;
Ok(())
}
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.get_connection()
.execute_unprepared(
r#"
DROP FUNCTION IF EXISTS public.search_content(text, int, int, boolean, text, regconfig, boolean);
DROP INDEX IF EXISTS public.videos_title_trgm_idx;
DROP INDEX IF EXISTS public.playlists_title_trgm_idx;
"#,
)
.await?;
Ok(())
}
}