Jake Vanderwerf
2025-12-23 25be5747a6e462a3d09fc6607b3639b79e4d9374
inc/registry/CheckCustomTables.php
@@ -128,9 +128,9 @@
         }
         try {
            if (array_key_exists('dashboard', $this->JVB_SITE) && $this->JVB_SITE['dashboard']) {
//          if (array_key_exists('dashboard', $this->JVB_SITE) && $this->JVB_SITE['dashboard']) {
               $tables = array_merge($tables, $this->queueTables(), $this->errorLogTables());
            }
//          }
         } catch (Exception $e) {
            error_log("JVB: Error in dashboard section: " . $e->getMessage());
         }
@@ -144,7 +144,7 @@
         }
         // RE-ENABLE favourites tables
         try {
            if ($this->JVB_SITE['favourites']) {
            if (array_key_exists('favourites', $this->JVB_SITE)) {
               error_log('JVB: Creating favourites tables...');
               $favouriteTables = $this->favouriteTables();
               error_log('JVB: Favourites tables created: ' . count($favouriteTables));
@@ -497,25 +497,30 @@
        ];
    }
    protected function errorLogTables():array
    {
        return [
            'error_log'=> "(
            `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
            `error_type` varchar(50) NOT NULL,
            `component` varchar(50) NOT NULL,
            `message` text NOT NULL,
            `context` JSON,
            `severity` varchar(20) NOT NULL,
            `user_id` {$this->userIDType} NOT NULL,
            `created_at` timestamp DEFAULT CURRENT_TIMESTAMP,
            PRIMARY KEY (`id`),
            KEY `error_lookup` (`error_type`, `severity`, `created_at`),
            KEY `component_errors` (`component`, `created_at`)
        )"
        ];
    }
   protected function errorLogTables():array
   {
      return [
         'error_log'=> "(
            `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
            `error_type` varchar(50) NOT NULL,
            `component` varchar(100) NOT NULL,
            `method` varchar(100) DEFAULT NULL,
            `page_url` varchar(255) DEFAULT NULL,
            `message` text NOT NULL,
            `context` JSON,
            `severity` varchar(20) NOT NULL,
            `user_id` {$this->userIDType} DEFAULT NULL,
            `user_was_logged_in` tinyint(1) NOT NULL,
            `source` enum('frontend','backend') NOT NULL,
            `created_at` timestamp DEFAULT CURRENT_TIMESTAMP,
            PRIMARY KEY (`id`),
            KEY `created_at` (`created_at`),
            KEY `component_severity_date` (`component`, `severity`, `created_at`),
            KEY `error_type_date` (`error_type`, `created_at`),
            KEY `severity_date` (`severity`, `created_at`)
         )"
      ];
   }
   protected function userIntegrationsTable():array
   {