From 343155aab78c28d6d09bea75671b390aec9599f6 Mon Sep 17 00:00:00 2001
From: Masaya Tojo <masaya@tojo.tokyo>
Date: Tue, 28 Feb 2023 21:00:18 +0900
Subject: Add function to delete a traansaction.

---
 deploy/delete_transaction.sql | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
 create mode 100644 deploy/delete_transaction.sql

(limited to 'deploy/delete_transaction.sql')

diff --git a/deploy/delete_transaction.sql b/deploy/delete_transaction.sql
new file mode 100644
index 0000000..b4d6567
--- /dev/null
+++ b/deploy/delete_transaction.sql
@@ -0,0 +1,14 @@
+-- Deploy kakeibo:delete_transaction to pg
+-- requires: transactions
+-- requires: appschema
+
+BEGIN;
+
+CREATE OR REPLACE FUNCTION kakeibo.delete_transaction(p_id integer)
+  RETURNS VOID AS $$
+BEGIN
+  DELETE FROM kakeibo.transactions WHERE id = p_id;
+END;
+$$ LANGUAGE plpgsql SECURITY DEFINER;
+
+COMMIT;
-- 
cgit v1.2.3

