Creates a new artist record with all required database tables initialized.
This function performs a transactional insert into both artist_index and
artist_stats tables, ensuring data consistency.
Usage
add_artist(
artist_name,
pronouns = NULL,
bio = NULL,
email = NULL,
phone = NULL,
birthday = NULL,
city = NULL,
state = NULL,
zipcode = NULL,
url_ig = NULL,
url_tiktok = NULL,
url_x = NULL,
url_youtube = NULL,
url_reddit = NULL,
url_site = NULL,
avatar_url = NULL,
is_verified = FALSE,
cn = NULL,
override_uuid = NULL,
create_paths = FALSE,
is_test = FALSE
)Arguments
- artist_name
Character. Full display name of the artist (required).
- pronouns
Character. Artist's pronouns (e.g., "she/her", "they/them"). Default: NULL.
- bio
Character. Artist biography text. Default: NULL.
Character. Contact email address. Default: NULL.
- phone
Character. Contact phone number. Default: NULL.
- birthday
Date or character. Artist's birthday. Default: NULL.
- city
Character. City of residence. Default: NULL.
- state
Character. State/province of residence. Default: NULL.
- zipcode
Character. Postal/ZIP code. Default: NULL.
- url_ig
Character. Instagram profile URL. Default: NULL.
- url_tiktok
Character. TikTok profile URL. Default: NULL.
- url_x
Character. X (Twitter) profile URL. Default: NULL.
- url_youtube
Character. YouTube channel URL. Default: NULL.
- url_reddit
Character. Reddit profile URL. Default: NULL.
- url_site
Character. Personal website URL. Default: NULL.
- avatar_url
Character. URL to artist avatar image. Default: NULL.
- is_verified
Logical. Whether artist is verified. Default: FALSE.
- cn
Database connection. If NULL, creates a connection via
artcore::dbc()and closes it on exit. Pass an existing connection to batch multiple queries efficiently.- override_uuid
Character. Force a specific UUID instead of generating one. Used for testing or data migration. Default: NULL.
- create_paths
Logical. Whether to create CDN directory structure. Default: FALSE.
- is_test
Logical. If TRUE, generates a test UUID prefix. Default: FALSE.
Details
The function performs the following operations in a single transaction:
Generates a unique artist UUID (or uses
override_uuidif provided)Creates a URL-friendly slug from the artist name
Optionally creates CDN directory structure for assets
Inserts a record into
app.artist_indexwith profile dataInserts a record into
app.artist_statswith zeroed counters
CDN Directories
When create_paths = TRUE, the following directories are created:
art-public/thumbnails/{artist_uuid}- Public avatar/thumbnailsart-vault/uploads/{artist_uuid}- Private artwork uploadsart-data/processed/{artist_uuid}- Processed artwork data
See also
update_artist_stats() for recalculating artist statistics
Other data-modify:
add_artwork(),
add_collection(),
delete_collection(),
update_artist_benchmarks(),
update_artist_stats()
Examples
if (FALSE) { # \dontrun{
# Basic artist creation
artist <- add_artist(
artist_name = "Jane Doe",
email = "jane@example.com",
bio = "Digital artist specializing in abstract landscapes"
)
# Full artist creation with CDN paths
artist <- add_artist(
artist_name = "John Smith",
pronouns = "he/him",
bio = "Traditional oil painter",
email = "john@example.com",
city = "New York",
state = "NY",
url_ig = "https://instagram.com/johnsmith",
url_site = "https://johnsmith.art",
create_paths = TRUE
)
# Test artist with specific UUID
artist <- add_artist(
artist_name = "Test Artist",
override_uuid = "test-0000-0000-0000-000000000001",
is_test = TRUE
)
} # }
