SCRIPTS only scripts reference to a linked table from this commit
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
// src/table_script/handlers/post_table_script.rs
|
||||
// TODO MAKE THE SCRIPTS PUSH ONLY TO THE EMPTY FILES
|
||||
|
||||
use tonic::Status;
|
||||
use sqlx::{PgPool, Error as SqlxError};
|
||||
@@ -10,7 +11,6 @@ use crate::table_script::handlers::dependency_analyzer::DependencyAnalyzer;
|
||||
|
||||
const SYSTEM_COLUMNS: &[&str] = &["id", "deleted", "created_at"];
|
||||
|
||||
// TODO MAKE THE SCRIPTS PUSH ONLY TO THE EMPTY FILES
|
||||
/// Validates the target column and ensures it is not a system column.
|
||||
/// Returns the column type if valid.
|
||||
fn validate_target_column(
|
||||
@@ -159,7 +159,7 @@ fn generate_warnings(dependencies: &[crate::table_script::handlers::dependency_a
|
||||
|
||||
if sql_deps_count > 0 {
|
||||
warnings.push(format!(
|
||||
"Warning: Script contains {} SQL quer{}, ensure they are read-only and reference valid tables.",
|
||||
"Warning: Script contains {} raw SQL quer{}, ensure they are read-only and reference valid tables.",
|
||||
sql_deps_count,
|
||||
if sql_deps_count == 1 { "y" } else { "ies" }
|
||||
));
|
||||
@@ -173,5 +173,22 @@ fn generate_warnings(dependencies: &[crate::table_script::handlers::dependency_a
|
||||
));
|
||||
}
|
||||
|
||||
// Count structured access dependencies
|
||||
let structured_deps_count = dependencies.iter()
|
||||
.filter(|d| matches!(
|
||||
d.dependency_type,
|
||||
crate::table_script::handlers::dependency_analyzer::DependencyType::ColumnAccess { .. } |
|
||||
crate::table_script::handlers::dependency_analyzer::DependencyType::IndexedAccess { .. }
|
||||
))
|
||||
.count();
|
||||
|
||||
if structured_deps_count > 0 {
|
||||
warnings.push(format!(
|
||||
"Info: Script uses {} linked table{} via steel_get_column functions.",
|
||||
structured_deps_count,
|
||||
if structured_deps_count == 1 { "" } else { "s" }
|
||||
));
|
||||
}
|
||||
|
||||
warnings.join(" ")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user