> For the complete documentation index, see [llms.txt](https://docs.uibakery.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.uibakery.io/on-premise/install-and-update/recommendations/removing-accidentally-created-workspaces.md).

# 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
