CREATE TABLE IF NOT EXISTS `#__testquestions_questions` ( `id` int unsigned NOT NULL AUTO_INCREMENT, `category_id` int unsigned NOT NULL DEFAULT 0, `time_limit` smallint unsigned NOT NULL DEFAULT 60, `points` tinyint unsigned NOT NULL DEFAULT 1, `test_symbol` varchar(100) NOT NULL DEFAULT '', `exam_year` smallint unsigned NULL DEFAULT NULL, `question_number` smallint unsigned NULL DEFAULT NULL, `question_type` varchar(10) NOT NULL DEFAULT 'closed', `question` text NOT NULL, `answer_a` text NOT NULL, `answer_b` text NOT NULL, `answer_c` text NOT NULL, `answer_d` text NOT NULL, `answer_open` text NULL, `correct_answer` tinyint unsigned NOT NULL DEFAULT 0, `image` varchar(1024) NOT NULL DEFAULT '', `published` tinyint NOT NULL DEFAULT 1, `ordering` int NOT NULL DEFAULT 0, `created` datetime NOT NULL, `created_by` int unsigned NOT NULL DEFAULT 0, `modified` datetime NULL DEFAULT NULL, `modified_by` int unsigned NOT NULL DEFAULT 0, PRIMARY KEY (`id`), KEY `idx_published` (`published`), KEY `idx_ordering` (`ordering`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci; CREATE TABLE IF NOT EXISTS `#__testquestions_categories` ( `id` int unsigned NOT NULL AUTO_INCREMENT, `title` varchar(150) NOT NULL, `published` tinyint NOT NULL DEFAULT 1, `ordering` int NOT NULL DEFAULT 0, PRIMARY KEY (`id`), UNIQUE KEY `idx_title` (`title`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci; INSERT IGNORE INTO `#__testquestions_categories` (`id`, `title`, `published`, `ordering`) VALUES (1, 'Bez kategorii', 1, 0); CREATE TABLE IF NOT EXISTS `#__testquestions_sets` ( `id` int unsigned NOT NULL AUTO_INCREMENT, `parent_id` int unsigned NOT NULL DEFAULT 0, `set_type` varchar(12) NOT NULL DEFAULT 'ordinary', `subject_id` int unsigned NOT NULL DEFAULT 0, `title` varchar(255) NOT NULL, `duration` smallint unsigned NOT NULL DEFAULT 0, `test_content` text NULL, `image` varchar(1024) NOT NULL DEFAULT '', `description` text NULL, `published` tinyint NOT NULL DEFAULT 1, `ordering` int NOT NULL DEFAULT 0, `created` datetime NULL DEFAULT NULL, `created_by` int unsigned NOT NULL DEFAULT 0, `modified` datetime NULL DEFAULT NULL, `modified_by` int unsigned NOT NULL DEFAULT 0, PRIMARY KEY (`id`), KEY `idx_published` (`published`), KEY `idx_parent_id` (`parent_id`), KEY `idx_ordering` (`ordering`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci; CREATE TABLE IF NOT EXISTS `#__testquestions_subjects` ( `id` int unsigned NOT NULL AUTO_INCREMENT, `title` varchar(150) NOT NULL, `published` tinyint NOT NULL DEFAULT 1, `ordering` int NOT NULL DEFAULT 0, PRIMARY KEY (`id`), UNIQUE KEY `idx_title` (`title`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci; CREATE TABLE IF NOT EXISTS `#__testquestions_set_questions` ( `set_id` int unsigned NOT NULL, `question_id` int unsigned NOT NULL, `ordering` int NOT NULL DEFAULT 0, PRIMARY KEY (`set_id`, `question_id`), KEY `idx_question_id` (`question_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci; CREATE TABLE IF NOT EXISTS `#__testquestions_results` ( `id` int unsigned NOT NULL AUTO_INCREMENT, `set_id` int unsigned NOT NULL, `participant_name` varchar(255) NOT NULL DEFAULT '', `started` datetime NULL DEFAULT NULL, `execution_time` int unsigned NOT NULL DEFAULT 0, `extra_time` smallint unsigned NOT NULL DEFAULT 0, `correct_count` smallint unsigned NOT NULL DEFAULT 0, `total_count` smallint unsigned NOT NULL DEFAULT 0, `percentage` decimal(5,2) NOT NULL DEFAULT 0.00, `points_total` int unsigned NOT NULL DEFAULT 0, `points_before` int unsigned NOT NULL DEFAULT 0, `points_after` int unsigned NOT NULL DEFAULT 0, `answers` longtext NULL, `created` datetime NOT NULL, `created_by` int unsigned NOT NULL DEFAULT 0, PRIMARY KEY (`id`), KEY `idx_set_id` (`set_id`), KEY `idx_created` (`created`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;