diff options
Diffstat (limited to 'sql/Pg-database.sql')
-rw-r--r-- | sql/Pg-database.sql | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/sql/Pg-database.sql b/sql/Pg-database.sql index e57d0b1c..76b22079 100644 --- a/sql/Pg-database.sql +++ b/sql/Pg-database.sql @@ -131,27 +131,13 @@ COMMENT ON COLUMN users_conf.password IS 'This means we have to get rid of the c --INSERT INTO users(username) VALUES ('admin'); -- entity_id is declared NOT NULL !! - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ - - - INSERT INTO users_conf(id,password) VALUES (currval('users_id_seq'),NULL); +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -CREATE OR REPLACE FUNCTION create_user(text) RETURNS bigint AS $$ - INSERT INTO users(username) VALUES ($1); - SELECT currval('users_id_seq'); - $$ LANGUAGE 'SQL'; -COMMENT ON FUNCTION create_user(text) IS $$ Function to create user. Returns users.id if successful, else it is an error. $$; -CREATE OR REPLACE 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 $$; -- Session tracking table |