Skip to content

Commit

Permalink
you learn something new every day... a schema in pg can't start with …
Browse files Browse the repository at this point in the history
…a number.
  • Loading branch information
dallinbentley committed Feb 5, 2025
1 parent f437aea commit 2be7383
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions api/src/utils/stored_values/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
);
Expand Down

0 comments on commit 2be7383

Please sign in to comment.