From 8a80e8b743722b996516f18a97c5f1e672041370 Mon Sep 17 00:00:00 2001 From: Nikita Sivukhin Date: Mon, 27 Oct 2025 13:18:18 +0400 Subject: [PATCH] rename custom modules to index_method like in postgresql --- cli/app.rs | 8 ++++---- core/incremental/cursor.rs | 2 +- core/lib.rs | 20 ++++++++++---------- core/translate/index.rs | 6 ++++-- 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/cli/app.rs b/cli/app.rs index 52423a4d3..d23e25771 100644 --- a/cli/app.rs +++ b/cli/app.rs @@ -78,8 +78,8 @@ pub struct Opts { pub mcp: bool, #[clap(long, help = "Enable experimental encryption feature")] pub experimental_encryption: bool, - #[clap(long, help = "Enable experimental custom modules feature")] - pub experimental_custom_modules: bool, + #[clap(long, help = "Enable experimental index method feature")] + pub experimental_index_method: bool, } const PROMPT: &str = "turso> "; @@ -194,7 +194,7 @@ impl Limbo { opts.experimental_views, opts.experimental_strict, opts.experimental_encryption, - opts.experimental_custom_modules, + opts.experimental_index_method, )? } else { let flags = if opts.readonly { @@ -212,7 +212,7 @@ impl Limbo { .with_views(opts.experimental_views) .with_strict(opts.experimental_strict) .with_encryption(opts.experimental_encryption) - .with_custom_modules(opts.experimental_custom_modules) + .with_index_method(opts.experimental_index_method) .turso_cli(), None, )?; diff --git a/core/incremental/cursor.rs b/core/incremental/cursor.rs index cd7af669b..0afab4d7a 100644 --- a/core/incremental/cursor.rs +++ b/core/incremental/cursor.rs @@ -316,7 +316,7 @@ mod tests { enable_strict: false, enable_load_extension: false, enable_encryption: false, - enable_custom_modules: false, + enable_index_method: false, }, None, )?; diff --git a/core/lib.rs b/core/lib.rs index 99d79113c..3a6974c93 100644 --- a/core/lib.rs +++ b/core/lib.rs @@ -113,7 +113,7 @@ pub struct DatabaseOpts { pub enable_views: bool, pub enable_strict: bool, pub enable_encryption: bool, - pub enable_custom_modules: bool, + pub enable_index_method: bool, enable_load_extension: bool, } @@ -125,7 +125,7 @@ impl Default for DatabaseOpts { enable_views: false, enable_strict: false, enable_encryption: false, - enable_custom_modules: false, + enable_index_method: false, enable_load_extension: false, } } @@ -167,8 +167,8 @@ impl DatabaseOpts { self } - pub fn with_custom_modules(mut self, enable: bool) -> Self { - self.enable_custom_modules = enable; + pub fn with_index_method(mut self, enable: bool) -> Self { + self.enable_index_method = enable; self } } @@ -877,8 +877,8 @@ impl Database { self.opts.enable_views } - pub fn experimental_custom_modules_enabled(&self) -> bool { - self.opts.enable_custom_modules + pub fn experimental_index_method_enabled(&self) -> bool { + self.opts.enable_index_method } pub fn experimental_strict_enabled(&self) -> bool { @@ -1503,7 +1503,7 @@ impl Connection { .with_views(views) .with_strict(strict) .with_encryption(encryption) - .with_custom_modules(custom_modules), + .with_index_method(custom_modules), None, )?; let conn = db.connect()?; @@ -1533,7 +1533,7 @@ impl Connection { .with_views(views) .with_strict(strict) .with_encryption(encryption) - .with_custom_modules(custom_modules), + .with_index_method(custom_modules), encryption_opts.clone(), )?; if let Some(modeof) = opts.modeof { @@ -2012,8 +2012,8 @@ impl Connection { self.db.experimental_views_enabled() } - pub fn experimental_custom_modules_enabled(&self) -> bool { - self.db.experimental_custom_modules_enabled() + pub fn experimental_index_method_enabled(&self) -> bool { + self.db.experimental_index_method_enabled() } pub fn experimental_strict_enabled(&self) -> bool { diff --git a/core/translate/index.rs b/core/translate/index.rs index 445b35636..52ee1c196 100644 --- a/core/translate/index.rs +++ b/core/translate/index.rs @@ -49,10 +49,12 @@ pub fn translate_create_index( panic!("translate_create_index must be called with CreateIndex AST node"); }; - if !connection.experimental_custom_modules_enabled() + if !connection.experimental_index_method_enabled() && (using.is_some() || !with_clause.is_empty()) { - bail_parse_error!("custom modules is an experimental feature. Enable with --experimental-custom-modules flag") + bail_parse_error!( + "index method is an experimental feature. Enable with --experimental-index-method flag" + ) } let original_idx_name = idx_name;