DocsoPWA17. Database Schema
Developer

17. Database Schema

oPWAorravo.com/docs/opwa/17-database-schema

{prefix}opwa_subscribers

ColumnTypeDescription
idBIGINT UNSIGNED AUTO_INCREMENTPrimary key
endpointTEXT NOT NULLPush subscription URL
p256dhTEXT NOT NULLClient public key
authVARCHAR(255)Auth secret
user_idBIGINT UNSIGNED NULLWP user ID if logged in
device_typeVARCHAR(20)mobile, tablet, desktop
user_agentTEXTRaw UA string
created_atDATETIMESubscription time

Unique index on MD5 hash of endpoint to prevent duplicates.


{prefix}opwa_campaigns

ColumnTypeDescription
idBIGINT UNSIGNED AUTO_INCREMENTPrimary key
titleVARCHAR(255)Notification title
bodyTEXTNotification body
icon_urlVARCHAR(1000)Icon URL
click_urlVARCHAR(1000)Click-through URL
sentINTSuccessful deliveries
failedINTFailed deliveries
totalINTTotal subscribers at send time
created_atDATETIMESend time

{prefix}opwa_analytics

One row per calendar date.

ColumnTypeDescription
idBIGINT UNSIGNED AUTO_INCREMENTPrimary key
stat_dateDATE NOT NULLDate (YYYY-MM-DD)
page_views_totalINTTotal page view beacons
page_views_swINTPVs where SW was active
cache_hitsINTCache-served responses
cache_missesINTNetwork-fallback responses
offline_sessionsINTSessions without network
install_prompts_shownINTInstall banner impressions
installsINTappinstalled events
install_dismissalsINTBanner dismissals
sw_registrationsINTSW registration events

Unique key on stat_date. record_beacon() uses INSERT … ON DUPLICATE KEY UPDATE so concurrent requests safely increment counters.


17. Database Schema — oPWA Docs — Orravo