Modulify

Delete every row in a collection

clear_collection

Deletes every row in one table of a site database in a single irreversible step, keeping the table and its columns.

Nothing can restore the rows it deletes, and the live site loses that content the moment it runs. The table and its columns survive, so only the content goes, and the table's files in the CMS folder of storage are deleted with its rows. The response counts the deleted rows in cleared.

While other collections still link to those rows it is refused with a 409 and Some items are linked from other collections and cannot be cleared. Clear those collections first! Where those links cascade, the linked rows in the other collections go too. The field metadata table and the join tables behind multi-reference fields cannot be cleared this way.

It needs the Delete projects permission in the workspace, which the stock member role does not hold. That makes it stricter than deleting a site, because a member may delete a site they created but may not empty its collections.

Before it runs, the tool tells the client to read eligibility from list_database_backups. While that reads ready and canBackup is true, the client takes a backup with create_database_backup, when it has that tool, and waits until the backup reads ready. On unsupported or no-database, no backup of these rows 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, to retry a failed import or because a collection looks unused, and to call it only when you asked for that exact collection to be emptied and confirmed after the client named it back to you. See Clear one collection's data.

Inputs

Input Type Required Description
projectId string Yes The site id.
schema string No The schema the collection lives in, exactly as list_collections reports it. Leave it out to use the site database's own default, which is right unless list_collections showed something else. A site on the newer database always uses its default.
name string Yes The table to empty, exactly as list_collections reports it.