Skip to main content

Delete Database

Permanently delete a database by its internal name (slug) using the client.databases.delete() method. This is a destructive operation that cannot be undone, so use it with extreme caution. Deletion is asynchronous and returns a job ID that you can poll to track the deletion status.

⚠️ PERMANENT DELETION WARNING

Deleting a database permanently removes:

  • The entire database and all its data
  • ALL tables, records, and indexes within the database
  • Any associated metadata and configurations

The default database cannot be deleted.

Method Signature

client.databases.delete(dbInternalName: string): Promise<BolticSuccessResponse<DatabaseDeletionJobResponse> | BolticErrorResponse>

Parameters

ParameterTypeRequiredDescription
dbInternalNamestringDatabase internal name (slug) to delete

Return Value

BolticSuccessResponse<DatabaseDeletionJobResponse>

interface BolticSuccessResponse<DatabaseDeletionJobResponse> {
data: DatabaseDeletionJobResponse;
error: null;
}

DatabaseDeletionJobResponse

interface DatabaseDeletionJobResponse {
job_id: string; // Job identifier for tracking deletion status
db_id: string; // Database identifier being deleted
status: "pending"; // Initial status of the deletion job
}

Examples

Basic Database Deletion

import { createClient } from "@boltic/sdk";

const client = createClient("your-api-key");

const { data: deleteJob, error } = await client.databases.delete("old_database_slug");

if (error) {
console.error("Failed to delete database:", error.message);
return;
}

console.log(`Deletion job started: ${deleteJob.job_id}`);
console.log(`Database ID: ${deleteJob.db_id}`);

Best Practices

  1. Verify Before Deleting: Double-check the database name and ensure it's the correct one to delete. Consider listing databases first to confirm the db_internal_name.

  2. Backup Important Data: Export or backup any critical data before deletion. Once deleted, the database and all its contents cannot be recovered.

  3. Check Dependencies: Ensure no active workflows, integrations, or applications depend on this database before deletion.

  4. Monitor Deletion Status: Always poll for deletion status using pollDeleteStatus() to ensure the operation completes successfully. Deletion is asynchronous and may take time depending on database size.

  5. Default Database Protection: The default database cannot be deleted. Only non-default databases can be removed.