//native
type Xata = {
apiKey: string
}
/**
* Delete Database
* Delete a database and all of its branches and tables permanently.
*/
export async function main(auth: Xata, workspace_id: string, db_name: string) {
const url = new URL(`https://api.xata.io/workspaces/${workspace_id}/dbs/${db_name}`)
const response = await fetch(url, {
method: 'DELETE',
headers: {
Authorization: 'Bearer ' + auth.apiKey
},
body: undefined
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 428 days ago