<?php
/**
 * File Path: includes/migrations/class-mbs-migration-3-2.php
 *
 * MBS_Migration_3_2 -- Sprint ONIX-21 DECISION-001 -- out_of_print column
 *
 * Add out_of_print TINYINT(1) column to mbs_format_rows via dbDelta (no data loss).
 *
 * @package MyBookShowroom
 * @since   3.3.0
 */

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

/**
 * Class MBS_Migration_3_2
 *
 * Add out_of_print TINYINT(1) column to mbs_format_rows via dbDelta.
 *
 * @implements MBS_Migration
 */
class MBS_Migration_3_2 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 '3.2';
	}

	/**
	 * {@inheritdoc}
	 *
	 * Add out_of_print TINYINT(1) column to mbs_format_rows via dbDelta (no data loss).
	 *
	 * @return void
	 */
	public function up(): void {
		global $wpdb;
		require_once ABSPATH . 'wp-admin/includes/upgrade.php';
		$table           = $wpdb->prefix . 'mbs_format_rows';
		$charset_collate = $wpdb->get_charset_collate();
		dbDelta( MBS_DB_Schema::format_rows( $table, $charset_collate ) );
	}
}
