-- phpMyAdmin SQL Dump
-- version 5.2.0
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Feb 20, 2023 at 08:17 AM
-- Server version: 10.4.24-MariaDB
-- PHP Version: 7.4.29

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: `pat_revamp_02_08_2023`
--

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

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

CREATE TABLE `migrations` (
  `id` int(10) UNSIGNED NOT NULL,
  `migration` varchar(255) COLLATE utf8mb4_unicode_ci 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, '2014_10_12_000000_create_users_table', 1),
(2, '2019_08_19_000000_create_failed_jobs_table', 1),
(3, '2019_12_14_000001_create_personal_access_tokens_table', 2),
(4, '2022_12_05_091619_add_columns_to_users_table', 2),
(5, '2023_02_07_024848_add_is_login_to_users_table', 3);

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

--
-- Table structure for table `mnt_brands`
--

CREATE TABLE `mnt_brands` (
  `id` int(11) NOT NULL,
  `description` varchar(45) DEFAULT NULL,
  `enabled` tinyint(4) DEFAULT 1,
  `entity_id` int(11) DEFAULT NULL,
  `is_deleted` int(11) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `mnt_business_units`
--

CREATE TABLE `mnt_business_units` (
  `id` int(10) UNSIGNED NOT NULL,
  `description` varchar(45) DEFAULT NULL,
  `enabled` tinyint(4) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `manager_id` int(11) DEFAULT NULL,
  `is_deleted` int(11) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `mnt_entities`
--

CREATE TABLE `mnt_entities` (
  `id` int(11) NOT NULL,
  `description` varchar(45) DEFAULT NULL,
  `enabled` tinyint(4) DEFAULT 1,
  `billable` tinyint(4) DEFAULT 1,
  `is_deleted` int(11) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `mnt_platforms`
--

CREATE TABLE `mnt_platforms` (
  `id` int(11) DEFAULT NULL,
  `Pentaho` varchar(50) DEFAULT NULL,
  `PHP` varchar(50) DEFAULT NULL,
  `MySQL` varchar(50) DEFAULT NULL,
  `VB Net` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `mnt_statuses`
--

CREATE TABLE `mnt_statuses` (
  `id` tinyint(3) UNSIGNED NOT NULL,
  `description` varchar(20) DEFAULT NULL,
  `enabled` tinyint(4) DEFAULT 1,
  `is_deleted` int(11) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `mnt_ticket_references`
--

CREATE TABLE `mnt_ticket_references` (
  `id` int(11) UNSIGNED NOT NULL,
  `year` int(11) DEFAULT NULL,
  `ticket_number` int(11) DEFAULT NULL,
  `ticket_refcode` varchar(9) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `mnt_ticket_types`
--

CREATE TABLE `mnt_ticket_types` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(45) DEFAULT NULL,
  `enabled` tinyint(4) DEFAULT 1,
  `is_deleted` int(11) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `mnt_types`
--

CREATE TABLE `mnt_types` (
  `id` int(11) NOT NULL,
  `description` varchar(45) DEFAULT NULL,
  `enabled` tinyint(4) DEFAULT 1,
  `is_deleted` int(11) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `personal_access_tokens`
--

CREATE TABLE `personal_access_tokens` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `tokenable_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `tokenable_id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `token` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
  `abilities` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `last_used_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;

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

--
-- Table structure for table `txn_activities`
--

CREATE TABLE `txn_activities` (
  `id` int(11) UNSIGNED NOT NULL,
  `ticket_id` int(11) DEFAULT NULL,
  `date_log` date DEFAULT NULL,
  `type_id` int(11) DEFAULT NULL,
  `activity` varchar(2000) DEFAULT NULL,
  `resource_id` int(11) DEFAULT NULL,
  `hours` float DEFAULT NULL,
  `billable` tinyint(4) DEFAULT 0,
  `brand_id` int(11) DEFAULT NULL,
  `entity_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `txn_tickets`
--

CREATE TABLE `txn_tickets` (
  `id` int(11) NOT NULL,
  `description` varchar(1000) NOT NULL,
  `entity_id` int(11) DEFAULT NULL,
  `ticket_manager_id` int(11) DEFAULT NULL,
  `start_date` date DEFAULT NULL,
  `end_date` date DEFAULT NULL,
  `closed_date` date DEFAULT NULL,
  `total_hours` varchar(45) DEFAULT NULL,
  `status_id` int(11) DEFAULT NULL,
  `added_by` varchar(20) DEFAULT NULL,
  `ticket_ref` varchar(9) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `ticket_type_id` int(11) DEFAULT NULL,
  `estimate_hours` int(4) DEFAULT NULL,
  `repository` varchar(500) DEFAULT NULL,
  `remarks` varchar(500) DEFAULT NULL,
  `ticket_member_ids` text NOT NULL,
  `ticket_description` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

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

CREATE TABLE `users` (
  `id` int(11) NOT NULL,
  `firstname` varchar(45) DEFAULT NULL,
  `lastname` varchar(45) DEFAULT NULL,
  `middlename` varchar(45) DEFAULT NULL,
  `enabled` tinyint(4) DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `start_date` date DEFAULT NULL,
  `end_date` date DEFAULT NULL,
  `email` varchar(45) DEFAULT NULL,
  `is_internal` tinyint(4) DEFAULT 0,
  `business_unit_id` int(11) DEFAULT NULL,
  `manager_id` int(11) DEFAULT NULL,
  `username` varchar(50) DEFAULT NULL,
  `password` varchar(100) DEFAULT NULL,
  `profile_picture` varchar(255) DEFAULT NULL,
  `is_admin` int(11) DEFAULT NULL,
  `added_by` varchar(50) DEFAULT NULL,
  `is_deleted` int(11) DEFAULT 0,
  `is_login` varchar(255) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Indexes for dumped tables
--

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

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

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

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

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

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

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

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

--
-- Indexes for table `personal_access_tokens`
--
ALTER TABLE `personal_access_tokens`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `personal_access_tokens_token_unique` (`token`),
  ADD KEY `personal_access_tokens_tokenable_type_tokenable_id_index` (`tokenable_type`,`tokenable_id`);

--
-- Indexes for table `txn_activities`
--
ALTER TABLE `txn_activities`
  ADD PRIMARY KEY (`id`),
  ADD KEY `project_activities_idx` (`ticket_id`),
  ADD KEY `activity_type_idx` (`type_id`),
  ADD KEY `activity_resource_idx` (`resource_id`),
  ADD KEY `activity_entity_idx` (`entity_id`);

--
-- Indexes for table `txn_tickets`
--
ALTER TABLE `txn_tickets`
  ADD PRIMARY KEY (`id`),
  ADD KEY `project_entity_idx` (`entity_id`),
  ADD KEY `project_mngr_resource_idx` (`ticket_manager_id`);

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

--
-- AUTO_INCREMENT for dumped tables
--

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

--
-- AUTO_INCREMENT for table `mnt_brands`
--
ALTER TABLE `mnt_brands`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mnt_business_units`
--
ALTER TABLE `mnt_business_units`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mnt_entities`
--
ALTER TABLE `mnt_entities`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mnt_statuses`
--
ALTER TABLE `mnt_statuses`
  MODIFY `id` tinyint(3) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mnt_ticket_references`
--
ALTER TABLE `mnt_ticket_references`
  MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mnt_ticket_types`
--
ALTER TABLE `mnt_ticket_types`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mnt_types`
--
ALTER TABLE `mnt_types`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

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

--
-- AUTO_INCREMENT for table `txn_activities`
--
ALTER TABLE `txn_activities`
  MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `txn_tickets`
--
ALTER TABLE `txn_tickets`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
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 */;
