From 438a85fd3a2ea8dd4fa48df5537c1db2c0e90878 Mon Sep 17 00:00:00 2001
From: Masaya Tojo <masaya@tojo.tokyo>
Date: Tue, 28 Feb 2023 22:20:46 +0900
Subject: Add function to delete item.

---
 deploy/delete_item.sql | 14 ++++++++++++++
 1 file changed, 14 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..51dbcf5
--- /dev/null
+++ b/deploy/delete_item.sql
@@ -0,0 +1,14 @@
+-- Deploy kakeibo:delete_item to pg
+-- requires: appschema
+-- requires: items
+
+BEGIN;
+
+CREATE OR REPLACE FUNCTION kakeibo.delete_item(p_id integer)
+  RETURNS VOID AS $$
+BEGIN
+  DELETE FROM kakeibo.items WHERE id = p_id;
+END;
+$$ LANGUAGE plpgsql SECURITY DEFINER;
+
+COMMIT;
-- 
cgit v1.2.3

