MCPcopy Create free account
hub / github.com/SeaQL/sea-orm / create_embedding_table

Function create_embedding_table

tests/common/features/schema.rs:639–662  ·  view source on GitHub ↗
(db: &DbConn)

Source from the content-addressed store, hash-verified

637
638#[cfg(feature = "postgres-vector")]
639pub 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
664pub async fn create_binary_table(db: &DbConn) -> Result<ExecResult, DbErr> {
665 let create_table_stmt = sea_query::Table::create()

Callers 1

create_tablesFunction · 0.85

Calls 6

table_refMethod · 0.80
createFunction · 0.50
newFunction · 0.50
create_tableFunction · 0.50
executeMethod · 0.45
get_database_backendMethod · 0.45

Tested by

no test coverage detected