CREATE TABLE IF NOT EXISTS `rq_grammars_worksheet_result` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `grammar_id` int(10) NOT NULL,
  `user_id` int(10) NOT NULL,
  `worksheet_page_number` int(10) NOT NULL,
  `worksheet_image` longtext NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE IF NOT EXISTS `rq_grammars_worksheet_result_status` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `grammars_id` int(10) NOT NULL,
  `user_id` int(10) NOT NULL,
  `worksheet_status` enum('','Started','Submitted') NOT NULL,
  `last_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

INSERT INTO `rq_resource_permissions` (`resource_permissions_id`, `resource_name`, `can_read`, `can_add`, `can_edit`, `can_delete`, `status`, `last_updated`) VALUES (NULL, 'grammars_worksheet', '3,1,2,4,5,6', '1,2,4', '1,2,4', '1,2,4', '1', '2018-10-06 00:00:00');

