-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Jun 01, 2017 at 05:18 AM
-- Server version: 10.1.16-MariaDB
-- PHP Version: 5.6.24

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
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: `payrollnew`
--

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

--
-- Table structure for table `attendence`
--

CREATE TABLE `attendence` (
  `id` int(10) UNSIGNED NOT NULL,
  `user_id` int(10) UNSIGNED NOT NULL,
  `company_id` int(10) UNSIGNED NOT NULL,
  `work_date` date NOT NULL,
  `time_in` time NOT NULL,
  `time_out` time NOT NULL,
  `overtime_in` time NOT NULL,
  `overtime_out` time NOT NULL,
  `shift` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `scheduled` tinyint(1) NOT NULL,
  `attendence` tinyint(4) NOT NULL DEFAULT '0',
  `time_sheet_by_company` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '0',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

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

--
-- Table structure for table `companies`
--

CREATE TABLE `companies` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `shifts` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `workers_ordered` int(11) NOT NULL,
  `overtime` tinyint(4) NOT NULL DEFAULT '0',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Dumping data for table `companies`
--

INSERT INTO `companies` (`id`, `name`, `email`, `shifts`, `workers_ordered`, `overtime`, `created_at`, `updated_at`) VALUES
(2, 'ABC Pvt. Ltd.', 'abc@abc.com', '', 0, 1, NULL, NULL),
(3, 'Demo Company Pvt. Ltd.', 'demo@demo.com', '', 0, 0, NULL, NULL),
(4, 'New test1', 'newtest1@test.com', '["day","night"]', 5, 1, '2017-05-17 03:53:04', '2017-05-17 21:36:06');

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

--
-- Table structure for table `expenses`
--

CREATE TABLE `expenses` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Dumping data for table `expenses`
--

INSERT INTO `expenses` (`id`, `name`, `created_at`, `updated_at`) VALUES
(1, 'Deduction for Ride', NULL, NULL),
(2, 'Deduction Security & Others', NULL, NULL);

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

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

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

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

INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '2014_10_12_000000_create_users_table', 1),
(2, '2014_10_12_100000_create_password_resets_table', 1),
(3, '2017_03_24_062312_entrust_setup_tables', 1),
(4, '2017_03_29_063724_create_companies_table', 1),
(5, '2017_03_29_094334_create_attendence_table', 1),
(6, '2017_04_22_040112_create_expenses_table', 1),
(7, '2017_04_25_074337_create_payroll_table', 1),
(8, '2017_04_26_063316_create_payroll_company_table', 1),
(9, '2017_04_26_063508_create_payroll_attendence_table', 1),
(10, '2017_04_26_064249_create_payroll_attendence_company_table', 1),
(11, '2017_05_04_050935_create_payroll_expenses_table', 1);

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

--
-- Table structure for table `password_resets`
--

CREATE TABLE `password_resets` (
  `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `token` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

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

--
-- Table structure for table `payroll`
--

CREATE TABLE `payroll` (
  `id` int(10) UNSIGNED NOT NULL,
  `user_id` int(10) UNSIGNED NOT NULL,
  `regular_hours` decimal(3,2) NOT NULL DEFAULT '0.00',
  `total_hours_worked` decimal(3,2) NOT NULL DEFAULT '0.00',
  `overtime_hours` decimal(3,2) NOT NULL DEFAULT '0.00',
  `regular_wages` decimal(10,2) NOT NULL DEFAULT '0.00',
  `overtime_wages` decimal(10,2) NOT NULL DEFAULT '0.00',
  `gross_wages` decimal(10,2) NOT NULL DEFAULT '0.00',
  `net_payable_wages` decimal(10,2) NOT NULL DEFAULT '0.00',
  `payment_status` tinyint(4) NOT NULL DEFAULT '0',
  `payment_mode` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `payment_by_cheque` decimal(10,2) NOT NULL DEFAULT '0.00',
  `payment_by_cash` decimal(10,2) NOT NULL DEFAULT '0.00',
  `deductions` text COLLATE utf8_unicode_ci,
  `other_expenses` text COLLATE utf8_unicode_ci,
  `start_date` date NOT NULL,
  `end_date` date NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

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

--
-- Table structure for table `payroll_attendence`
--

CREATE TABLE `payroll_attendence` (
  `id` int(10) UNSIGNED NOT NULL,
  `payroll_id` int(10) UNSIGNED NOT NULL,
  `attendence_id` int(10) UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

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

--
-- Table structure for table `payroll_attendence_company`
--

CREATE TABLE `payroll_attendence_company` (
  `id` int(10) UNSIGNED NOT NULL,
  `payroll_id` int(10) UNSIGNED NOT NULL,
  `attendence_id` int(10) UNSIGNED NOT NULL,
  `company_id` int(10) UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

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

--
-- Table structure for table `payroll_company`
--

CREATE TABLE `payroll_company` (
  `id` int(10) UNSIGNED NOT NULL,
  `payroll_id` int(10) UNSIGNED NOT NULL,
  `company_id` int(10) UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

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

--
-- Table structure for table `payroll_expenses`
--

CREATE TABLE `payroll_expenses` (
  `id` int(10) UNSIGNED NOT NULL,
  `payroll_id` int(10) UNSIGNED NOT NULL,
  `meta_key` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `meta_value` decimal(10,2) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

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

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

CREATE TABLE `permissions` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `display_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `description` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

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

INSERT INTO `permissions` (`id`, `name`, `display_name`, `description`, `created_at`, `updated_at`) VALUES
(1, 'user-view', 'View User List', NULL, NULL, NULL),
(2, 'user-create', 'Create New User', NULL, NULL, NULL),
(3, 'user-edit', 'Edit User', NULL, NULL, NULL),
(4, 'user-delete', 'Delete User', NULL, NULL, NULL),
(5, 'permission-view', 'View Permissions', NULL, NULL, NULL),
(6, 'permission-create', 'Create New Permission', NULL, NULL, NULL),
(7, 'permission-edit', 'Edit Permission', NULL, NULL, NULL),
(8, 'permission-delete', 'Delete Permission', NULL, NULL, NULL),
(9, 'role-view', 'View Roles', NULL, NULL, NULL),
(10, 'role-create', 'Create New Role', NULL, NULL, NULL),
(11, 'role-edit', 'Edit Role', NULL, NULL, NULL),
(12, 'role-delete', 'Delete Role', NULL, NULL, NULL),
(13, 'company-view', 'View Companies', NULL, '2017-03-29 03:23:25', '2017-03-29 03:23:25'),
(14, 'company-create', 'Create New Company', NULL, '2017-03-29 03:23:41', '2017-03-29 03:23:41'),
(15, 'company-edit', 'Edit Company', NULL, '2017-03-29 03:23:56', '2017-03-29 03:23:56'),
(16, 'company-delete', 'Delete Company', NULL, '2017-03-29 03:24:22', '2017-03-29 03:24:22'),
(17, 'attendence-view', 'View Attendences', NULL, '2017-03-29 03:24:46', '2017-03-29 03:24:46'),
(18, 'attendence-create', 'Add New Attendence', NULL, '2017-03-29 03:25:07', '2017-03-29 03:25:07'),
(19, 'attendence-edit', 'Update Attendence', NULL, '2017-03-29 03:25:26', '2017-03-29 03:25:26'),
(20, 'attendence-delete', 'Delete Attendence', NULL, '2017-03-29 03:25:47', '2017-03-29 03:25:47'),
(21, 'worker-view', 'View Workers List', NULL, '2017-04-05 19:14:33', '2017-04-05 19:14:33'),
(22, 'worker-create', 'Create New Worker', NULL, '2017-04-05 19:14:49', '2017-04-05 19:14:49'),
(23, 'worker-edit', 'Edit Worker', NULL, '2017-04-05 19:15:06', '2017-04-05 19:15:06'),
(24, 'worker-delete', 'Delete Worker', NULL, '2017-04-05 19:15:22', '2017-04-05 19:15:22'),
(25, 'payroll-view', 'View Payroll List', NULL, '2017-04-12 21:33:48', '2017-04-12 21:33:48'),
(26, 'payroll-create', 'Create Payroll', NULL, '2017-04-12 21:34:03', '2017-04-12 21:34:03'),
(27, 'payroll-edit', 'Edit Payroll', NULL, '2017-04-12 21:34:19', '2017-04-12 21:34:19'),
(28, 'payroll-delete', 'Delete Payroll', NULL, '2017-04-12 21:34:34', '2017-04-12 21:34:34'),
(29, 'expense-view', 'View Expenses List', NULL, '2017-04-21 17:17:52', '2017-04-21 17:17:52'),
(30, 'expense-create', 'Create New Expense', NULL, '2017-04-21 17:18:07', '2017-04-21 17:18:07'),
(31, 'expense-edit', 'Update Expense', NULL, '2017-04-21 17:18:22', '2017-04-21 17:18:22'),
(32, 'expense-delete', 'Delete Expense', NULL, '2017-04-21 17:18:37', '2017-04-21 17:18:37');

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

--
-- Table structure for table `permission_role`
--

CREATE TABLE `permission_role` (
  `permission_id` int(10) UNSIGNED NOT NULL,
  `role_id` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Dumping data for table `permission_role`
--

INSERT INTO `permission_role` (`permission_id`, `role_id`) VALUES
(1, 1),
(2, 1),
(3, 1),
(4, 1),
(5, 1),
(6, 1),
(7, 1),
(8, 1),
(9, 1),
(10, 1),
(11, 1),
(12, 1),
(13, 1),
(14, 1),
(15, 1),
(16, 1),
(17, 1),
(18, 1),
(19, 1),
(20, 1),
(21, 1),
(22, 1),
(23, 1),
(24, 1),
(25, 1),
(26, 1),
(27, 1),
(28, 1),
(29, 1),
(30, 1),
(31, 1),
(32, 1);

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

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

CREATE TABLE `roles` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `display_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `description` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

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

INSERT INTO `roles` (`id`, `name`, `display_name`, `description`, `created_at`, `updated_at`) VALUES
(1, 'admin', 'Admin', NULL, NULL, NULL),
(2, 'worker', 'Worker', NULL, NULL, '2017-04-03 20:33:22'),
(3, 'staff', 'Staff', NULL, '2017-05-15 03:46:37', '2017-05-15 03:46:37');

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

--
-- Table structure for table `role_user`
--

CREATE TABLE `role_user` (
  `user_id` int(10) UNSIGNED NOT NULL,
  `role_id` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Dumping data for table `role_user`
--

INSERT INTO `role_user` (`user_id`, `role_id`) VALUES
(1, 1),
(13, 2),
(14, 3),
(15, 2),
(16, 2),
(17, 2),
(18, 2);

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

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

CREATE TABLE `users` (
  `id` int(10) UNSIGNED NOT NULL,
  `emp_id` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `first_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `middle_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `last_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `username` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `password` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `regular_hourly_rate` decimal(10,2) NOT NULL DEFAULT '0.00',
  `overtime_hourly_rate` decimal(10,2) NOT NULL DEFAULT '0.00',
  `rate_factor` decimal(10,2) NOT NULL DEFAULT '0.00',
  `phone` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `alternate_phone` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `avatar` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `avatar_path` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `status` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `dnr_notes` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `overtime_allowed` tinyint(4) NOT NULL DEFAULT '0',
  `company_assigned` int(11) NOT NULL DEFAULT '0',
  `address1` text COLLATE utf8_unicode_ci,
  `address2` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `city` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `state` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `zip` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `country` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `remember_token` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

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

INSERT INTO `users` (`id`, `emp_id`, `first_name`, `middle_name`, `last_name`, `username`, `email`, `password`, `regular_hourly_rate`, `overtime_hourly_rate`, `rate_factor`, `phone`, `alternate_phone`, `avatar`, `avatar_path`, `status`, `dnr_notes`, `overtime_allowed`, `company_assigned`, `address1`, `address2`, `city`, `state`, `zip`, `country`, `remember_token`, `created_at`, `updated_at`) VALUES
(1, 'Staff-01', 'Pardeep', '', 'Sharma', 'admin', 'pardeepsh.mca@gmail.com', '$2y$10$LIDTFiUGh81uWnzsQ6707uJRXA4s15slQ9PKHd7v0p7j88MV.kxf.', '0.00', '0.00', '0.00', '1234567890', '', 'user.png', 'uploads/avatar/user.png', '', '', 0, 0, '', '', '', '', '', '', 'GGnbFgUPBgiVEll0F8f7KC8q3POiEM1v75mCFRgxg4L0mKRlPOJuHhgE4o9z', '2017-03-23 18:00:00', '2017-03-28 00:05:55'),
(13, 'ML-03', 'New', '2', 'Employee', 'newworker4', 'newworker4@test.com', '$2y$10$naOydsjYrxLDG5P6NakG8.Y5zmZQ6EqZdDcAK.icNeCsVSPfhnXD2', '10.40', '11.30', '0.00', '1234567890', '', 'user.png', 'uploads/avatar/user.png', 'active', '', 0, 4, 'Test Street2', 'Test Apt2', 'Test City2', 'Test State2', 'Test Zip2', '', NULL, '2017-05-03 18:31:26', '2017-05-30 17:15:20'),
(14, 'Staff-02', 'New', '', 'Staff1', 'staff01', 'staff01@test.com', '$2y$10$Fuu/rcBGyqQl7Sf9A/57DeeX9qE7dvygaTy/JQrPv9W/TcxoNSI66', '0.00', '0.00', '0.00', '1234567890', '', 'user.png', 'uploads/avatar/user.png', '', '', 0, 0, '', '', '', '', '', '', NULL, '2017-05-15 05:15:54', '2017-05-15 05:15:54'),
(15, 'ML-04', 'New', '3', 'Employee', 'worker-aR3vQU0EHtYqmKz9jHMV', 'newemp4@test.com', '$2y$10$.peY9ChwMNtA0gnBruekLuGrqfFMc/eIy0MwEQNONzcoG9heMTPtG', '11.00', '16.50', '0.00', '1234567890', '', '1495011255.png', 'uploads/avatar/1495011255.png', 'active', '', 0, 2, 'Test Street3', 'Test Apt3', 'Test City3', 'Test State3', 'Test Zip3', '', NULL, '2017-05-16 21:54:15', '2017-05-30 17:15:53'),
(16, 'ML-05', 'New', '4', 'Employee', 'worker-9inGMzj2r5rBVD50HW9T', 'newemp5@test.com', '$2y$10$bQ/SiHFKgTpemQYYKQdEre.jdX6qhUAwoalaCPuKA/nZyiQPWxlfS', '10.00', '15.00', '0.00', '1234567890', '', 'user.png', 'uploads/avatar/user.png', 'active', '', 0, 3, 'Test Street4', 'Test Apt4', 'Test City4', 'Test State4', 'Test Zip4', '', NULL, '2017-05-16 22:02:30', '2017-05-30 17:16:17'),
(17, 'ML-06', 'New', '5', 'Employee', 'worker-gIuk1O4n3w8WKw3m1twm', 'newemp6@test.com', '$2y$10$zuRFRNSK/kC1BP4q1JItZeTCEYsr44Cr9IGDKpfqlr33hWRJtRySy', '9.00', '0.00', '0.00', '1234567890', '123456', 'user.png', 'uploads/avatar/user.png', 'dnr', '', 0, 3, 'Test Street5', 'Test Apt5', 'Test City5', 'Test State5', 'Test Zip5', '', NULL, '2017-05-16 22:50:33', '2017-05-30 17:16:44'),
(18, 'ML-07', 'New', '6', 'Employee', 'worker-2SygTWFWHUlKAUYWmmt8', 'pinkal.sfc@gmail.com', '$2y$10$R.Af6SrfTVfJc6Eq1LH/qOUVMSZ7lsvKuerfM2hH3pcxChnLMnCHK', '10.00', '12.00', '1.20', '1234567890', '123456', 'user.png', 'uploads/avatar/user.png', 'dnr', 'Test DNR Notes', 1, 2, 'Test Street6', 'Test Apt6', 'Test City6', 'Test State6', 'Test Zip6', '', NULL, '2017-05-16 23:13:27', '2017-05-30 17:17:06');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `attendence`
--
ALTER TABLE `attendence`
  ADD PRIMARY KEY (`id`),
  ADD KEY `attendence_user_id_index` (`user_id`),
  ADD KEY `attendence_company_id_index` (`company_id`);

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

--
-- Indexes for table `expenses`
--
ALTER TABLE `expenses`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `expenses_name_unique` (`name`);

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

--
-- Indexes for table `password_resets`
--
ALTER TABLE `password_resets`
  ADD KEY `password_resets_email_index` (`email`);

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

--
-- Indexes for table `payroll_attendence`
--
ALTER TABLE `payroll_attendence`
  ADD PRIMARY KEY (`id`),
  ADD KEY `payroll_attendence_payroll_id_foreign` (`payroll_id`),
  ADD KEY `payroll_attendence_attendence_id_foreign` (`attendence_id`);

--
-- Indexes for table `payroll_attendence_company`
--
ALTER TABLE `payroll_attendence_company`
  ADD PRIMARY KEY (`id`),
  ADD KEY `payroll_attendence_company_payroll_id_foreign` (`payroll_id`),
  ADD KEY `payroll_attendence_company_attendence_id_foreign` (`attendence_id`),
  ADD KEY `payroll_attendence_company_company_id_foreign` (`company_id`);

--
-- Indexes for table `payroll_company`
--
ALTER TABLE `payroll_company`
  ADD PRIMARY KEY (`id`),
  ADD KEY `payroll_company_payroll_id_foreign` (`payroll_id`),
  ADD KEY `payroll_company_company_id_foreign` (`company_id`);

--
-- Indexes for table `payroll_expenses`
--
ALTER TABLE `payroll_expenses`
  ADD PRIMARY KEY (`id`),
  ADD KEY `payroll_expenses_payroll_id_foreign` (`payroll_id`);

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

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

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

--
-- Indexes for table `role_user`
--
ALTER TABLE `role_user`
  ADD PRIMARY KEY (`user_id`,`role_id`),
  ADD KEY `role_user_role_id_foreign` (`role_id`);

--
-- Indexes for table `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `users_emp_id_unique` (`emp_id`),
  ADD UNIQUE KEY `users_email_unique` (`email`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `attendence`
--
ALTER TABLE `attendence`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `companies`
--
ALTER TABLE `companies`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `expenses`
--
ALTER TABLE `expenses`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `migrations`
--
ALTER TABLE `migrations`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
--
-- AUTO_INCREMENT for table `payroll`
--
ALTER TABLE `payroll`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `payroll_attendence`
--
ALTER TABLE `payroll_attendence`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `payroll_attendence_company`
--
ALTER TABLE `payroll_attendence_company`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `payroll_company`
--
ALTER TABLE `payroll_company`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `payroll_expenses`
--
ALTER TABLE `payroll_expenses`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `permissions`
--
ALTER TABLE `permissions`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=33;
--
-- AUTO_INCREMENT for table `roles`
--
ALTER TABLE `roles`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19;
--
-- Constraints for dumped tables
--

--
-- Constraints for table `attendence`
--
ALTER TABLE `attendence`
  ADD CONSTRAINT `attendence_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `attendence_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

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

--
-- Constraints for table `payroll_attendence`
--
ALTER TABLE `payroll_attendence`
  ADD CONSTRAINT `payroll_attendence_attendence_id_foreign` FOREIGN KEY (`attendence_id`) REFERENCES `attendence` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `payroll_attendence_payroll_id_foreign` FOREIGN KEY (`payroll_id`) REFERENCES `payroll` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `payroll_attendence_company`
--
ALTER TABLE `payroll_attendence_company`
  ADD CONSTRAINT `payroll_attendence_company_attendence_id_foreign` FOREIGN KEY (`attendence_id`) REFERENCES `attendence` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `payroll_attendence_company_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `payroll_attendence_company_payroll_id_foreign` FOREIGN KEY (`payroll_id`) REFERENCES `payroll` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `payroll_company`
--
ALTER TABLE `payroll_company`
  ADD CONSTRAINT `payroll_company_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `payroll_company_payroll_id_foreign` FOREIGN KEY (`payroll_id`) REFERENCES `payroll` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `payroll_expenses`
--
ALTER TABLE `payroll_expenses`
  ADD CONSTRAINT `payroll_expenses_payroll_id_foreign` FOREIGN KEY (`payroll_id`) REFERENCES `payroll` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `permission_role`
--
ALTER TABLE `permission_role`
  ADD CONSTRAINT `permission_role_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `permission_role_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `role_user`
--
ALTER TABLE `role_user`
  ADD CONSTRAINT `role_user_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `role_user_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

/*!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 */;
