fixing tests and migration to the serialized deserialized JSONB

This commit is contained in:
Priec
2025-09-17 21:10:11 +02:00
parent 532977056d
commit 095645a209
2 changed files with 6 additions and 15 deletions

View File

@@ -201,6 +201,7 @@ async fn execute_table_definition(
// Indexes // Indexes
let mut stored_indexes = Vec::new(); let mut stored_indexes = Vec::new();
let mut indexes = Vec::new();
for idx in request.indexes.drain(..) { for idx in request.indexes.drain(..) {
let idx_name = idx.trim().to_string(); let idx_name = idx.trim().to_string();
validate_identifier_format(&idx_name, "Index name")?; validate_identifier_format(&idx_name, "Index name")?;
@@ -211,17 +212,7 @@ async fn execute_table_definition(
))); )));
} }
stored_indexes.push(idx_name); stored_indexes.push(idx_name.clone());
}
let mut indexes = Vec::new();
for idx in request.indexes.drain(..) {
let idx_name = idx.trim().to_string();
validate_identifier_format(&idx_name, "Index name")?;
if !sql_columns.iter().any(|c| c.starts_with(&format!("\"{}\"", idx_name))) {
return Err(Status::invalid_argument(format!("Index column '{}' not found", idx_name)));
}
indexes.push(idx_name); indexes.push(idx_name);
} }

View File

@@ -67,10 +67,10 @@ async fn table_definition(#[future] schema: (PgPool, String, i64)) -> (PgPool, S
// Define columns and indexes for the table // Define columns and indexes for the table
let columns = json!([ let columns = json!([
"\"name\" TEXT", { "name": "name", "field_type": "text" },
"\"age\" INTEGER", { "name": "age", "field_type": "integer" },
"\"email\" TEXT", { "name": "email", "field_type": "text" },
"\"is_active\" BOOLEAN" { "name": "is_active", "field_type": "boolean" }
]); ]);
let indexes = json!([]); let indexes = json!([]);