-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Sep 13, 2026 at 10:59 PM
-- Server version: 10.4.32-MariaDB
-- PHP Version: 8.2.12

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `ncu_db`
--

-- --------------------------------------------------------

--
-- Table structure for table `approvals`
--

CREATE TABLE `approvals` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `approvable_type` varchar(255) NOT NULL,
  `approvable_id` bigint(20) UNSIGNED NOT NULL,
  `level` bigint(20) UNSIGNED NOT NULL DEFAULT 1,
  `status` varchar(255) NOT NULL DEFAULT 'pending',
  `approved_by` bigint(20) UNSIGNED DEFAULT NULL,
  `approved_at` timestamp NULL DEFAULT NULL,
  `rejected_by` bigint(20) UNSIGNED DEFAULT NULL,
  `rejected_at` timestamp NULL DEFAULT NULL,
  `remarks` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `banks`
--

CREATE TABLE `banks` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `account_number` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `banks`
--

INSERT INTO `banks` (`id`, `name`, `account_number`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'NMB', '8998891', '2026-09-10 13:52:14', '2026-09-10 13:52:14', NULL);

-- --------------------------------------------------------

--
-- Table structure for table `bookings`
--

CREATE TABLE `bookings` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `phone` varchar(255) NOT NULL,
  `dates` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`dates`)),
  `payment_type` enum('half','full') NOT NULL,
  `status` enum('active','inactive') NOT NULL DEFAULT 'active',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `hall_id` bigint(20) UNSIGNED NOT NULL,
  `booking_event_id` bigint(20) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `bookings`
--

INSERT INTO `bookings` (`id`, `name`, `phone`, `dates`, `payment_type`, `status`, `created_at`, `updated_at`, `deleted_at`, `hall_id`, `booking_event_id`) VALUES
(43, 'RAPHAEL JUMA', '0625200214', '[\"2026-09-16\"]', 'full', 'active', '2026-09-13 20:48:06', '2026-09-13 20:58:08', NULL, 4, 2);

-- --------------------------------------------------------

--
-- Table structure for table `booking_events`
--

CREATE TABLE `booking_events` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `event_name` varchar(255) NOT NULL,
  `from_time` time NOT NULL,
  `end_time` time NOT NULL,
  `hall_id` bigint(20) UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `booking_events`
--

INSERT INTO `booking_events` (`id`, `event_name`, `from_time`, `end_time`, `hall_id`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'weeding/harusi', '14:39:00', '14:41:00', 4, '2026-09-13 11:39:16', '2026-09-13 11:50:27', '2026-09-13 11:50:27'),
(2, 'VIKAO', '15:50:00', '15:57:00', 4, '2026-09-13 11:51:00', '2026-09-13 20:36:36', NULL),
(3, 'weeding/harusi', '14:53:00', '20:59:00', 5, '2026-09-13 11:53:21', '2026-09-13 20:35:08', NULL),
(4, 'maombi', '23:37:00', '23:43:00', 5, '2026-09-13 20:38:05', '2026-09-13 20:38:05', NULL);

-- --------------------------------------------------------

--
-- Table structure for table `booking_times`
--

CREATE TABLE `booking_times` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `expiry_type` enum('day','week','hour') NOT NULL DEFAULT 'day',
  `expiry_value` int(11) NOT NULL DEFAULT 1,
  `expires_at` datetime DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `booking_times`
--

INSERT INTO `booking_times` (`id`, `expiry_type`, `expiry_value`, `expires_at`, `created_at`, `updated_at`) VALUES
(1, 'hour', 1, '2026-09-11 17:55:26', '2026-09-07 10:03:54', '2026-09-11 13:55:26');

-- --------------------------------------------------------

--
-- Table structure for table `cache`
--

CREATE TABLE `cache` (
  `key` varchar(255) NOT NULL,
  `value` mediumtext NOT NULL,
  `expiration` bigint(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `cache_locks`
--

CREATE TABLE `cache_locks` (
  `key` varchar(255) NOT NULL,
  `owner` varchar(255) NOT NULL,
  `expiration` bigint(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `contracts`
--

CREATE TABLE `contracts` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `tenant_id` bigint(20) UNSIGNED NOT NULL,
  `ternant_unit_id` bigint(20) UNSIGNED NOT NULL,
  `start_date` date NOT NULL,
  `end_date` date NOT NULL,
  `amount_per_month` decimal(12,2) DEFAULT NULL,
  `amount_per_year` decimal(12,2) DEFAULT NULL,
  `vat_inclusive` decimal(12,2) DEFAULT NULL,
  `amount_after_vat` decimal(12,2) DEFAULT NULL,
  `status` varchar(255) NOT NULL DEFAULT 'INCOMPLETE',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `departments`
--

CREATE TABLE `departments` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `head_user_id` bigint(20) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `departments`
--

INSERT INTO `departments` (`id`, `name`, `description`, `created_at`, `updated_at`, `deleted_at`, `head_user_id`) VALUES
(1, 'ICT DEPARTMENT', 'ICT', '2026-08-12 08:19:27', '2026-08-07 08:19:33', '2026-08-01 08:19:38', 1),
(2, 'KITENGO CHA TEHAMA', 'Handles all information and communication technology services including system administration, networking, and software development.', '2026-09-08 12:23:56', '2026-09-08 12:23:56', NULL, 1),
(3, 'IDARA YA FEDHA NA UTAWALA', 'FINANCIAL MANAGEMENT', '2026-09-11 09:34:11', '2026-09-11 09:34:11', NULL, 1);

-- --------------------------------------------------------

--
-- Table structure for table `executions`
--

CREATE TABLE `executions` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `task_id` bigint(20) UNSIGNED NOT NULL,
  `description` text DEFAULT NULL,
  `attachment` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `executions`
--

INSERT INTO `executions` (`id`, `task_id`, `description`, `attachment`, `created_at`, `updated_at`) VALUES
(1, 2, 'ttttt', 'executions/1788127084_Barua A TO Z Appreciation.pdf', '2026-08-30 21:58:04', '2026-08-30 21:58:04');

-- --------------------------------------------------------

--
-- Table structure for table `halls`
--

CREATE TABLE `halls` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `amount_per_day` decimal(15,2) NOT NULL,
  `location` varchar(255) DEFAULT NULL,
  `capacity` int(10) UNSIGNED NOT NULL,
  `image1` varchar(255) DEFAULT NULL,
  `image2` varchar(255) DEFAULT NULL,
  `image3` varchar(255) DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `halls`
--

INSERT INTO `halls` (`id`, `name`, `description`, `amount_per_day`, `location`, `capacity`, `image1`, `image2`, `image3`, `is_active`, `created_at`, `updated_at`, `deleted_at`) VALUES
(4, 'MABENGA HALL(UKUMBI MDOGO)', 'ukumbi mdogo', 100000.00, 'ncu hq', 67, 'images/halls/1787990379_ukumbi1.png', 'images/halls/1787990379_ukumbi1.png', 'images/halls/1787990379_ukumbi1.png', 1, '2026-08-28 06:11:02', '2026-09-13 11:42:38', NULL),
(5, 'BOMANI HALL(UKUMBI MKUBWA)', 'ukumbi huu una uwezo  wa kuchukua watu wengi na unafaa zaidi kwenye sherehe za harusi,kitchen part na mikutano mikubwa \r\nutapata huduma  za genereta\r\nkaribu sana', 550000.00, 'ncu hq', 500, 'images/halls/1787990450_ukumbi2.png', 'images/halls/1787990450_ukumbi3.png', 'images/halls/1787990450_ukumbi3.png', 1, '2026-08-28 09:37:24', '2026-09-13 11:42:54', NULL);

-- --------------------------------------------------------

--
-- Table structure for table `invoices`
--

CREATE TABLE `invoices` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `hall_id` bigint(20) UNSIGNED NOT NULL,
  `invoice_number` varchar(255) NOT NULL,
  `booking_id` bigint(20) UNSIGNED NOT NULL,
  `amount` decimal(15,2) NOT NULL,
  `status` enum('unpaid','partially_paid','paid','cancelled') NOT NULL DEFAULT 'unpaid',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `invoices`
--

INSERT INTO `invoices` (`id`, `hall_id`, `invoice_number`, `booking_id`, `amount`, `status`, `created_at`, `updated_at`, `deleted_at`) VALUES
(44, 4, 'INV-1789332486', 43, 100000.00, 'paid', '2026-09-13 20:48:06', '2026-09-13 20:50:12', NULL);

-- --------------------------------------------------------

--
-- Table structure for table `locations`
--

CREATE TABLE `locations` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `locations`
--

INSERT INTO `locations` (`id`, `name`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'KENYATTA ROAD', '2026-09-04 14:05:50', '2026-09-10 14:17:28', NULL);

-- --------------------------------------------------------

--
-- Table structure for table `majengos`
--

CREATE TABLE `majengos` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `location_id` bigint(20) UNSIGNED NOT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `majengos`
--

INSERT INTO `majengos` (`id`, `name`, `description`, `location_id`, `deleted_at`, `created_at`, `updated_at`) VALUES
(1, 'KAUMA', 'KAUMA', 1, NULL, '2026-09-10 14:54:04', '2026-09-10 14:54:04');

-- --------------------------------------------------------

--
-- Table structure for table `message_logs`
--

CREATE TABLE `message_logs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `message` text NOT NULL,
  `role_name` varchar(255) DEFAULT NULL,
  `recipients` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`recipients`)),
  `status` tinyint(1) NOT NULL DEFAULT 0,
  `api_response` longtext DEFAULT NULL,
  `sent_by` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `message_logs`
--

INSERT INTO `message_logs` (`id`, `message`, `role_name`, `recipients`, `status`, `api_response`, `sent_by`, `created_at`, `updated_at`) VALUES
(1, 'Your NCU reset code is: 242189', 'Auth Flow', '[\"255625200214\"]', 1, '{\"successful\":true,\"request_id\":74495767,\"code\":100,\"message\":\"Message Submitted Successfully\",\"valid\":1,\"invalid\":0,\"duplicates\":0}', NULL, '2026-09-09 19:01:03', '2026-09-09 19:01:03'),
(2, 'Your NCU reset code is: 220568', 'Auth Flow', '[\"255625200214\"]', 1, '{\"successful\":true,\"request_id\":74495788,\"code\":100,\"message\":\"Message Submitted Successfully\",\"valid\":1,\"invalid\":0,\"duplicates\":0}', NULL, '2026-09-09 19:02:23', '2026-09-09 19:02:23'),
(3, 'Your NCU login code is: 415204', 'Auth Flow', '[\"255625200214\"]', 1, '{\"successful\":true,\"request_id\":74495873,\"code\":100,\"message\":\"Message Submitted Successfully\",\"valid\":1,\"invalid\":0,\"duplicates\":0}', 1, '2026-09-09 19:06:48', '2026-09-09 19:06:48'),
(4, 'Your NCU login code is: 655763', 'Auth Flow', '[\"255625200214\"]', 1, '{\"successful\":true,\"request_id\":74495934,\"code\":100,\"message\":\"Message Submitted Successfully\",\"valid\":1,\"invalid\":0,\"duplicates\":0}', 1, '2026-09-09 19:09:38', '2026-09-09 19:09:38'),
(5, 'Your NCU login code is: 965228', 'Auth Flow', '[\"255744111991\"]', 1, '{\"successful\":true,\"request_id\":74495964,\"code\":100,\"message\":\"Message Submitted Successfully\",\"valid\":1,\"invalid\":0,\"duplicates\":0}', 1, '2026-09-09 19:10:58', '2026-09-09 19:10:58'),
(6, 'Your NCU login code is: 631315', 'Auth Flow', '[\"255744111991\"]', 1, '{\"successful\":true,\"request_id\":74496065,\"code\":100,\"message\":\"Message Submitted Successfully\",\"valid\":1,\"invalid\":0,\"duplicates\":0}', 1, '2026-09-09 19:15:43', '2026-09-09 19:15:43'),
(7, 'Your NCU reset code is: 525319', 'Auth Flow', '[\"255625200214\"]', 1, '{\"successful\":true,\"request_id\":74496382,\"code\":100,\"message\":\"Message Submitted Successfully\",\"valid\":1,\"invalid\":0,\"duplicates\":0}', NULL, '2026-09-09 19:29:52', '2026-09-09 19:29:52'),
(8, 'Your NCU login code is: 577368', 'Auth Flow', '[\"255625200214\"]', 1, '{\"successful\":true,\"request_id\":74496387,\"code\":100,\"message\":\"Message Submitted Successfully\",\"valid\":1,\"invalid\":0,\"duplicates\":0}', 1, '2026-09-09 19:30:25', '2026-09-09 19:30:25'),
(9, 'Your NCU login code is: 477352', 'Auth Flow', '[\"255625200214\"]', 1, '{\"successful\":true,\"request_id\":74513243,\"code\":100,\"message\":\"Message Submitted Successfully\",\"valid\":1,\"invalid\":0,\"duplicates\":0}', 1, '2026-09-10 07:59:19', '2026-09-10 07:59:19'),
(10, 'Your NCU login code is: 438261', 'Auth Flow', '[\"255625200214\"]', 1, '{\"successful\":true,\"request_id\":74534744,\"code\":100,\"message\":\"Message Submitted Successfully\",\"valid\":1,\"invalid\":0,\"duplicates\":0}', 1, '2026-09-10 12:41:22', '2026-09-10 12:41:22'),
(11, 'Your NCU login code is: 951631', 'Auth Flow', '[\"255625200214\"]', 1, '{\"successful\":true,\"request_id\":74544457,\"code\":100,\"message\":\"Message Submitted Successfully\",\"valid\":1,\"invalid\":0,\"duplicates\":0}', 1, '2026-09-10 15:13:10', '2026-09-10 15:13:10'),
(12, 'Your NCU login code is: 460313', 'Auth Flow', '[\"255625200214\"]', 1, '{\"successful\":true,\"request_id\":74564025,\"code\":100,\"message\":\"Message Submitted Successfully\",\"valid\":1,\"invalid\":0,\"duplicates\":0}', 1, '2026-09-11 04:08:08', '2026-09-11 04:08:08'),
(13, 'Your NCU login code is: 101259', 'Auth Flow', '[\"255625200214\"]', 1, '{\"successful\":true,\"request_id\":74571240,\"code\":100,\"message\":\"Message Submitted Successfully\",\"valid\":1,\"invalid\":0,\"duplicates\":0}', 1, '2026-09-11 06:58:20', '2026-09-11 06:58:20'),
(14, 'Your NCU login code is: 853583', 'Auth Flow', '[\"255625200214\"]', 1, '{\"successful\":true,\"request_id\":74576306,\"code\":100,\"message\":\"Message Submitted Successfully\",\"valid\":1,\"invalid\":0,\"duplicates\":0}', 1, '2026-09-11 07:39:20', '2026-09-11 07:39:20'),
(15, 'Your NCU reset code is: 725635', 'Auth Flow', '[\"255658381644\"]', 1, '{\"successful\":true,\"request_id\":74593528,\"code\":100,\"message\":\"Message Submitted Successfully\",\"valid\":1,\"invalid\":0,\"duplicates\":0}', NULL, '2026-09-11 11:37:52', '2026-09-11 11:37:52'),
(16, 'Your NCU reset code is: 550532', 'Auth Flow', '[\"255658381644\"]', 1, '{\"successful\":true,\"request_id\":74593611,\"code\":100,\"message\":\"Message Submitted Successfully\",\"valid\":1,\"invalid\":0,\"duplicates\":0}', NULL, '2026-09-11 11:39:00', '2026-09-11 11:39:00'),
(17, 'Your NCU reset code is: 689988', 'Auth Flow', '[\"255658381644\"]', 1, '{\"successful\":true,\"request_id\":74594120,\"code\":100,\"message\":\"Message Submitted Successfully\",\"valid\":1,\"invalid\":0,\"duplicates\":0}', NULL, '2026-09-11 11:44:45', '2026-09-11 11:44:45'),
(18, 'Your NCU login code is: 226030', 'Auth Flow', '[\"255658381644\"]', 1, '{\"successful\":true,\"request_id\":74595295,\"code\":100,\"message\":\"Message Submitted Successfully\",\"valid\":1,\"invalid\":0,\"duplicates\":0}', 2, '2026-09-11 11:52:16', '2026-09-11 11:52:16'),
(19, 'Your NCU login code is: 725019', 'Auth Flow', '[\"255625200214\"]', 1, '{\"successful\":true,\"request_id\":74595343,\"code\":100,\"message\":\"Message Submitted Successfully\",\"valid\":1,\"invalid\":0,\"duplicates\":0}', 1, '2026-09-11 11:53:14', '2026-09-11 11:53:14'),
(20, 'Your NCU login code is: 639484', 'Auth Flow', '[\"255625200214\"]', 1, '{\"successful\":true,\"request_id\":74604275,\"code\":100,\"message\":\"Message Submitted Successfully\",\"valid\":1,\"invalid\":0,\"duplicates\":0}', 1, '2026-09-11 13:45:44', '2026-09-11 13:45:44'),
(21, 'Your NCU login code is: 999599', 'Auth Flow', '[\"255625200214\"]', 0, 'cURL error 6: Could not resolve host: apisms.beem.africa (see https://curl.se/libcurl/c/libcurl-errors.html) for https://apisms.beem.africa/v1/send', 1, '2026-09-13 11:22:22', '2026-09-13 11:22:22'),
(22, 'Your NCU login code is: 782353', 'Auth Flow', '[\"255625200214\"]', 1, '{\"successful\":true,\"request_id\":74703515,\"code\":100,\"message\":\"Message Submitted Successfully\",\"valid\":1,\"invalid\":0,\"duplicates\":0}', 1, '2026-09-13 11:25:20', '2026-09-13 11:25:20'),
(23, 'Your NCU login code is: 850689', 'Auth Flow', '[\"255625200214\"]', 0, 'cURL error 6: Could not resolve host: apisms.beem.africa (see https://curl.se/libcurl/c/libcurl-errors.html) for https://apisms.beem.africa/v1/send', 1, '2026-09-13 19:55:09', '2026-09-13 19:55:09'),
(24, 'Your NCU login code is: 402785', 'Auth Flow', '[\"255625200214\"]', 1, '{\"successful\":true,\"request_id\":74727336,\"code\":100,\"message\":\"Message Submitted Successfully\",\"valid\":1,\"invalid\":0,\"duplicates\":0}', 1, '2026-09-13 19:59:21', '2026-09-13 19:59:21'),
(25, 'Your NCU reset code is: 441512', 'Auth Flow', '[\"255625200214\"]', 1, '{\"successful\":true,\"request_id\":74727359,\"code\":100,\"message\":\"Message Submitted Successfully\",\"valid\":1,\"invalid\":0,\"duplicates\":0}', NULL, '2026-09-13 20:00:49', '2026-09-13 20:00:49'),
(26, 'Your NCU login code is: 331035', 'Auth Flow', '[\"255625200214\"]', 1, '{\"successful\":true,\"request_id\":74727390,\"code\":100,\"message\":\"Message Submitted Successfully\",\"valid\":1,\"invalid\":0,\"duplicates\":0}', 1, '2026-09-13 20:02:52', '2026-09-13 20:02:52'),
(27, 'Your NCU reset code is: 771168', 'Auth Flow', '[\"255625200214\"]', 1, '{\"successful\":true,\"request_id\":74727425,\"code\":100,\"message\":\"Message Submitted Successfully\",\"valid\":1,\"invalid\":0,\"duplicates\":0}', NULL, '2026-09-13 20:04:53', '2026-09-13 20:04:53'),
(28, 'Your NCU reset code is: 222897', 'Auth Flow', '[\"255625200214\"]', 1, '{\"successful\":true,\"request_id\":74727556,\"code\":100,\"message\":\"Message Submitted Successfully\",\"valid\":1,\"invalid\":0,\"duplicates\":0}', NULL, '2026-09-13 20:16:27', '2026-09-13 20:16:27'),
(29, 'Your NCU login code is: 858758', 'Auth Flow', '[\"255625200214\"]', 1, '{\"successful\":true,\"request_id\":74727557,\"code\":100,\"message\":\"Message Submitted Successfully\",\"valid\":1,\"invalid\":0,\"duplicates\":0}', 1, '2026-09-13 20:16:38', '2026-09-13 20:16:38'),
(30, 'Your NCU login code is: 939819', 'Auth Flow', '[\"255625200214\"]', 1, '{\"successful\":true,\"request_id\":74727562,\"code\":100,\"message\":\"Message Submitted Successfully\",\"valid\":1,\"invalid\":0,\"duplicates\":0}', 1, '2026-09-13 20:17:06', '2026-09-13 20:17:06');

-- --------------------------------------------------------

--
-- Table structure for table `migrations`
--

CREATE TABLE `migrations` (
  `id` int(10) UNSIGNED NOT NULL,
  `migration` varchar(255) NOT NULL,
  `batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `migrations`
--

INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '2026_08_20_182014_create_roles_table', 1),
(2, '2026_08_20_182015_create_permissions_table', 1),
(3, '2026_08_20_182016_create_departments_table', 1),
(4, '2026_08_20_182016_create_users_table', 1),
(5, '2026_08_20_182017_create_units_table', 1),
(6, '2026_08_20_182018_create_task_comments_table', 1),
(7, '2026_08_20_182018_create_tasks_table', 1),
(8, '2026_08_20_182019_create_bookings_table', 1),
(9, '2026_08_20_182019_create_halls_table', 1),
(10, '2026_08_20_182020_create_invoices_table', 1),
(11, '2026_08_20_182020_create_payments_table', 1),
(12, '2026_08_20_182042_create_permission_role_table', 1),
(13, '2026_08_20_182256_add_head_user_id_to_departments_table', 1),
(14, '2026_08_20_183236_add_unit_fields_to_users_table', 1),
(15, '2026_08_20_183649_add_parent_task_to_tasks_table', 1),
(16, '2026_08_20_183855_add_hall_id_to_bookings_table', 1),
(17, '2026_08_21_210613_create_sessions_table', 1),
(18, '2026_08_22_151752_create_approvals_table', 1),
(19, '2026_08_22_163151_add_status_to_approvals', 1),
(20, '2026_08_22_224822_create_task_user_table', 1),
(21, '2026_08_22_225353_drop_assigned_to_from_tasks_table', 1),
(22, '2026_08_22_232425_create_executions_table', 1),
(23, '2026_08_23_003732_create_workplans_table', 1),
(24, '2026_08_28_084059_remove_maximum_people_per_event_from_halls_table', 2),
(25, '2026_08_29_171156_update_bookings_table_for_modal', 3),
(26, '2026_08_29_184946_add_status_to_bookings_table', 4),
(27, '2026_09_03_120700_create_permissions_table', 5),
(28, '2026_09_03_171338_create_cache_table', 6),
(29, '2026_09_03_173135_create_permission_tables', 7),
(30, '2026_09_03_173409_add_deleted_at_to_permissions_table', 8),
(31, '2026_09_03_173510_add_deleted_at_to_roles_table', 9),
(32, '2026_09_03_173625_add_description_to_roles_table', 10),
(33, '2026_09_04_150743_create_tenants_table', 11),
(37, '2026_09_04_155647_create_tenants_table', 12),
(38, '2026_09_04_155648_create_ternant_units_table', 12),
(39, '2026_09_04_155649_create_contracts_table', 12),
(40, '2026_09_04_155650_create_locations_table', 12),
(41, '2026_09_04_155650_create_ternant_payments_table', 12),
(42, '2026_09_04_161927_add_location_id_to_ternant_units_table', 13),
(43, '2026_09_07_124523_create_booking_times_table', 14),
(44, '2026_09_09_114403_add_phone_to_users_table', 15),
(45, '2026_09_09_215943_create_message_logs_table', 16),
(46, '2026_09_10_153422_create_banks_table', 17),
(47, '2026_09_10_161208_add_deleted_at_to_banks_table', 18),
(48, '2026_09_10_172703_create_majengos_table', 19),
(49, '2026_09_10_180418_add_majengo_id_to_ternant_units_table', 20),
(50, '2026_09_13_135126_create_booking_events_table', 21),
(51, '2026_09_13_153815_add_booking_event_id_to_bookings_table', 22);

-- --------------------------------------------------------

--
-- Table structure for table `model_has_permissions`
--

CREATE TABLE `model_has_permissions` (
  `permission_id` bigint(20) UNSIGNED NOT NULL,
  `model_type` varchar(255) NOT NULL,
  `model_id` bigint(20) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `model_has_roles`
--

CREATE TABLE `model_has_roles` (
  `role_id` bigint(20) UNSIGNED NOT NULL,
  `model_type` varchar(255) NOT NULL,
  `model_id` bigint(20) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `model_has_roles`
--

INSERT INTO `model_has_roles` (`role_id`, `model_type`, `model_id`) VALUES
(1, 'App\\Models\\User', 1),
(2, 'App\\Models\\User', 2);

-- --------------------------------------------------------

--
-- Table structure for table `payments`
--

CREATE TABLE `payments` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `invoice_id` bigint(20) UNSIGNED NOT NULL,
  `booking_id` bigint(20) UNSIGNED NOT NULL,
  `checked_by` bigint(20) UNSIGNED DEFAULT NULL,
  `amount_paid` decimal(15,2) NOT NULL,
  `receipt` varchar(255) DEFAULT NULL,
  `status` enum('pending','approved','rejected') NOT NULL DEFAULT 'pending',
  `remarks` text DEFAULT NULL,
  `checked_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `payments`
--

INSERT INTO `payments` (`id`, `invoice_id`, `booking_id`, `checked_by`, `amount_paid`, `receipt`, `status`, `remarks`, `checked_at`, `created_at`, `updated_at`, `deleted_at`) VALUES
(15, 44, 43, NULL, 100000.00, 'receipts/1789332612_All risiti za pamba.pdf', 'approved', NULL, NULL, '2026-09-13 20:50:12', '2026-09-13 20:50:12', NULL);

-- --------------------------------------------------------

--
-- Table structure for table `permissions`
--

CREATE TABLE `permissions` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `guard_name` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `permissions`
--

INSERT INTO `permissions` (`id`, `name`, `guard_name`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'view.role', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(2, 'create.role', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(3, 'edit.role', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(4, 'delete.role', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(5, 'view.permission', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(6, 'create.permission', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(7, 'edit.permission', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(8, 'delete.permission', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(9, 'view.user', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(10, 'create.user', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(11, 'edit.user', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(12, 'delete.user', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(13, 'view.department', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(14, 'create.department', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(15, 'edit.department', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(16, 'delete.department', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(17, 'view.task', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(18, 'create.task', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(19, 'edit.task', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(20, 'delete.task', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(21, 'view.hall', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(22, 'create.hall', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(23, 'edit.hall', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(24, 'delete.hall', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(25, 'view.invoice', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(26, 'create.invoice', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(27, 'edit.invoice', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(28, 'delete.invoice', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(29, 'view.booking', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(30, 'create.booking', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(31, 'edit.booking', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(32, 'delete.booking', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(33, 'view.payment', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(34, 'create.payment', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(35, 'edit.payment', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(36, 'delete.payment', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(37, 'view.unit', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(38, 'create.unit', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(39, 'edit.unit', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(40, 'delete.unit', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(41, 'view.approval', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(42, 'create.approval', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(43, 'edit.approval', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(44, 'delete.approval', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(45, 'view.execution', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(46, 'create.execution', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(47, 'edit.execution', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(48, 'delete.execution', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(49, 'view.workplan', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(50, 'create.workplan', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(51, 'edit.workplan', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(52, 'delete.workplan', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(53, 'view.dashboard', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL),
(54, 'view.bookingtime', 'web', '2026-09-08 12:29:18', '2026-09-08 12:29:18', NULL),
(55, 'create.bookingtime', 'web', '2026-09-08 12:29:18', '2026-09-08 12:29:18', NULL),
(56, 'edit.bookingtime', 'web', '2026-09-08 12:29:18', '2026-09-08 12:29:18', NULL),
(57, 'delete.bookingtime', 'web', '2026-09-08 12:29:18', '2026-09-08 12:29:18', NULL),
(58, 'restore.bookingtime', 'web', '2026-09-08 12:29:18', '2026-09-08 12:29:18', NULL),
(59, 'view.tenant', 'web', '2026-09-08 12:29:18', '2026-09-08 12:29:18', NULL),
(60, 'create.tenant', 'web', '2026-09-08 12:29:18', '2026-09-08 12:29:18', NULL),
(61, 'edit.tenant', 'web', '2026-09-08 12:29:18', '2026-09-08 12:29:18', NULL),
(62, 'delete.tenant', 'web', '2026-09-08 12:29:18', '2026-09-08 12:29:18', NULL),
(63, 'restore.tenant', 'web', '2026-09-08 12:29:18', '2026-09-08 12:29:18', NULL),
(64, 'view.tenantunit', 'web', '2026-09-08 12:29:18', '2026-09-08 12:29:18', NULL),
(65, 'create.tenantunit', 'web', '2026-09-08 12:29:18', '2026-09-08 12:29:18', NULL),
(66, 'edit.tenantunit', 'web', '2026-09-08 12:29:18', '2026-09-08 12:29:18', NULL),
(67, 'delete.tenantunit', 'web', '2026-09-08 12:29:18', '2026-09-08 12:29:18', NULL),
(68, 'restore.tenantunit', 'web', '2026-09-08 12:29:18', '2026-09-08 12:29:18', NULL),
(69, 'view.contract', 'web', '2026-09-08 12:29:18', '2026-09-08 12:29:18', NULL),
(70, 'create.contract', 'web', '2026-09-08 12:29:18', '2026-09-08 12:29:18', NULL),
(71, 'edit.contract', 'web', '2026-09-08 12:29:18', '2026-09-08 12:29:18', NULL),
(72, 'delete.contract', 'web', '2026-09-08 12:29:18', '2026-09-08 12:29:18', NULL),
(73, 'restore.contract', 'web', '2026-09-08 12:29:18', '2026-09-08 12:29:18', NULL),
(74, 'view.tenantpayment', 'web', '2026-09-08 12:29:18', '2026-09-08 12:29:18', NULL),
(75, 'create.tenantpayment', 'web', '2026-09-08 12:29:18', '2026-09-08 12:29:18', NULL),
(76, 'edit.tenantpayment', 'web', '2026-09-08 12:29:18', '2026-09-08 12:29:18', NULL),
(77, 'delete.tenantpayment', 'web', '2026-09-08 12:29:18', '2026-09-08 12:29:18', NULL),
(78, 'restore.tenantpayment', 'web', '2026-09-08 12:29:18', '2026-09-08 12:29:18', NULL),
(79, 'view.location', 'web', '2026-09-08 12:29:18', '2026-09-08 12:29:18', NULL),
(80, 'create.location', 'web', '2026-09-08 12:29:18', '2026-09-08 12:29:18', NULL),
(81, 'edit.location', 'web', '2026-09-08 12:29:18', '2026-09-08 12:29:18', NULL),
(82, 'delete.location', 'web', '2026-09-08 12:29:18', '2026-09-08 12:29:18', NULL),
(83, 'restore.location', 'web', '2026-09-08 12:29:18', '2026-09-08 12:29:18', NULL),
(84, 'view.banks', 'web', '2026-09-10 13:46:53', '2026-09-10 13:46:53', NULL),
(85, 'view.paymentreport', 'web', '2026-09-11 07:36:30', '2026-09-11 07:36:30', NULL),
(86, 'view.booking-event', 'web', '2026-09-13 11:34:06', '2026-09-13 11:34:06', NULL),
(87, 'create.booking-event', 'web', '2026-09-13 11:34:53', '2026-09-13 11:34:53', NULL),
(88, 'delete.booking-event', 'web', '2026-09-13 11:50:03', '2026-09-13 11:50:03', NULL);

-- --------------------------------------------------------

--
-- Table structure for table `roles`
--

CREATE TABLE `roles` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `guard_name` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `description` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `roles`
--

INSERT INTO `roles` (`id`, `name`, `guard_name`, `created_at`, `updated_at`, `deleted_at`, `description`) VALUES
(1, 'admin', 'web', '2026-09-03 14:42:49', '2026-09-03 14:54:32', NULL, 'admin'),
(2, 'accountant', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL, NULL),
(3, 'general manager', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL, NULL),
(4, 'hr', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL, NULL),
(5, 'other users', 'web', '2026-09-03 14:42:49', '2026-09-03 14:42:49', NULL, NULL);

-- --------------------------------------------------------

--
-- Table structure for table `role_has_permissions`
--

CREATE TABLE `role_has_permissions` (
  `permission_id` bigint(20) UNSIGNED NOT NULL,
  `role_id` bigint(20) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `role_has_permissions`
--

INSERT INTO `role_has_permissions` (`permission_id`, `role_id`) VALUES
(1, 1),
(1, 3),
(2, 1),
(3, 1),
(4, 1),
(5, 1),
(5, 3),
(6, 1),
(7, 1),
(8, 1),
(9, 1),
(9, 3),
(9, 4),
(10, 1),
(10, 4),
(11, 1),
(11, 4),
(12, 1),
(12, 4),
(13, 1),
(13, 3),
(13, 4),
(14, 1),
(14, 4),
(15, 1),
(15, 4),
(16, 1),
(16, 4),
(17, 1),
(17, 3),
(17, 5),
(18, 1),
(19, 1),
(20, 1),
(21, 1),
(21, 3),
(21, 5),
(22, 1),
(23, 1),
(23, 2),
(24, 1),
(25, 1),
(25, 2),
(25, 3),
(25, 5),
(26, 1),
(27, 1),
(28, 1),
(29, 1),
(29, 2),
(29, 3),
(29, 5),
(30, 1),
(31, 1),
(32, 1),
(33, 1),
(33, 2),
(33, 3),
(33, 5),
(34, 1),
(34, 2),
(35, 1),
(36, 1),
(36, 2),
(37, 1),
(37, 3),
(38, 1),
(39, 1),
(40, 1),
(41, 1),
(41, 3),
(42, 1),
(43, 1),
(44, 1),
(45, 1),
(45, 3),
(46, 1),
(47, 1),
(48, 1),
(49, 1),
(49, 3),
(50, 1),
(51, 1),
(52, 1),
(53, 1),
(53, 3),
(53, 5),
(54, 1),
(55, 1),
(56, 1),
(56, 2),
(57, 1),
(58, 1),
(59, 1),
(60, 1),
(61, 1),
(62, 1),
(63, 1),
(64, 1),
(65, 1),
(66, 1),
(67, 1),
(68, 1),
(69, 1),
(70, 1),
(71, 1),
(72, 1),
(73, 1),
(74, 1),
(75, 1),
(76, 1),
(77, 1),
(78, 1),
(79, 1),
(80, 1),
(81, 1),
(82, 1),
(83, 1),
(84, 1),
(85, 1),
(85, 2),
(86, 1),
(87, 1),
(88, 1);

-- --------------------------------------------------------

--
-- Table structure for table `sessions`
--

CREATE TABLE `sessions` (
  `id` varchar(255) NOT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `ip_address` varchar(45) DEFAULT NULL,
  `user_agent` text DEFAULT NULL,
  `payload` longtext NOT NULL,
  `last_activity` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `sessions`
--

INSERT INTO `sessions` (`id`, `user_id`, `ip_address`, `user_agent`, `payload`, `last_activity`) VALUES
('CxQiOuj3w8CCva6aCvn7QgNOaufIR7jt6aKnvlhS', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/152.0.0.0 Safari/537.36', 'YTo3OntzOjY6Il90b2tlbiI7czo0MDoieWNBdHV2cDBicXZWWHI5ZHFLNlZYQ21FeWlmRkxuTVBQY2lwUEFtUSI7czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6MzA6Imh0dHA6Ly8xMjcuMC4wLjE6ODAwMC9ib29raW5ncyI7czo1OiJyb3V0ZSI7czoxNDoiYm9va2luZ3MuaW5kZXgiO31zOjY6Il9mbGFzaCI7YToyOntzOjM6Im9sZCI7YTowOnt9czozOiJuZXciO2E6MDp7fX1zOjExOiJyZXNldDpwaG9uZSI7czoxMDoiMDYyNTIwMDIxNCI7czoxMDoicmVzZXQ6Y29kZSI7aToyMjI4OTc7czoxMzoicmVzZXQ6ZXhwaXJlcyI7TzoyNToiSWxsdW1pbmF0ZVxTdXBwb3J0XENhcmJvbiI6Mzp7czo0OiJkYXRlIjtzOjI2OiIyMDI2LTA5LTEzIDIzOjIxOjI2LjA2MTA2NiI7czoxMzoidGltZXpvbmVfdHlwZSI7aTozO3M6ODoidGltZXpvbmUiO3M6MTQ6IkFmcmljYS9OYWlyb2JpIjt9czo1MDoibG9naW5fd2ViXzU5YmEzNmFkZGMyYjJmOTQwMTU4MGYwMTRjN2Y1OGVhNGUzMDk4OWQiO2k6MTt9', 1789333089);

-- --------------------------------------------------------

--
-- Table structure for table `tasks`
--

CREATE TABLE `tasks` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `assigned_date` date NOT NULL,
  `due_date` date DEFAULT NULL,
  `created_by` bigint(20) UNSIGNED NOT NULL,
  `department_id` bigint(20) UNSIGNED DEFAULT NULL,
  `unit_id` bigint(20) UNSIGNED DEFAULT NULL,
  `status` enum('pending_approval','approved','rejected','in_progress','completed_pending_approval','completed','completion_rejected','cancelled') NOT NULL DEFAULT 'pending_approval',
  `rejection_reason` text DEFAULT NULL,
  `completion_comment` text DEFAULT NULL,
  `started_at` timestamp NULL DEFAULT NULL,
  `completed_at` timestamp NULL DEFAULT NULL,
  `duration_minutes` int(10) UNSIGNED DEFAULT NULL,
  `approved_by` bigint(20) UNSIGNED DEFAULT NULL,
  `approved_at` timestamp NULL DEFAULT NULL,
  `completion_approved_by` bigint(20) UNSIGNED DEFAULT NULL,
  `completion_approved_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `parent_task_id` bigint(20) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `tasks`
--

INSERT INTO `tasks` (`id`, `name`, `description`, `assigned_date`, `due_date`, `created_by`, `department_id`, `unit_id`, `status`, `rejection_reason`, `completion_comment`, `started_at`, `completed_at`, `duration_minutes`, `approved_by`, `approved_at`, `completion_approved_by`, `completion_approved_at`, `created_at`, `updated_at`, `deleted_at`, `parent_task_id`) VALUES
(1, 'uuuu', 'uuuuu', '2026-08-31', '2026-09-04', 1, NULL, NULL, 'pending_approval', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2026-08-30 21:57:19', '2026-08-30 21:57:19', NULL, NULL),
(2, 'uuuu', 'uuuuu', '2026-08-31', '2026-09-04', 1, NULL, NULL, 'pending_approval', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2026-08-30 21:57:21', '2026-08-30 21:57:21', NULL, NULL);

-- --------------------------------------------------------

--
-- Table structure for table `task_comments`
--

CREATE TABLE `task_comments` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `comment` text NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `task_user`
--

CREATE TABLE `task_user` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `task_id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `task_user`
--

INSERT INTO `task_user` (`id`, `task_id`, `user_id`, `created_at`, `updated_at`) VALUES
(1, 1, 1, NULL, NULL),
(2, 2, 1, NULL, NULL);

-- --------------------------------------------------------

--
-- Table structure for table `tenants`
--

CREATE TABLE `tenants` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `acc_no` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `ternant_payments`
--

CREATE TABLE `ternant_payments` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `contract_id` bigint(20) UNSIGNED NOT NULL,
  `amount` decimal(12,2) NOT NULL,
  `payment_date` date NOT NULL,
  `remarks` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `ternant_units`
--

CREATE TABLE `ternant_units` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `unit_no` varchar(255) DEFAULT NULL,
  `description` varchar(255) NOT NULL,
  `majengo_id` bigint(20) UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `location_id` bigint(20) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `ternant_units`
--

INSERT INTO `ternant_units` (`id`, `unit_no`, `description`, `majengo_id`, `created_at`, `updated_at`, `deleted_at`, `location_id`) VALUES
(1, '402', 'square meter 40', 1, '2026-09-10 16:00:07', '2026-09-10 16:00:07', NULL, NULL);

-- --------------------------------------------------------

--
-- Table structure for table `units`
--

CREATE TABLE `units` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `department_id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `head_user_id` bigint(20) 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=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `units`
--

INSERT INTO `units` (`id`, `department_id`, `name`, `description`, `head_user_id`, `created_at`, `updated_at`, `deleted_at`) VALUES
(9, 1, 'ICT DEPARTMENT', 'Handles ICT operations', NULL, '2026-08-28 07:53:47', '2026-08-28 07:53:47', NULL),
(10, 1, 'ICT SUPPORT UNIT', 'Provides technical support', NULL, '2026-08-28 07:53:47', '2026-08-28 07:53:47', NULL),
(11, 1, 'ICT DEVELOPMENT UNIT', 'Focuses on software and systems development', NULL, '2026-08-28 07:53:47', '2026-08-28 07:53:47', NULL),
(12, 1, 'ICT SECURITY UNIT', 'Manages cybersecurity and data protection', NULL, '2026-08-28 07:53:47', '2026-08-28 07:53:47', NULL),
(13, 3, 'accountanting', 'accountant', 1, '2026-09-11 09:53:54', '2026-09-11 11:34:13', NULL);

-- --------------------------------------------------------

--
-- Table structure for table `users`
--

CREATE TABLE `users` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `first_name` varchar(255) NOT NULL,
  `last_name` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `phone` varchar(255) NOT NULL,
  `gender` enum('Male','Female','Other') DEFAULT NULL,
  `role_id` bigint(20) UNSIGNED DEFAULT NULL,
  `department_id` bigint(20) UNSIGNED DEFAULT NULL,
  `manager_id` bigint(20) UNSIGNED DEFAULT NULL,
  `is_department_head` tinyint(1) NOT NULL DEFAULT 0,
  `password` varchar(255) NOT NULL,
  `remember_token` varchar(100) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `is_unit_head` tinyint(1) NOT NULL DEFAULT 0,
  `unit_id` bigint(20) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `users`
--

INSERT INTO `users` (`id`, `first_name`, `last_name`, `email`, `phone`, `gender`, `role_id`, `department_id`, `manager_id`, `is_department_head`, `password`, `remember_token`, `created_at`, `updated_at`, `deleted_at`, `is_unit_head`, `unit_id`) VALUES
(1, 'Raphael', 'Richard', 'raphaelrichard754@gmail.com', '0625200214', 'Male', 1, 2, NULL, 0, '$2y$12$rzGvDk1FKoutly.a/cgeu.6VuhEjMVb0DGOMIKfPiyIQ9noSjtMNm', NULL, '2026-08-28 04:54:16', '2026-09-09 19:30:17', NULL, 0, 9),
(2, 'johanes', 'mkami', 'info@ncultd.or.tz', '0658381644', 'Male', 2, NULL, NULL, 0, '$2y$12$rY1g.ub3CLrgqDhUzdc3Y.Ul1KaOCXicIyzm2xJL0RqvSytPQ00UG', NULL, '2026-09-03 11:32:42', '2026-09-11 11:46:04', NULL, 0, 9);

-- --------------------------------------------------------

--
-- Table structure for table `workplans`
--

CREATE TABLE `workplans` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `creator_id` bigint(20) UNSIGNED NOT NULL,
  `editor_id` bigint(20) UNSIGNED DEFAULT NULL,
  `title` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `start_date` date NOT NULL,
  `status` enum('draft','submitted','approved') NOT NULL DEFAULT 'draft',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `workplans`
--

INSERT INTO `workplans` (`id`, `creator_id`, `editor_id`, `title`, `description`, `start_date`, `status`, `created_at`, `updated_at`) VALUES
(1, 1, 1, 'kufundisha', 'fffff', '2026-09-07', 'approved', '2026-08-30 21:56:12', '2026-08-30 21:56:45');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `approvals`
--
ALTER TABLE `approvals`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `banks`
--
ALTER TABLE `banks`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `bookings`
--
ALTER TABLE `bookings`
  ADD PRIMARY KEY (`id`),
  ADD KEY `bookings_hall_id_foreign` (`hall_id`),
  ADD KEY `bookings_booking_event_id_foreign` (`booking_event_id`);

--
-- Indexes for table `booking_events`
--
ALTER TABLE `booking_events`
  ADD PRIMARY KEY (`id`),
  ADD KEY `booking_events_hall_id_foreign` (`hall_id`);

--
-- Indexes for table `booking_times`
--
ALTER TABLE `booking_times`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `cache`
--
ALTER TABLE `cache`
  ADD PRIMARY KEY (`key`),
  ADD KEY `cache_expiration_index` (`expiration`);

--
-- Indexes for table `cache_locks`
--
ALTER TABLE `cache_locks`
  ADD PRIMARY KEY (`key`),
  ADD KEY `cache_locks_expiration_index` (`expiration`);

--
-- Indexes for table `contracts`
--
ALTER TABLE `contracts`
  ADD PRIMARY KEY (`id`),
  ADD KEY `contracts_tenant_id_foreign` (`tenant_id`),
  ADD KEY `contracts_ternant_unit_id_foreign` (`ternant_unit_id`);

--
-- Indexes for table `departments`
--
ALTER TABLE `departments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `departments_head_user_id_foreign` (`head_user_id`);

--
-- Indexes for table `executions`
--
ALTER TABLE `executions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `executions_task_id_foreign` (`task_id`);

--
-- Indexes for table `halls`
--
ALTER TABLE `halls`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `invoices`
--
ALTER TABLE `invoices`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `invoices_invoice_number_unique` (`invoice_number`),
  ADD KEY `invoices_hall_id_foreign` (`hall_id`),
  ADD KEY `invoices_booking_id_foreign` (`booking_id`);

--
-- Indexes for table `locations`
--
ALTER TABLE `locations`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `majengos`
--
ALTER TABLE `majengos`
  ADD PRIMARY KEY (`id`),
  ADD KEY `majengos_location_id_foreign` (`location_id`);

--
-- Indexes for table `message_logs`
--
ALTER TABLE `message_logs`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `migrations`
--
ALTER TABLE `migrations`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `model_has_permissions`
--
ALTER TABLE `model_has_permissions`
  ADD PRIMARY KEY (`permission_id`,`model_id`,`model_type`),
  ADD KEY `model_has_permissions_model_id_model_type_index` (`model_id`,`model_type`);

--
-- Indexes for table `model_has_roles`
--
ALTER TABLE `model_has_roles`
  ADD PRIMARY KEY (`role_id`,`model_id`,`model_type`),
  ADD KEY `model_has_roles_model_id_model_type_index` (`model_id`,`model_type`);

--
-- Indexes for table `payments`
--
ALTER TABLE `payments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `payments_invoice_id_foreign` (`invoice_id`),
  ADD KEY `payments_booking_id_foreign` (`booking_id`),
  ADD KEY `payments_checked_by_foreign` (`checked_by`);

--
-- Indexes for table `permissions`
--
ALTER TABLE `permissions`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `permissions_name_guard_name_unique` (`name`,`guard_name`);

--
-- Indexes for table `roles`
--
ALTER TABLE `roles`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `roles_name_guard_name_unique` (`name`,`guard_name`);

--
-- Indexes for table `role_has_permissions`
--
ALTER TABLE `role_has_permissions`
  ADD PRIMARY KEY (`permission_id`,`role_id`),
  ADD KEY `role_has_permissions_role_id_foreign` (`role_id`);

--
-- Indexes for table `sessions`
--
ALTER TABLE `sessions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sessions_user_id_index` (`user_id`),
  ADD KEY `sessions_last_activity_index` (`last_activity`);

--
-- Indexes for table `tasks`
--
ALTER TABLE `tasks`
  ADD PRIMARY KEY (`id`),
  ADD KEY `tasks_created_by_foreign` (`created_by`),
  ADD KEY `tasks_department_id_foreign` (`department_id`),
  ADD KEY `tasks_unit_id_foreign` (`unit_id`),
  ADD KEY `tasks_approved_by_foreign` (`approved_by`),
  ADD KEY `tasks_completion_approved_by_foreign` (`completion_approved_by`),
  ADD KEY `tasks_parent_task_id_foreign` (`parent_task_id`);

--
-- Indexes for table `task_comments`
--
ALTER TABLE `task_comments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `task_comments_user_id_foreign` (`user_id`);

--
-- Indexes for table `task_user`
--
ALTER TABLE `task_user`
  ADD PRIMARY KEY (`id`),
  ADD KEY `task_user_task_id_foreign` (`task_id`),
  ADD KEY `task_user_user_id_foreign` (`user_id`);

--
-- Indexes for table `tenants`
--
ALTER TABLE `tenants`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `ternant_payments`
--
ALTER TABLE `ternant_payments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `ternant_payments_contract_id_foreign` (`contract_id`);

--
-- Indexes for table `ternant_units`
--
ALTER TABLE `ternant_units`
  ADD PRIMARY KEY (`id`),
  ADD KEY `ternant_units_location_id_foreign` (`location_id`),
  ADD KEY `ternant_units_majengo_id_foreign` (`majengo_id`);

--
-- Indexes for table `units`
--
ALTER TABLE `units`
  ADD PRIMARY KEY (`id`),
  ADD KEY `units_department_id_foreign` (`department_id`),
  ADD KEY `units_head_user_id_foreign` (`head_user_id`);

--
-- Indexes for table `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `users_phone_unique` (`phone`),
  ADD KEY `users_role_id_foreign` (`role_id`),
  ADD KEY `users_department_id_foreign` (`department_id`),
  ADD KEY `users_manager_id_foreign` (`manager_id`),
  ADD KEY `users_unit_id_foreign` (`unit_id`);

--
-- Indexes for table `workplans`
--
ALTER TABLE `workplans`
  ADD PRIMARY KEY (`id`),
  ADD KEY `workplans_creator_id_foreign` (`creator_id`),
  ADD KEY `workplans_editor_id_foreign` (`editor_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `approvals`
--
ALTER TABLE `approvals`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `banks`
--
ALTER TABLE `banks`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `bookings`
--
ALTER TABLE `bookings`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=44;

--
-- AUTO_INCREMENT for table `booking_events`
--
ALTER TABLE `booking_events`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `booking_times`
--
ALTER TABLE `booking_times`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `contracts`
--
ALTER TABLE `contracts`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `departments`
--
ALTER TABLE `departments`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `executions`
--
ALTER TABLE `executions`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `halls`
--
ALTER TABLE `halls`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `invoices`
--
ALTER TABLE `invoices`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=45;

--
-- AUTO_INCREMENT for table `locations`
--
ALTER TABLE `locations`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `majengos`
--
ALTER TABLE `majengos`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `message_logs`
--
ALTER TABLE `message_logs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=31;

--
-- AUTO_INCREMENT for table `migrations`
--
ALTER TABLE `migrations`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=52;

--
-- AUTO_INCREMENT for table `payments`
--
ALTER TABLE `payments`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16;

--
-- AUTO_INCREMENT for table `permissions`
--
ALTER TABLE `permissions`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=89;

--
-- AUTO_INCREMENT for table `roles`
--
ALTER TABLE `roles`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `tasks`
--
ALTER TABLE `tasks`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `task_comments`
--
ALTER TABLE `task_comments`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `task_user`
--
ALTER TABLE `task_user`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `tenants`
--
ALTER TABLE `tenants`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `ternant_payments`
--
ALTER TABLE `ternant_payments`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `ternant_units`
--
ALTER TABLE `ternant_units`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `units`
--
ALTER TABLE `units`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;

--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `workplans`
--
ALTER TABLE `workplans`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `bookings`
--
ALTER TABLE `bookings`
  ADD CONSTRAINT `bookings_booking_event_id_foreign` FOREIGN KEY (`booking_event_id`) REFERENCES `booking_events` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `bookings_hall_id_foreign` FOREIGN KEY (`hall_id`) REFERENCES `halls` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `booking_events`
--
ALTER TABLE `booking_events`
  ADD CONSTRAINT `booking_events_hall_id_foreign` FOREIGN KEY (`hall_id`) REFERENCES `halls` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `contracts`
--
ALTER TABLE `contracts`
  ADD CONSTRAINT `contracts_tenant_id_foreign` FOREIGN KEY (`tenant_id`) REFERENCES `tenants` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `contracts_ternant_unit_id_foreign` FOREIGN KEY (`ternant_unit_id`) REFERENCES `ternant_units` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `departments`
--
ALTER TABLE `departments`
  ADD CONSTRAINT `departments_head_user_id_foreign` FOREIGN KEY (`head_user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `executions`
--
ALTER TABLE `executions`
  ADD CONSTRAINT `executions_task_id_foreign` FOREIGN KEY (`task_id`) REFERENCES `tasks` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `invoices`
--
ALTER TABLE `invoices`
  ADD CONSTRAINT `invoices_booking_id_foreign` FOREIGN KEY (`booking_id`) REFERENCES `bookings` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `invoices_hall_id_foreign` FOREIGN KEY (`hall_id`) REFERENCES `halls` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `majengos`
--
ALTER TABLE `majengos`
  ADD CONSTRAINT `majengos_location_id_foreign` FOREIGN KEY (`location_id`) REFERENCES `locations` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `model_has_permissions`
--
ALTER TABLE `model_has_permissions`
  ADD CONSTRAINT `model_has_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `model_has_roles`
--
ALTER TABLE `model_has_roles`
  ADD CONSTRAINT `model_has_roles_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `payments`
--
ALTER TABLE `payments`
  ADD CONSTRAINT `payments_booking_id_foreign` FOREIGN KEY (`booking_id`) REFERENCES `bookings` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `payments_checked_by_foreign` FOREIGN KEY (`checked_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `payments_invoice_id_foreign` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `role_has_permissions`
--
ALTER TABLE `role_has_permissions`
  ADD CONSTRAINT `role_has_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `role_has_permissions_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `tasks`
--
ALTER TABLE `tasks`
  ADD CONSTRAINT `tasks_approved_by_foreign` FOREIGN KEY (`approved_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `tasks_completion_approved_by_foreign` FOREIGN KEY (`completion_approved_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `tasks_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `tasks_department_id_foreign` FOREIGN KEY (`department_id`) REFERENCES `departments` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `tasks_parent_task_id_foreign` FOREIGN KEY (`parent_task_id`) REFERENCES `tasks` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `tasks_unit_id_foreign` FOREIGN KEY (`unit_id`) REFERENCES `units` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `task_comments`
--
ALTER TABLE `task_comments`
  ADD CONSTRAINT `task_comments_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `task_user`
--
ALTER TABLE `task_user`
  ADD CONSTRAINT `task_user_task_id_foreign` FOREIGN KEY (`task_id`) REFERENCES `tasks` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `task_user_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `ternant_payments`
--
ALTER TABLE `ternant_payments`
  ADD CONSTRAINT `ternant_payments_contract_id_foreign` FOREIGN KEY (`contract_id`) REFERENCES `contracts` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `ternant_units`
--
ALTER TABLE `ternant_units`
  ADD CONSTRAINT `ternant_units_location_id_foreign` FOREIGN KEY (`location_id`) REFERENCES `locations` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ternant_units_majengo_id_foreign` FOREIGN KEY (`majengo_id`) REFERENCES `majengos` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `units`
--
ALTER TABLE `units`
  ADD CONSTRAINT `units_department_id_foreign` FOREIGN KEY (`department_id`) REFERENCES `departments` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `units_head_user_id_foreign` FOREIGN KEY (`head_user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `users`
--
ALTER TABLE `users`
  ADD CONSTRAINT `users_department_id_foreign` FOREIGN KEY (`department_id`) REFERENCES `departments` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `users_manager_id_foreign` FOREIGN KEY (`manager_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `users_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `users_unit_id_foreign` FOREIGN KEY (`unit_id`) REFERENCES `units` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `workplans`
--
ALTER TABLE `workplans`
  ADD CONSTRAINT `workplans_creator_id_foreign` FOREIGN KEY (`creator_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `workplans_editor_id_foreign` FOREIGN KEY (`editor_id`) REFERENCES `users` (`id`) ON DELETE SET NULL;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
