From baaa9bb106af01c0d6d5fd9cde87a27852bb8622 Mon Sep 17 00:00:00 2001
From: Masaya Tojo <masaya@tojo.tokyo>
Date: Sun, 12 Mar 2023 17:36:46 +0900
Subject: Add function to delete item.

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

(limited to 'deploy/delete_item.sql')

diff --git a/deploy/delete_item.sql b/deploy/delete_item.sql
new file mode 100644
index 0000000..38b3083
--- /dev/null
+++ b/deploy/delete_item.sql
@@ -0,0 +1,15 @@
+-- Deploy kakeibo:delete_item to pg
+-- requires: schema
+-- requires: items
+
+BEGIN;
+
+CREATE OR REPLACE FUNCTION kakeibo.delete_item(
+  p_item_id INTEGER
+) RETURNS VOID AS $$
+  BEGIN
+    DELETE FROM kakeibo.items WHERE id = p_item_id;
+  END;
+$$ LANGUAGE plpgsql SECURITY DEFINER;
+
+COMMIT;
-- 
cgit v1.2.3

