> 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 dynamically by asking a question.

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

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
