DECLARE
new_uuid uuid;
new_name text;
BEGIN
-- Generate a unique username with prefix 'Survivalist' and a random suffix
new_name := LEFT('Survivalist' || to_char(floor(random() * 1000), 'FM000'), 20); -- Adjust length as needed
-- Insert into user_Details, get the UUID
INSERT INTO public."user_Details"(email)
VALUES ('')
RETURNING "userID" INTO new_uuid;
-- Insert into user_Accounts
INSERT INTO public."user_Accounts"("userID", "AccountID", "name", "server")
VALUES (new_uuid, 1, new_name, 1);
-- Return the new UUID
RETURN new_uuid;
END;
DECLARE
new_uuid uuid;
new_name text;
BEGIN
-- Generate a unique username with prefix 'Survivalist' and a random suffix
new_name := LEFT('Survivalist' || to_char(floor(random() * 1000), 'FM000'), 20); -- Adjust length as needed
-- Insert into user_Details, get the UUID
INSERT INTO public."user_Details"(email)
VALUES ('')
RETURNING "userID" INTO new_uuid;
-- Insert into user_Accounts
INSERT INTO public."user_Accounts"("userID", "AccountID", "name", "server")
VALUES (new_uuid, 1, new_name, 1);
-- Return the new UUID
RETURN new_uuid;
END;