CREATE TABLE `rta_payment_documents` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `transaction_id` bigint(20) UNSIGNED NOT NULL,
  `payment_id` int(11) DEFAULT NULL,
  `type` enum('GOV_SMS_IMAGE','GOV_RECEIPT_IMAGE','SERVICE_SMS_IMAGE','SERVICE_RECEIPT_IMAGE') NOT NULL,
  `receipt_number` varchar(191) NOT NULL,
  `receipt_attachment` longtext NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


ALTER TABLE `rta_payment_documents`
  ADD PRIMARY KEY (`id`);

ALTER TABLE `rta_payment_documents`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
COMMIT;

CREATE TABLE `rta_payment_method` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(45) NOT NULL,
  `ussd_code` varchar(255) DEFAULT NULL,
  `created_by` int(10) UNSIGNED NOT NULL,
  `updated_by` int(10) UNSIGNED DEFAULT NULL,
  `deleted_by` int(10) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

ALTER TABLE `rta_payment_method`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `payment_method_name_unique` (`name`);

ALTER TABLE `rta_payment_method`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
COMMIT;

ALTER TABLE `rta_users` ADD `account_number` VARCHAR(255) NULL DEFAULT NULL AFTER `status`;

CREATE TABLE `moc_company_type` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(45) NOT NULL,
  `created_by` int(10) UNSIGNED NOT NULL,
  `updated_by` int(10) UNSIGNED DEFAULT NULL,
  `deleted_by` int(10) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


ALTER TABLE `moc_company_type`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `company_type_name_unique` (`name`);

ALTER TABLE `moc_company_type`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
COMMIT;


CREATE TABLE `moc_report_view` (
  `mb_party_id` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
  `id` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
  `customername` varchar(120) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `status` varchar(128) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `tin` varchar(120) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  `mobileno` varchar(91) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  `businessclass` varchar(45) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `industry` varchar(1024) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `organizationtype` varchar(45) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `licenseissuingagency` varchar(1024) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  `moclicensetype` varchar(45) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `licenseregistrationdate` date DEFAULT NULL,
  `licenseexpirationdate` date DEFAULT NULL,
  `businessdistrict` varchar(45) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  `party_id` bigint(20) UNSIGNED NOT NULL,
  `invoice_id` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
  `totalfee` decimal(10,2) NOT NULL DEFAULT 0.00,
  `govfee` decimal(10,2) DEFAULT NULL,
  `servicefee` decimal(10,2) DEFAULT NULL,
  `paymentdate` date DEFAULT NULL,
  `servicelocation` varchar(45) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  `paymentstatus` varchar(191) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT 'UNPAID',
  `count` int(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
