<?php
/**
 * Schema migration.
 *
 * @package LocalGuardScanner
 */

namespace LocalGuardScanner\Infrastructure\Database;

/**
 * Applies idempotent WordPress database migrations.
 */
final class Migrator {
	/**
	 * @return void
	 */
	public static function migrate() {
		global $wpdb;

		require_once ABSPATH . 'wp-admin/includes/upgrade.php';
		foreach ( Schema::statements( $wpdb ) as $statement ) {
			dbDelta( $statement );
		}
		update_site_option( 'lgs_schema_version', Schema::VERSION );
	}
}
