summaryrefslogtreecommitdiff
path: root/sql/Pg-upgrade-2.6.18-2.6.19.sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql/Pg-upgrade-2.6.18-2.6.19.sql')
-rw-r--r--sql/Pg-upgrade-2.6.18-2.6.19.sql18
1 files changed, 17 insertions, 1 deletions
diff --git a/sql/Pg-upgrade-2.6.18-2.6.19.sql b/sql/Pg-upgrade-2.6.18-2.6.19.sql
index f06f661e..ce34ab29 100644
--- a/sql/Pg-upgrade-2.6.18-2.6.19.sql
+++ b/sql/Pg-upgrade-2.6.18-2.6.19.sql
@@ -189,4 +189,20 @@ COMMIT;
BEGIN;
INSERT INTO users(username) VALUES ('admin');
INSERT INTO users_conf(id,password) VALUES (currval('users_id_seq'),NULL);
-COMMIT; \ No newline at end of file
+COMMIT;
+
+-- Functions
+
+CREATE FUNCTION create_user(text) RETURNS int4 AS $$
+ INSERT INTO users(username) VALUES ('$1');
+ SELECT 1;
+ $$ LANGUAGE 'SQL';
+
+COMMENT ON FUNCTION create_user(text) IS $$ Function to create user Returns 1 if successful, else it is an error. $$;
+
+CREATE FUNCTION update_user(int4,text) RETURNS int4 AS $$
+ UPDATE users SET username = '$2' WHERE id = $1;
+ SELECT 1;
+ $$ LANGUAGE 'SQL';
+
+COMMENT ON FUNCTION update_user(int4,text) IS $$ Takes int4 which is users.id and text which is username. Will update username based on id. Username is unique $$;