From c8cd6f438eccef3bfb95ea6d6ef30228e6d2df8a Mon Sep 17 00:00:00 2001 From: fabianlindfors Date: Sun, 17 Mar 2024 17:29:04 +0100 Subject: [PATCH] Add quotes for column names --- src/migrations/add_column.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/migrations/add_column.rs b/src/migrations/add_column.rs index 63a7bb1..845320e 100644 --- a/src/migrations/add_column.rs +++ b/src/migrations/add_column.rs @@ -81,7 +81,7 @@ impl Action for AddColumn { let temp_column_name = self.temp_column_name(ctx); let mut definition_parts = vec![ - temp_column_name.to_string(), + format!("\"{}\"", temp_column_name.to_string()), self.column.data_type.to_string(), ]; @@ -111,7 +111,7 @@ impl Action for AddColumn { .iter() .map(|column| { format!( - "{alias} public.{table}.{real_name}%TYPE := NEW.{real_name};", + "\"{alias}\" public.{table}.{real_name}%TYPE := NEW.{real_name};", table = table.real_name, alias = column.name, real_name = column.real_name, @@ -131,7 +131,7 @@ impl Action for AddColumn { DECLARE {declarations} BEGIN - NEW.{temp_column_name} = {up}; + NEW."{temp_column_name}" = {up}; END; END IF; RETURN NEW;