Skip to main content

Coin Package Player Assignments

Junction table for assigning specific coin packages to individual players. Primarily used by the Smartico CRM integration to push personalized offers.

Table Comment

Junction table for assigning specific packages to specific players (managed by Smartico)

Relationships

Columns

ColumnTypeNullableDefaultDescription
iduuidNOgen_random_uuid()Primary key
package_iduuidNOFK to coin_packages. The package being assigned (typically package_source = smartico).
player_iduuidNOFK to players. The player who can see this package.
assigned_attimestamptzNOCURRENT_TIMESTAMPWhen the assignment was created
expires_attimestamptzYESWhen this assignment expires. NULL = never expires.
assigned_byvarchar(50)NO'smartico'System that created the assignment (e.g., smartico, admin)
metadatajsonbYESAdditional data from the assigning system (e.g., campaign ID, segment info)
claimedbooleanNOfalseWhether the player has purchased/claimed this assigned package
claimed_attimestamptzYESWhen the player claimed the package
created_attimestamptzNOCURRENT_TIMESTAMPRecord creation timestamp

Key Indexes

IndexColumnsNotes
coin_package_player_assignments_pkeyidPrimary key
idx_package_assignments_playerplayer_idFind all assignments for a player
idx_package_assignments_packagepackage_idFind all players assigned a package
idx_package_assignments_player_expiresplayer_id, expires_atActive/valid assignments
idx_package_assignments_expiresexpires_atPartial: WHERE expires_at IS NOT NULL — for cleanup jobs
idx_package_assignments_unclaimedplayer_id, claimedPartial: WHERE claimed = false — fast lookup for pending offers

Business Rules

  • Used primarily with the Smartico CRM to deliver personalized offers to targeted player segments
  • Only packages with package_source = 'smartico' or package_source = 'affiliate_hidden' typically use this table
  • When the player purchases the assigned package, claimed is set to true and claimed_at is recorded
  • Expired assignments (expires_at < NOW()) are filtered out when displaying available packages
  • The metadata field stores campaign and segmentation data from Smartico for analytics