CREATE TABLE `cronjob` (
  `cronjob_id` int NOT NULL AUTO_INCREMENT,
  `last_execution` datetime NOT NULL,
  `processing` tinyint(1) NOT NULL,
  `error` json DEFAULT NULL,
  PRIMARY KEY (`cronjob_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `document_category` (
  `document_category_id` int NOT NULL AUTO_INCREMENT,
  `category_type` varchar(6) COLLATE utf8mb4_unicode_ci NOT NULL,
  `position` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
  `category_name_en` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `category_name_afr` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `hidden` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`document_category_id`),
  UNIQUE KEY `document_category_id_UNIQUE` (`document_category_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `document_upload` (
  `document_upload_id` int NOT NULL AUTO_INCREMENT,
  `user_group_id` int NOT NULL,
  `user_id` int NOT NULL,
  `document_category_id` int NOT NULL,
  `originalname` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `mimetype` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `size` bigint NOT NULL,
  `uuid` varchar(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`document_upload_id`),
  UNIQUE KEY `document_upload_id_UNIQUE` (`document_upload_id`),
  UNIQUE KEY `uuid_UNIQUE` (`uuid`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `email` (
  `email_id` int NOT NULL AUTO_INCREMENT,
  `created_date` datetime NOT NULL,
  `payload` json NOT NULL COMMENT '{\n  to: string  | array = one or more email addresses,\n  cc: string  | array = one or more email addresses,\n  bcc: string  | array = one or more email addresses,\n  template: string = the email template to use,\n  data: object = variables that are injected into the email template\n}\n  ',
  `meta` json NOT NULL,
  `processed` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`email_id`),
  UNIQUE KEY `id` (`email_id`),
  KEY `getUnprocessedEmails` (`processed`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `user_password` (
  `user_password_id` int NOT NULL AUTO_INCREMENT,
  `password` varchar(97) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `user_id` int NOT NULL,
  `created_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `forced_password_update` tinyint(1) NOT NULL DEFAULT '0',
  `forced_password_update_date` datetime DEFAULT NULL,
  PRIMARY KEY (`user_password_id`),
  UNIQUE KEY `user_password_id_UNIQUE` (`user_password_id`),
  UNIQUE KEY `user_id_UNIQUE` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `user_refresh_token` (
  `user_refresh_token_id` int NOT NULL AUTO_INCREMENT,
  `refresh_token` varchar(97) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `user_id` int NOT NULL,
  `updated_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`user_refresh_token_id`),
  UNIQUE KEY `user_id_UNIQUE` (`user_id`),
  UNIQUE KEY `user_refresh_token_id_UNIQUE` (`user_refresh_token_id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `user_registration_token` (
  `user_registration_token_id` int NOT NULL AUTO_INCREMENT,
  `registration_token` varchar(97) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `user_id` int NOT NULL,
  `created_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`user_registration_token_id`),
  UNIQUE KEY `user_registration_token_id_UNIQUE` (`user_registration_token_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `user_reset_token` (
  `user_reset_token_id` int NOT NULL AUTO_INCREMENT,
  `reset_token` varchar(97) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `user_id` int NOT NULL,
  `created_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`user_reset_token_id`),
  UNIQUE KEY `user_reset_token_id_UNIQUE` (`user_reset_token_id`),
  UNIQUE KEY `user_id_UNIQUE` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- CREATE TABLE `user_selected_group` (
--   `user_selected_group_id` int NOT NULL AUTO_INCREMENT,
--   `user_id` int NOT NULL,
--   `user_group_id` int DEFAULT NULL,
--   PRIMARY KEY (`user_selected_group_id`),
--   UNIQUE KEY `user_id_UNIQUE` (`user_id`),
--   UNIQUE KEY `user_selected_group_id_UNIQUE` (`user_selected_group_id`)
-- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

In cronjob:

'1', '2023-06-04 22:13:55', '0', NULL

In document_category:

'1', 'Farm', '1.', 'IPW training certificate', 'IPW opleidingsertifikaat', '0'
'2', 'Farm', '2.', 'Environment management plan, water registrations, energy usage records, Waste disposal/recycling records', 'Omgewingsbestuursplan: water registrasie, energie verbruik, vullis verwydering, herwinnings dokumentasie', '0'
'3', 'Farm', '7.', 'Herbicide spray records', 'Spuit rekords onkruiddoders (Opsioneel)', '0'
'4', 'Farm', '8.', 'Fertiziler application records and soil analyses records', 'Bemestingsrekords en grond ontledings', '0'
'5', 'Farm', '9.', 'Irrigation and scheduling records', 'Besproeiing en skedulerings rekords', '0'
'6', 'Farm', '13.', 'Records of pest monitoring', 'Rekords plae monitering', '0'
'7', 'Farm', '14.3.', 'Proof of medical records and blood tests', 'Bewyse van mediese rekords en bloedtoetse', '0'
'8', 'Farm', '14.4.', 'Training certificate of spray operators and First aid training', 'Opleidingsertifikaat van spuitoperateurs en Eerstehulp bewyse', '0'
'9', 'Farm', '14.6.', 'Records of disposal of empty agro-chemical containers', 'Rekords vir die verwydering van leë chemiese houers', '0'
'19', 'Cellar', '1.', 'IPW training certificate', 'IPW opleidingsertifikaat', '0'
'20', 'Cellar', '2.1.1.', 'Zoning certificate (Agriculture II)', 'Soneringsertifikaat  (Landbou II)', '0'
'21', 'Cellar', '2.1.2.', 'Food Premises Certificate (R.638 Certificate)', 'Voedselperseelsertifikaat  (R.638 sertifikaat)', '0'
'22', 'Cellar', '2.1.3.', 'Incoming water: proof of registration of water used in the winery', 'Inkomende water: bewys van registrasie', '0'
'23', 'Cellar', '2.1.4.', 'Incoming water used in the winery: drinking water analysis (SANS241 analysis)', 'Inkomende water in kelder: SANS241 analise', '0'
'24', 'Cellar', '4.1.', 'Carbon calculator report', 'Carbon calculator verslag', '0'
'25', 'Cellar', '4.2.', 'Energy management plan', 'Energie bestuurs plan', '0'
'26', 'Cellar', '6.', 'SO2 report from IPW website (otional)', 'SO2 opsomming vanaf IPW webblad (Opsioneel)', '0'
'27', 'Cellar', '7.1.1.', 'Non-GMO certificates', 'Non-GMO sertifikate', '0'
'28', 'Cellar', '9.1.', 'Monitoring records of wastewater quantity', 'Waterverbruik rekords', '0'
'29', 'Cellar', '9.2.', 'Wastewater analyses', 'Afvalwateranalises', '0'
'30', 'Cellar', '9.3.1.', 'Water quality management report (WQMR)', 'Water kwaliteits bestuur verslag', '0'
'31', 'Cellar', '9.3.2.', 'Soil analyses', 'Grond analises', '0'
'32', 'Cellar', '9.4.1.', 'GA (General Authorisation) documents', 'Algemene magtiging', '0'
'33', 'Cellar', '9.4.2.', 'Waste Discharge Registration System (WDCS)', 'Waterverbruik Registrasievorms (WDCS)', '0'
'34', 'Cellar', '10.', 'Cleaning agents: COA/MSDS records', 'Skoonmaakmiddels: COA/MSDS rekords', '0'
'35', 'Cellar', '12.', 'Ambient noise report / plan', 'Omgewingsgeraasverslag', '0'
'36', 'Cellar', '13.', 'Summary of all packing materials used', 'Verpakkings material opsomming', '0'
'37', 'Cellar', '14.', 'Glass breakage procedure and records. General safety and jewellery procedure', 'Glasbreek prosedure en rekords. Algemene veiligheid en juweliersware prosedure', '0'

In rbac_roles:

'18', 'Document Uploads', 'This member is able to upload and view uploaded documents for the groups that they are assigned to.', '10', '2'
