-- Find userId
SELECT id FROM ultron.users
WHERE email = '{{USER_EMAIL}}';

-- Check if user has _user_to_role
SELECT * FROM ultron._user_to_role
WHERE user_id = '{{USER_ID}}';

-- If user doesn't have a _user_to_role, then add its role.
-- e.g. Operator role 'f6fc38be-5aea-47c2-a241-1822d13d2922'
INSERT INTO ultron._user_to_role (user_id, role_id) VALUES
	('{{USER_ID}}', '{{USER_ROLE_ID}}');

-- Add user badges for being able to have steps assigned.
-- e.g. Operate Bolt New Menu skill '1722e50a-23f1-400f-bcec-f6ae3ac61d1f' and English language skill '91787440-b83a-4d00-a032-a448bfa0a074'
INSERT INTO ultron.badges (user_id, skill_id) VALUES
    ('{{USER_ID}}', '{{SKILL_ID}}');

-- Check if user has a team associated with them
SELECT teams.name, * FROM ultron._user_to_team
JOIN ultron.teams ON teams.id = _user_to_team.team_id 
WHERE user_id = '{{USER_ID}}';

-- If user does not have the team associated, in order for them to have access to the process, add them to it.
-- e.g. Bolt Menus Team is '2c8b86f5-a2fd-4993-8b97-9b49d3b3aa01'
INSERT INTO ultron._user_to_team (user_id, team_id) VALUES
	({{USER_ID}}, {{TEAM_ID}});