<?php
namespace QuizPress\Database;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

class CreateCategoryTable {

	public static function up( $prefix, $charset_collate ) {
		$table_name = $prefix . QUIZPRESS_PLUGIN_SLUG . '_category';

		$sql = "CREATE TABLE IF NOT EXISTS {$table_name} (
			id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
			category_title text NOT NULL,
			category_slug varchar(200) NOT NULL,
			category_content longtext NULL,
			question_ids JSON NULL,
			PRIMARY KEY (id)
		) {$charset_collate};";

		dbDelta( $sql );
	}

}
