<?php

/**
 * Migration 0059 — listing story (member case-study section)
 *
 * "How <name> runs on Instinctor." on the profile page. Authored
 * markup-lite (same format as details: ## / - / plain lines), CLIENT
 * members only (Sergei 2026-08-09: never for our own properties like
 * Studio or Academy). Content rule: real business facts + the true
 * network-level pattern; no invented quotes or member-specific numbers.
 * Owners enrich their own stories over time.
 *
 * @since 2.1.2511
 */

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

return [
    'description' => 'directory_listings.story (member case-study section)',

    'up' => [],

    'php' => function () {
        $t = \Instinctor\Core\DB::prefix() . 'instinctor_directory_listings';
        $hasCol = (int) \Instinctor\Core\DB::get_var(\Instinctor\Core\DB::prepare(
            'SELECT COUNT(*) FROM information_schema.COLUMNS
             WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = %s AND COLUMN_NAME = %s',
            $t, 'story'
        )) > 0;
        if (!$hasCol) {
            \Instinctor\Core\DB::query("ALTER TABLE {$t} ADD COLUMN story text NULL DEFAULT NULL");
        }
    },
];
