From 944b6b0526032ad8c1b4a2612d6723bec75e0e4c Mon Sep 17 00:00:00 2001
From: Freya Murphy <freya@freyacat.org>
Date: Fri, 29 Mar 2024 22:29:56 -0400
Subject: start database (user and post), and initial barebones home page

---
 db/rev.sql | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 db/rev.sql

(limited to 'db/rev.sql')

diff --git a/db/rev.sql b/db/rev.sql
new file mode 100644
index 0000000..dff1cfe
--- /dev/null
+++ b/db/rev.sql
@@ -0,0 +1,21 @@
+CREATE OR REPLACE FUNCTION curr_revision()
+RETURNS INTEGER
+LANGUAGE plpgsql VOLATILE
+AS $BODY$
+DECLARE
+	_revision INTEGER;
+BEGIN
+	BEGIN
+		SELECT curr_revision INTO _revision
+			FROM sys.database_info
+			WHERE name = current_database();
+		RETURN _revision;
+	EXCEPTION WHEN OTHERS THEN
+		RETURN 0;
+	END;
+END
+$BODY$;
+
+GRANT EXECUTE ON FUNCTION curr_revision() TO xssbook;
+
+SELECT curr_revision();
-- 
cgit v1.2.3-freya

