From 48721c85ebcfa973ee81719d2467ca80e4253dc9 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Fri, 01 May 2026 17:30:03 +0000
Subject: [PATCH] =Edmonton Ink hard test begins! Real testing of the managers and reset routes will commence. So far, just ensuring our classes are all loaded correctly: Site() and its sub-classes Membership, Login, etc. Care should be taken to load conditionally on 'init', as we finish defining most settings by 'plugins_loaded' at priority 5

---
 inc/managers/KarmaManager.php |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/inc/managers/KarmaManager.php b/inc/managers/KarmaManager.php
index 6bba6da..4aaa56e 100644
--- a/inc/managers/KarmaManager.php
+++ b/inc/managers/KarmaManager.php
@@ -122,7 +122,7 @@
 	protected function defineTable():bool
 	{
 		$table = CustomTable::for('karma_'.$this->key);
-		[$type, $table, $column] = $this->getReferenceTable($table);
+		[$type, $referenceTable, $column] = $this->getReferenceTable($table);
 		if (!$type) {
 			error_log('[KarmaManager]::defineTable Attempted to build reference for invalid table: '.$this->references);
 			CustomTable::destroyInstance('karma_'.$this->key);
@@ -134,7 +134,7 @@
 			'item_id'	=> "{$type} NOT NULL",
 			'user_id'	=> "{$table->getUserIDType()} NOT NULL",
 			'content'	=> 'varchar(255) NOT NULL',
-			'vote'		=> "ENUM('up,'down') NOT NULL",
+			'vote'		=> "ENUM('up','down') NOT NULL",
 			'created_at'=> 'datetime NOT NULL DEFAULT CURRENT_TIMESTAMP',
 			'updated_at'=> 'datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'
 		]);
@@ -147,9 +147,9 @@
 		]);
 		$base = BASE;
 		$table->setConstraints([
-			"CONSTRAINT `{$base}kt_{$type}_item_id` FOREIGN KEY (`item_id`)
-			REFERENCES `{$table}` (`{$column}`) ON DELETE CASCADE",
-			"CONSTRAINT `{$base}kt_{$type}_user_id` FOREIGN KEY (`user_id`)
+			"CONSTRAINT `{$base}kt_{$this->key}_{$type}_item_id` FOREIGN KEY (`item_id`)
+			REFERENCES `{$referenceTable}` (`{$column}`) ON DELETE CASCADE",
+			"CONSTRAINT `{$base}kt_{$this->key}_{$type}_user_id` FOREIGN KEY (`user_id`)
 			REFERENCES `{$table->getUserTable()}` (`ID`) ON DELETE CASCADE"
 		]);
 		$table->defineTable();

--
Gitblit v1.10.0