34 lines
1.0 KiB
Rust
34 lines
1.0 KiB
Rust
use loco_rs::schema::*;
|
|
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> {
|
|
create_table(
|
|
manager,
|
|
"ai_chunks",
|
|
&[
|
|
("id", ColType::PkAuto),
|
|
("source_slug", ColType::String),
|
|
("source_title", ColType::StringNull),
|
|
("source_path", ColType::StringNull),
|
|
("source_type", ColType::String),
|
|
("chunk_index", ColType::Integer),
|
|
("content", ColType::Text),
|
|
("content_preview", ColType::StringNull),
|
|
("embedding", ColType::JsonBinaryNull),
|
|
("word_count", ColType::IntegerNull),
|
|
],
|
|
&[],
|
|
)
|
|
.await
|
|
}
|
|
|
|
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
|
drop_table(manager, "ai_chunks").await
|
|
}
|
|
}
|