Skip to contents

Development helper functions to delete artworks and artists from the database and optionally from CDN storage. Database deletion uses CASCADE constraints to automatically remove all related records.

Usage

delete_artwork(artwork, artist = NULL, delete_cdn = FALSE, cn = NULL)

delete_artist(artist, delete_cdn = FALSE, cn = NULL)

Arguments

artwork

Character. Artwork UUID.

artist

Character. Artist UUID.

delete_cdn

Logical. If TRUE, also deletes from CDN buckets. Default FALSE.

cn

Database connection. If NULL, creates and closes connection automatically.

Value

Invisible TRUE on success, FALSE if artwork not found

Invisible TRUE on success, FALSE if artist not found

Details

These functions leverage PostgreSQL CASCADE delete constraints:

  • Deleting from artwork_index cascades to 13 child tables

  • Deleting from artist_index cascades to 18 tables (including all artworks)

CDN deletion uses artcore::cdn_hard_delete() which is robust to missing assets.

Functions

  • delete_artwork(): Delete an artwork from database (and optionally CDN)

  • delete_artist(): Delete an artist and all their artworks from database (and optionally CDN)