<?php

namespace SGC\eGiftCard\Database;

use SGC\eGiftCard\Database\Migrations\GiftCodeMigrator;
use SGC\eGiftCard\Database\Migrations\GiftEventsMigrator;
use SGC\eGiftCard\Database\Migrations\UserBalanceMigrator;

defined('ABSPATH') || exit; // Prevent direct file access.

/**
 * Class DBMigrate
 *
 * Handles the database migrations for the eGift Card system.
 */
class DBMigrate {

    /**
     * @var array List of migrator classes.
     */
    protected static $migrators = [
        GiftEventsMigrator::class,
        GiftCodeMigrator::class,
        UserBalanceMigrator::class
    ];

    /**
     * Run the migrations.
     *
     * @return void
     */
    public static function run() {
        self::migrate();
    }

    /**
     * Migrate all specified tables.
     *
     * @return void
     */
    protected static function migrate() {
        foreach (self::$migrators as $class) {
            $class::migrate();
        }
    }
}