From 6f32344efb20c9e9aa85f68ecc6aa5fad2a39448 Mon Sep 17 00:00:00 2001 From: krishvishal Date: Thu, 30 Jan 2025 17:05:14 +0530 Subject: [PATCH] Make comparison of `type_name` case insensitive by converting to uppercase --- core/translate/mod.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/translate/mod.rs b/core/translate/mod.rs index 8f0c5f533..18ecbb62d 100644 --- a/core/translate/mod.rs +++ b/core/translate/mod.rs @@ -258,7 +258,7 @@ fn emit_schema_entry( /// /// An automatic PRIMARY KEY index is not required if: /// - The table has no PRIMARY KEY -/// - The table has a single-column PRIMARY KEY whose typename is _exactly_ "integer" e.g. not "INT". +/// - The table has a single-column PRIMARY KEY whose typename is _exactly_ "INTEGER" e.g. not "INT". /// In this case, the PRIMARY KEY column becomes an alias for the rowid. /// /// Otherwise, an automatic PRIMARY KEY index is required. @@ -348,7 +348,8 @@ fn check_automatic_pk_index_required( let needs_auto_index = if let Some(primary_key_definition) = &primary_key_definition { match primary_key_definition { PrimaryKeyDefinitionType::Simple { typename } => { - let is_integer = typename.is_some() && typename.unwrap() == "integer"; + let is_integer = + typename.is_some() && typename.unwrap().to_uppercase() == "INTEGER"; !is_integer } PrimaryKeyDefinitionType::Composite => true,