third variant of migration_tools.assert with success message as 3rd argument
authorJason Etheridge <jason@esilibrary.com>
Thu, 30 Mar 2017 17:32:44 +0000 (13:32 -0400)
committerJason Etheridge <jason@esilibrary.com>
Thu, 30 Mar 2017 17:32:44 +0000 (13:32 -0400)
Signed-off-by: Jason Etheridge <jason@esilibrary.com>

sql/base/base.sql

index 7eb55e0..82a7e7a 100644 (file)
@@ -2467,3 +2467,14 @@ CREATE OR REPLACE FUNCTION migration_tools.assert (BOOLEAN,TEXT) RETURNS VOID AS
     END;
 $$ LANGUAGE PLPGSQL STRICT VOLATILE;
 
+CREATE OR REPLACE FUNCTION migration_tools.assert (BOOLEAN,TEXT,TEXT) RETURNS TEXT AS $$
+    DECLARE
+        test ALIAS FOR $1;
+        fail_msg ALIAS FOR $2;
+        success_msg ALIAS FOR $3;
+    BEGIN
+        ASSERT test, fail_msg;
+        RETURN success_msg;
+    END;
+$$ LANGUAGE PLPGSQL STRICT VOLATILE;
+