<?php

/**
 * Migration 0054 — directory profile view counts (per listing, per day)
 *
 * Membership made visible as a number: "your page: N visits, M messages"
 * on the platform screen and in each member portal. Counting is
 * JS-verified (a sendBeacon from the rendered profile, so plain crawlers
 * do not inflate it) and admin preview visits are not counted. Aggregated
 * per day: no IPs, no UA strings, nothing personal stored.
 *
 * @since 2.1.2501
 */

if (!defined('ABSPATH')) exit;

return [
    'description' => 'instinctor_directory_views (listing_id + day aggregate)',

    'up' => [
        "CREATE TABLE IF NOT EXISTS {prefix}instinctor_directory_views (
            listing_id bigint(20) unsigned NOT NULL,
            day date NOT NULL,
            views int unsigned NOT NULL DEFAULT 0,
            PRIMARY KEY (listing_id, day)
        ) {charset}",
    ],
];
