<?php
/**
 * File Path: includes/migrations/class-mbs-migration-1-9.php
 *
 * MBS_Migration_1_9 — Sprint S13-13 — Multi-marketplace locale URLs
 *
 * Add per-locale URL columns (US, UK, CA, AU, DE, JP) to mbs_buy_links via dbDelta.
 *
 * @package MyBookShowroom
 * @since   3.2.0
 */

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

/**
 * Class MBS_Migration_1_9
 *
 * Add per-locale URL columns (US, UK, CA, AU, DE, JP) to mbs_buy_links via dbDelta.
 *
 * @implements MBS_Migration
 */
class MBS_Migration_1_9 implements MBS_Migration { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound -- mbs_/MBS_ prefix is correct; scanner not configured with plugin prefix

	/**
	 * {@inheritdoc}
	 *
	 * @return string
	 */
	public function version(): string {
		return '1.9';
	}

	/**
	 * {@inheritdoc}
	 *
	 * Add per-locale URL columns (US, UK, CA, AU, DE, JP) to mbs_buy_links via dbDelta.
	 *
	 * @return void
	 */
	public function up(): void {
		global $wpdb;
		require_once ABSPATH . 'wp-admin/includes/upgrade.php';
		$table           = $wpdb->prefix . 'mbs_buy_links';
		$charset_collate = $wpdb->get_charset_collate();
		dbDelta( MBS_DB_Schema::buy_links( $table, $charset_collate ) );
	}
}
