63 lines
2.5 KiB
SQL
63 lines
2.5 KiB
SQL
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,
|
|
`title` varchar(255) NOT NULL,
|
|
`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_ordering` (`ordering`)
|
|
) 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;
|