(db: &DbConn)
| 637 | |
| 638 | #[cfg(feature = "postgres-vector")] |
| 639 | pub async fn create_embedding_table(db: &DbConn) -> Result<ExecResult, DbErr> { |
| 640 | db.execute(sea_orm::Statement::from_string( |
| 641 | db.get_database_backend(), |
| 642 | "CREATE EXTENSION IF NOT EXISTS vector", |
| 643 | )) |
| 644 | .await?; |
| 645 | |
| 646 | let create_table_stmt = sea_query::Table::create() |
| 647 | .table(embedding::Entity.table_ref()) |
| 648 | .col( |
| 649 | ColumnDef::new(embedding::Column::Id) |
| 650 | .integer() |
| 651 | .not_null() |
| 652 | .primary_key(), |
| 653 | ) |
| 654 | .col( |
| 655 | ColumnDef::new(embedding::Column::Embedding) |
| 656 | .vector(None) |
| 657 | .not_null(), |
| 658 | ) |
| 659 | .to_owned(); |
| 660 | |
| 661 | create_table(db, &create_table_stmt, Embedding).await |
| 662 | } |
| 663 | |
| 664 | pub async fn create_binary_table(db: &DbConn) -> Result<ExecResult, DbErr> { |
| 665 | let create_table_stmt = sea_query::Table::create() |
no test coverage detected