Skip to main content

Update Database

Update the display name of a database using the client.databases.update() method. This allows you to change the human-readable name of your database without affecting its internal identifier or any of its data.

Method Signature

client.databases.update(
dbInternalName: string,
request: DatabaseUpdateRequest
): Promise<BolticSuccessResponse<DatabaseRecord> | BolticErrorResponse>

Parameters

ParameterTypeRequiredDescription
dbInternalNamestringDatabase internal name (slug) to update
requestDatabaseUpdateRequestUpdate request containing the new display name

DatabaseUpdateRequest

ParameterTypeRequiredDescription
db_namestringNew display name for the database

Return Value

BolticSuccessResponse<DatabaseRecord>

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

DatabaseRecord

Returns the updated DatabaseRecord with all current properties:

interface DatabaseRecord {
id: string; // Unique database identifier (UUID)
account_id: string; // Account identifier
db_name: string; // Updated display name
db_internal_name: string; // Internal identifier (unchanged)
db_username: string; // Database username
resource_id: string; // Resource identifier
status: "ACTIVE"; // Database status
is_default: boolean; // Whether this is the default database
rank: number; // Database ranking/order
created_by: string; // Creator identifier
updated_by: string; // Last updater identifier
created_at: string; // Creation timestamp (ISO 8601)
updated_at: string; // Last update timestamp (ISO 8601)
}

Examples

Basic Database Update

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

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

const { data: updatedDatabase, error } = await client.databases.update("production_db", {
db_name: "Production Database",
});

if (error) {
console.error("Failed to update database:", error.message);
} else {
console.log("Database updated successfully:");
console.log(`- Name: ${updatedDatabase.db_name}`);
console.log(`- Internal Name: ${updatedDatabase.db_internal_name}`);
console.log(`- Updated: ${new Date(updatedDatabase.updated_at).toLocaleString()}`);
}