# 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.&#x20;

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`

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

{% hint style="danger" %}
Before running the script back up your database.
{% endhint %}

```sql
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';
```

{% hint style="warning" %}
Important thing to keep in mind—in your database there should be **at least two organizations**:

* yours
* id=1, name='bakery' - a system one, <mark style="color:$warning;">you should not remove it</mark>
  {% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.uibakery.io/on-premise/install-and-update/recommendations/removing-accidentally-created-workspaces.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
