Creates or updates artist preference settings in the database. Uses PostgreSQL UPSERT (INSERT ... ON CONFLICT DO UPDATE) for atomic operation.
Usage
upsert_artist_preferences(
artist_uuid,
default_wip_collection_visibility = NULL,
default_draft_artwork_visibility = NULL,
extended_settings = NULL,
cn = NULL
)Arguments
- artist_uuid
Character. Artist UUID (required).
- default_wip_collection_visibility
Character. Default visibility for work-in-progress collections. Must be 'visible' or 'hidden'. Default: NULL.
- default_draft_artwork_visibility
Character. Default visibility for draft artworks. Must be 'visible' or 'hidden'. Default: NULL.
- extended_settings
List. Additional settings stored as JSONB. Default: NULL.
- cn
Database connection. If NULL, creates and closes connection. Default: NULL.
Details
This function manages settings in the settings.artist_preferences table.
It performs an atomic upsert operation - inserting a new record if the artist
doesn't have preferences, or updating existing preferences if they do.
Database Table
Operates on settings.artist_preferences with columns:
- artist_uuid
Primary key, references app.artist_index
- default_wip_collection_visibility
'visible' or 'hidden'
- default_draft_artwork_visibility
'visible' or 'hidden'
- extended_settings
JSONB for additional settings
- updated_at
Timestamp of last update