<?php

defined('ABSPATH') or exit('Hey, what are you doing here? You silly human!');

class Dusky_Update_1_0_2
{
    private static $instance;

    public function __construct()
    {
        $this->update_table_column();
    }

    private function update_table_column()
    {
        global $wpdb;

        // phpcs:ignore WordPress.DB.DirectDatabaseQuery
        $wpdb->query("ALTER TABLE {$wpdb->prefix}dusky_analytics ADD active_mode tinyint(1) NOT NULL DEFAULT 0 AFTER unique_id");

        // phpcs:ignore WordPress.DB.DirectDatabaseQuery
        $wpdb->query("ALTER TABLE {$wpdb->prefix}dusky_analytics DROP visitor");
    }

    public static function instance()
    {
        if (is_null(self::$instance)) {
            self::$instance = new self();
        }

        return self::$instance;
    }
}

Dusky_Update_1_0_2::instance();
