From 2be738365652428b59bb59d24f68845bfd8fa132 Mon Sep 17 00:00:00 2001 From: dal Date: Wed, 5 Feb 2025 11:36:31 -0700 Subject: [PATCH] you learn something new every day... a schema in pg can't start with a number. --- api/src/utils/stored_values/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/src/utils/stored_values/mod.rs b/api/src/utils/stored_values/mod.rs index da2044e76..3bdbc2d57 100644 --- a/api/src/utils/stored_values/mod.rs +++ b/api/src/utils/stored_values/mod.rs @@ -41,12 +41,12 @@ pub async fn ensure_stored_values_schema(organization_id: &Uuid) -> Result<()> { // Create schema and table using raw SQL let schema_name = organization_id.to_string().replace("-", "_"); let create_schema_sql = format!( - "CREATE SCHEMA IF NOT EXISTS {}_values", + "CREATE SCHEMA IF NOT EXISTS values_{}", schema_name ); let create_table_sql = format!( - "CREATE TABLE IF NOT EXISTS {}_values.values_v1 ( + "CREATE TABLE IF NOT EXISTS values_{}.values_v1 ( value text NOT NULL, dataset_id uuid NOT NULL, column_name text NOT NULL, @@ -60,7 +60,7 @@ pub async fn ensure_stored_values_schema(organization_id: &Uuid) -> Result<()> { let create_index_sql = format!( "CREATE INDEX IF NOT EXISTS values_v1_embedding_idx - ON {}_values.values_v1 + ON values_{}.values_v1 USING ivfflat (embedding vector_cosine_ops)", schema_name );