# Database Maintenance

Locality IDB provides utility methods to clean and maintain database stores.

## Clearing Tables

### Clear Single Table

Use `clearTable()` to delete all rows in a specific table.

```typescript
await db.clearTable('users');
```

### Clear All Tables

Use `clearAll()` to empty all tables in the database in a single transaction.

```typescript
await db.clearAll();
```

:::danger
Clearing tables deletes all records permanently. This operation is not reversible.
:::

## Dropping Tables

Use `dropTable()` to drop an object store from IndexedDB:

```typescript
await db.dropTable('users');
```

:::note
Dropping a table triggers a version update on the database. You will need to recreate your schema and re-instantiate the `Locality` class after dropping a table.
:::

## Deleting Database

To delete the entire database, call the `deleteDB` method:

```typescript
await db.deleteDB();
```

:::danger
This will permanently delete the current database from the browser storage and close the active connection.
:::
