-- https://www.phpmyadmin.net/
--

START TRANSACTION;



--
-- Database: `pnscrm`
--

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

--
-- Table structure for table `crms`
--

CREATE TABLE `crms` (
  `id` int(10) UNSIGNED NOT NULL,
  `projectname` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `date` date NOT NULL,
  `customer_id` int(10) UNSIGNED NOT NULL,
  `stages_id` int(10) UNSIGNED NOT NULL,
  `tcv` decimal(15,2) DEFAULT NULL,
  `estclosedate` date DEFAULT NULL,
  `product_id` int(10) UNSIGNED NOT NULL,
  `contactsource` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `user_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;

--
-- Dumping data for table `crms`
--

INSERT INTO `crms` (`id`, `projectname`, `date`, `customer_id`, `stages_id`, `tcv`, `estclosedate`, `product_id`, `contactsource`, `user_id`, `created_at`, `updated_at`) VALUES
(1, 'pos and sofg', '2018-07-03', 1, 2, '500.00', '2018-07-29', 1, 'olxx', 1, NULL, '2018-07-09 01:00:51'),
(2, 'moh seychell', '2018-07-07', 1, 4, '500.00', '2018-07-22', 1, 'office enquiry', 2, '2018-07-06 22:51:42', '2018-07-09 00:25:31');

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

--
-- Table structure for table `histories`
--

CREATE TABLE `histories` (
  `id` int(10) UNSIGNED NOT NULL,
  `trackdate` date NOT NULL,
  `memo` text COLLATE utf8_unicode_ci,
  `followup` date DEFAULT NULL,
  `crm_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;

--
-- Dumping data for table `histories`
--

INSERT INTO `histories` (`id`, `trackdate`, `memo`, `followup`, `crm_id`, `created_at`, `updated_at`) VALUES
(1, '2018-07-06', 'Ownership changed from EmpId2 to EmpId1 by joseph', NULL, 1, '2018-07-06 04:20:22', '2018-07-06 04:20:22'),
(2, '2018-07-06', 'Ownership changed from Empriyaanna to EmpId1 by joseph', NULL, 1, '2018-07-06 04:30:30', '2018-07-06 04:30:30'),
(3, '2018-07-06', 'Ownership changed from Emp joseph kurian m to EmpId2 by joseph', NULL, 1, '2018-07-06 04:30:47', '2018-07-06 04:30:47'),
(4, '2018-07-06', 'Ownership changed from Emp riya anna to Emp joseph kurian m by joseph kurian m', NULL, 1, '2018-07-06 04:34:27', '2018-07-06 04:34:27'),
(5, '2018-07-06', 'Ownership changed from EMP joseph kurian m to EMP riya anna by joseph kurian m', NULL, 1, '2018-07-06 04:35:31', '2018-07-06 04:35:31'),
(6, '2018-07-06', 'uwgdokaljz\n\nSYSTEM GENERATED MANAGER ACTION NOTES:-\n* Stage changed from 1 to 2\n', NULL, 1, '2018-07-06 06:07:10', '2018-07-06 06:07:10'),
(7, '2018-07-06', 'jkgfhxg\n\nSYSTEM GENERATED MANAGER ACTION NOTES:-\n* Project Name changed from pos and soft to pos and sofg\n* contact Source changed from olx to olxx\n* Stage changed from 2 to 1\n* Amount changed from 5000.00 to 500.00\n* Deadline changed from 2018-07-21 to 2018-07-29\n', '2018-07-21', 1, '2018-07-06 06:15:33', '2018-07-06 06:15:33'),
(8, '2018-07-07', 'dxkjz', '2018-07-07', 1, '2018-07-06 22:02:19', '2018-07-06 22:02:19'),
(9, '2018-07-07', 'hot', '2018-07-07', 1, '2018-07-06 22:04:35', '2018-07-06 22:04:35'),
(10, '2018-07-07', 'scscaz\n\nSYSTEM GENERATED MANAGER ACTION NOTES:-\n* Stage changed from hot to warm\n', NULL, 1, '2018-07-06 22:04:47', '2018-07-06 22:04:47'),
(11, '2018-07-07', 'Ownership changed from EMP riya anna to EMP joseph kurian m by joseph kurian m', NULL, 1, '2018-07-06 22:05:25', '2018-07-06 22:05:25'),
(12, '2018-07-07', 'ddddddd', '2018-07-07', 2, '2018-07-06 22:51:42', '2018-07-06 22:51:42'),
(13, '2018-07-09', 'ljkuiguj\n\nSYSTEM GENERATED MANAGER ACTION NOTES:-\n* Stage changed from hot to contract\n', NULL, 2, '2018-07-09 00:25:31', '2018-07-09 00:25:31'),
(14, '2018-07-09', 'Product changed from inventory biz to  accruot nexa by joseph kurian m', NULL, 1, '2018-07-09 01:00:21', '2018-07-09 01:00:21'),
(15, '2018-07-09', 'Product changed from accruot nexa to  inventory biz by joseph kurian m', NULL, 1, '2018-07-09 01:00:51', '2018-07-09 01:00:51');

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

--
-- 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, '2018_06_28_162258_create_crms_table', 1),
(4, '2018_06_28_173434_create_customers_table', 1),
(5, '2018_06_28_180602_create_histories_table', 1),
(6, '2018_06_28_182251_create_stages_table', 1),
(7, '2018_06_28_191307_create_products_table', 1),
(8, '2018_06_29_072811_add_user_id_in_crms', 1),
(9, '2018_06_29_092914_add_stages_id_in_crms', 1),
(10, '2018_06_29_094718_create_offices_table', 1),
(11, '2018_06_29_095327_add_offices_id_in_users', 1),
(12, '2018_06_30_040615_add_customer_id_in_crms', 1),
(13, '2018_06_30_041654_add_product_id_in_crms', 1),
(14, '2018_06_30_042929_add_crms_id_in_histories', 1);

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

--
-- Table structure for table `offices`
--

CREATE TABLE `offices` (
  `id` int(10) UNSIGNED NOT NULL,
  `office` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `isdeleted` enum('n','y') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'n',
  `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 `offices`
--

INSERT INTO `offices` (`id`, `office`, `isdeleted`, `created_at`, `updated_at`) VALUES
(1, 'Admin', 'n', NULL, NULL),
(5, 'keflhdsl', 'n', '2018-07-09 01:39:21', '2018-07-09 01:39:21');

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

--
-- Table structure for table `products`
--

CREATE TABLE `products` (
  `id` int(10) UNSIGNED NOT NULL,
  `productname` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `productdescription` varchar(250) 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 `products`
--

INSERT INTO `products` (`id`, `productname`, `productdescription`, `created_at`, `updated_at`) VALUES
(1, 'inventory bizE', 'kljjdx', NULL, '2018-07-10 23:26:31'),
(2, 'accruot nexa', 'dvszx', NULL, NULL),
(3, 'erp', 'fdc', '2018-07-09 03:51:20', '2018-07-09 03:51:20');

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

--
-- Table structure for table `stages`
--

CREATE TABLE `stages` (
  `id` int(10) UNSIGNED NOT NULL,
  `stages` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `odds` decimal(8,2) NOT NULL,
  `color` enum('Primary','Success','Danger','Warning','Info','Light','Dark') 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 `stages`
--

INSERT INTO `stages` (`id`, `stages`, `odds`, `color`, `created_at`, `updated_at`) VALUES
(1, 'hot', '30.00', 'Danger', NULL, NULL),
(2, 'warm', '20.00', 'Success', NULL, NULL),
(3, 'cold', '50.00', 'Dark', '2018-07-08 23:55:26', '2018-07-08 23:55:26'),
(4, 'contract', '100.00', 'Info', '2018-07-09 00:24:48', '2018-07-09 00:24:48');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `crms`
--
ALTER TABLE `crms`
  ADD PRIMARY KEY (`id`),
  ADD KEY `crms_user_id_foreign` (`user_id`),
  ADD KEY `crms_stages_id_foreign` (`stages_id`),
  ADD KEY `crms_customer_id_foreign` (`customer_id`),
  ADD KEY `crms_product_id_foreign` (`product_id`);

--
-- Indexes for table `histories`
--
ALTER TABLE `histories`
  ADD PRIMARY KEY (`id`),
  ADD KEY `histories_crm_id_foreign` (`crm_id`);

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

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

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

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

--
-- AUTO_INCREMENT for dumped tables
--

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

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

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

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

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

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

--
-- Constraints for dumped tables
--

--
-- Constraints for table `crms`
--
ALTER TABLE `crms`
  ADD CONSTRAINT `crms_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `crms_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `crms_stages_id_foreign` FOREIGN KEY (`stages_id`) REFERENCES `stages` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `crms_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `histories`
--
ALTER TABLE `histories`
  ADD CONSTRAINT `histories_crm_id_foreign` FOREIGN KEY (`crm_id`) REFERENCES `crms` (`id`) ON DELETE CASCADE;
COMMIT;

