Delete Ektron User

| | | | | |

In order to force a deletion from the Ektron user list you must follow the below path.

DISCLAIMER: This will remove all content that was ever created/touched by the user.

--Permissions Table
DELETE permissions_tbl
FROM permissions_tbl
INNER JOIN users ON permissions_tbl.user_id = users.user_id
WHERE users.user_name = 'dkittell'

--Group Table
DELETE user_to_group_tbl
FROM user_to_group_tbl
INNER JOIN users ON user_to_group_tbl.user_id = users.user_id
WHERE users.user_name = 'dkittell'

--Content META
DELETE content_meta_tbl
FROM content_meta_tbl
INNER JOIN content ON content.content_id = content_meta_tbl.content_id
INNER JOIN users ON content.user_id = users.user_id
WHERE users.user_name = 'dkittell'

--Library
DELETE library
FROM library
INNER JOIN content ON content.content_id = library.content_id
INNER JOIN users ON content.user_id = users.user_id
WHERE users.user_name = 'dkittell'

DELETE library
FROM library
INNER JOIN users ON library.user_id = users.user_id
WHERE users.user_name = 'dkittell'

--Tasks History
DELETE task_history
FROM task_history
INNER JOIN tasks ON task_history.task_id = tasks.task_id
INNER JOIN content ON content.content_id = tasks.content_id
INNER JOIN users ON content.user_id = users.user_id
WHERE users.user_name = 'dkittell'

DELETE task_history
FROM task_history
INNER JOIN tasks ON task_history.task_id = tasks.task_id
INNER JOIN users ON tasks.assigned_by_user_id = users.user_id
WHERE users.user_name = 'dkittell'

DELETE task_history
FROM task_history
INNER JOIN tasks ON task_history.task_id = tasks.task_id
INNER JOIN users ON tasks.assigned_to_user_id = users.user_id
WHERE users.user_name = 'dkittell'

--Tasks
DELETE tasks
FROM tasks
INNER JOIN content ON content.content_id = tasks.content_id
INNER JOIN users ON content.user_id = users.user_id
WHERE users.user_name = 'dkittell'

DELETE tasks
FROM tasks
INNER JOIN users ON tasks.assigned_by_user_id = users.user_id
WHERE users.user_name = 'dkittell'

--Content
DELETE content
FROM content
INNER JOIN users ON content.user_id = users.user_id
WHERE users.user_name = 'dkittell'

--Users Table
DELETE
FROM users
WHERE user_name = 'dkittell'
Originally Posted on July 29, 2013
Last Updated on October 26, 2015
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.