From 80cea7f94e07465a5668a3ccf90f86d911de8781 Mon Sep 17 00:00:00 2001 From: fabianlindfors Date: Wed, 5 Jan 2022 14:15:16 +0100 Subject: [PATCH] Fix bad SQL query in abort for remove_column --- src/migrations/remove_column.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/migrations/remove_column.rs b/src/migrations/remove_column.rs index de8e0c8..86549f5 100644 --- a/src/migrations/remove_column.rs +++ b/src/migrations/remove_column.rs @@ -58,7 +58,7 @@ impl Action for RemoveColumn { CREATE OR REPLACE FUNCTION {trigger_name}() RETURNS TRIGGER AS $$ BEGIN - IF NEW.{column_name} IS NULL THEN + IF NOT reshape.is_old_schema() IS NULL THEN DECLARE {declarations} BEGIN @@ -114,7 +114,7 @@ impl Action for RemoveColumn { fn abort(&self, ctx: &MigrationContext, db: &mut dyn Conn) -> anyhow::Result<()> { // Remove function and trigger - db.query(&format!( + db.run(&format!( " DROP TRIGGER IF EXISTS {trigger_name} ON {table}; DROP FUNCTION IF EXISTS {trigger_name};