Empty the whole site database
clear_site_database
Drops every collection in a site database, destroying the tables along with their columns and relationships.
This does not merely empty the collections. The tables themselves are dropped in one irreversible step, so the collections, their columns and their relationships all go and the site is left with an empty database it cannot read from. The live site loses its content and its schema the moment it runs, and nothing can restore what it drops. The response counts the dropped tables in dropped.
clear_collection is not simply a narrower version of this: it empties one collection and leaves it standing, columns included, while this destroys the collections themselves. The database stays provisioned, so its connection keeps working, but the schema has to be rebuilt. The CMS folder of storage is emptied too, since every file in it belonged to an item.
It needs the Delete projects permission in the workspace, which the stock member role does not hold, so an ordinary member cannot run it. Before it runs, the tool tells the client to read eligibility from list_database_backups, and while that reads ready and canBackup is true, to take a backup with create_database_backup, when it has that tool, and wait until the backup reads ready. On unsupported or no-database, no backup of this data exists or ever will, and a database backup can only ever be downloaded from the editor, never restored.
The tool tells the client never to call it to tidy up or to retry a failed import, and to call it only when you asked for exactly this, understand that the schema goes too, and confirmed it. See Clear every collection.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
projectId |
string | Yes | The site id. |