Files
hms/crates/erp-server/migration/src/m20260505_000119_enable_pgvector.rs
iven 2d2e1e191e
Some checks failed
CI / rust-check (push) Has been cancelled
CI / rust-test (push) Has been cancelled
CI / frontend-build (push) Has been cancelled
CI / security-audit (push) Has been cancelled
feat(db): 添加 pgvector 扩展迁移 — 知识库向量检索基础
Phase 3 Task 20: CREATE EXTENSION IF NOT EXISTS vector
2026-05-05 15:52:12 +08:00

25 lines
684 B
Rust

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> {
// 启用 pgvector 扩展(知识库向量检索需要)
manager
.get_connection()
.execute_unprepared("CREATE EXTENSION IF NOT EXISTS vector")
.await?;
Ok(())
}
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.get_connection()
.execute_unprepared("DROP EXTENSION IF EXISTS vector")
.await?;
Ok(())
}
}