Removing accidentally created workspaces

By default, UI Bakery allows users to create their own organizations. When a user is not invited to any organization and registers for the first time, one of the options is to create a new workspace. This leads to extra workspaces created that are not actually needed.

To clean up these unused organizations, you need to take the following steps:

  1. First, disable the ability to create new workspaces using this flag:

UI_BAKERY_SINGLE_ORGANIZATION=true

  1. Run the following SQL query that will delete the organizations by their names:

triangle-exclamation
UPDATE project
  INNER JOIN organization ON project.organization_id = organization.id
  SET project.theme_id = null
  WHERE organization.name = 'ORG NAME';

DELETE user FROM user
  INNER JOIN user_organization_role ON user.id = user_organization_role.user_id
  INNER JOIN organization_role ON user_organization_role.organization_role_id = organization_role.id
  INNER JOIN organization ON organization_role.organization_id = organization.id
  WHERE organization.name = 'ORG NAME';

DELETE FROM organization WHERE name = 'ORG NAME';
circle-exclamation

Last updated

Was this helpful?