<?php
/**
 * File Path: includes/migrations/class-mbs-migration-4-3.php
 *
 * MBS_Migration_4_3 -- Schema 4.3 -- DASH-2A
 *
 * Creates mbs_brand_feed_cache table for multi-URL Brand Monitor storage.
 * Keeps 2 most-recent RSS results per feed URL (FIFO enforced in code).
 *
 * @package MyBookShowroom
 * @since   4.3.0
 */

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

/**
 * Class MBS_Migration_4_3
 *
 * @implements MBS_Migration
 */
class MBS_Migration_4_3 implements MBS_Migration { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound -- mbs_/MBS_ prefix is correct; scanner not configured with plugin prefix

	public function version(): string {
		return '4.3';
	}

	public function up(): void {
		global $wpdb;
		$charset_collate = $wpdb->get_charset_collate();
		$table           = $wpdb->prefix . 'mbs_brand_feed_cache';

		$sql = MBS_DB_Schema::brand_feed_cache( $table, $charset_collate );
		require_once ABSPATH . 'wp-admin/includes/upgrade.php';
		dbDelta( $sql );
	}
}
