> For the complete documentation index, see [llms.txt](https://codemash.gitbook.io/codemash/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://codemash.gitbook.io/codemash/sdks/database/schemas/delete-database-schema.md).

# Delete Database Schema

Delete a database schema and drop its records (its collection) in the request's environment.

A **schema** defines a collection's fields, types, and validation. Schemas support drafts, versions, and publishing. This method deletes the schema **and drops its records** (its MongoDB collection, with its indexes) in the environment of the request — PROD unless the client is set to another environment. Copies of the schema in other environments, and their records, are not touched. This action cannot be undone; a new schema with the same name starts empty.

A schema still in use is refused and nothing is dropped: a schema trigger on it answers `CM-ERRORS-SCHEMA-017` (`BlockerTriggerIds`), a saved aggregate that starts from it or joins it answers `CM-ERRORS-SCHEMA-018` (`BlockerAggregateIds`, `BlockerAggregateNames`). The call is safe to retry.

{% hint style="warning" %}
This action is destructive or irreversible. Make sure you target the right item and confirm before running it.
{% endhint %}

This method is on the **Hub** surface (`norbix.hub.database`) — call it from admin tooling or IaC.

{% hint style="info" %}
These examples assume the SDK is installed and your credentials are set as environment variables — each client reads them automatically, so the constructors below take no arguments. See [Install a Norbix SDK](/codemash/sdks/install.md).
{% endhint %}

{% tabs %}
{% tab title="JavaScript / TypeScript" %}

```ts
import { Norbix } from '@norbix.ai/ts';
const norbix = new Norbix();

const result = await norbix.hub.database.deleteDatabaseSchema({
  id: 'sch_4kX9mQvR2tYw7ZbC1dFgHj',
});
```

{% endtab %}

{% tab title=".NET" %}

```csharp
using Norbix.Sdk;
using Norbix.Sdk.Types.Hub;

using var client = new NorbixClient();

var result = await client.Database.DeleteDatabaseSchemaAsync(new DeleteDatabaseSchemaRequest
{
    Id = "sch_4kX9mQvR2tYw7ZbC1dFgHj",
});
```

{% endtab %}

{% tab title="Python" %}

```python
from norbix_python import NorbixHub

norbix = NorbixHub()

result = norbix.database.delete_database_schema(
    id="sch_4kX9mQvR2tYw7ZbC1dFgHj",
)
```

{% endtab %}

{% tab title="Go" %}

```go
c, _ := norbix.New(norbix.Options{})
ctx := context.Background()

var result map[string]any
err := c.Hub.Database.DeleteDatabaseSchema(ctx, "sch_4kX9mQvR2tYw7ZbC1dFgHj", nil, &result)
```

{% endtab %}

{% tab title="Dart / Flutter" %}

```dart
import 'package:norbix/norbix_hub.dart';

final hub = NorbixHub();

final result = await hub.database.deleteDatabaseSchema(id: 'sch_4kX9mQvR2tYw7ZbC1dFgHj');
```

{% endtab %}

{% tab title="Swift" %}

```swift
import NorbixHub

let client = try NorbixHubClient()

let result = try await client.database.deleteDatabaseSchema([
    "id": "sch_4kX9mQvR2tYw7ZbC1dFgHj",
])
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
import ai.norbix.sdk.hub.NorbixHub

val hub = NorbixHub()

val result = hub.database.deleteDatabaseSchema(mapOf(
    "id" to "sch_4kX9mQvR2tYw7ZbC1dFgHj",
))
```

{% endtab %}

{% tab title="CLI" %}

```sh
norbix hub db schema delete sch_4kX9mQvR2tYw7ZbC1dFgHj
```

{% endtab %}
{% endtabs %}

## In Cloud

Manage this visually in Cloud — see [Database → Schemas](/codemash/cloud/database/collections/create-schema.md).

## API reference

Full request and response for this endpoint: [Delete Database Schema](/codemash/api-reference/database/schemas/delete-database-schema.md).
