feat(db): 添加 pgvector 扩展迁移 — 知识库向量检索基础
Phase 3 Task 20: CREATE EXTENSION IF NOT EXISTS vector
This commit is contained in:
@@ -118,6 +118,7 @@ mod m20260505_000115_family_member_health_proxy;
|
|||||||
mod m20260505_000116_seed_missing_health_menus;
|
mod m20260505_000116_seed_missing_health_menus;
|
||||||
mod m20260505_000117_create_ai_tenant_configs;
|
mod m20260505_000117_create_ai_tenant_configs;
|
||||||
mod m20260505_000118_create_ai_analysis_queue;
|
mod m20260505_000118_create_ai_analysis_queue;
|
||||||
|
mod m20260505_000119_enable_pgvector;
|
||||||
|
|
||||||
pub struct Migrator;
|
pub struct Migrator;
|
||||||
|
|
||||||
@@ -243,6 +244,7 @@ impl MigratorTrait for Migrator {
|
|||||||
Box::new(m20260505_000116_seed_missing_health_menus::Migration),
|
Box::new(m20260505_000116_seed_missing_health_menus::Migration),
|
||||||
Box::new(m20260505_000117_create_ai_tenant_configs::Migration),
|
Box::new(m20260505_000117_create_ai_tenant_configs::Migration),
|
||||||
Box::new(m20260505_000118_create_ai_analysis_queue::Migration),
|
Box::new(m20260505_000118_create_ai_analysis_queue::Migration),
|
||||||
|
Box::new(m20260505_000119_enable_pgvector::Migration),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
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(())
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user