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

START TRANSACTION;



--
-- Database: `pipeline_db`
--

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

--
-- Stand-in structure for view `company_view`
-- (See below for the actual view)
--
CREATE TABLE `company_view` (
`id` int(11)
,`name` varchar(45)
,`tblcompanytype_id` int(11)
,`company_type` varchar(255)
,`tblindustry_id` int(11)
,`industry_name` varchar(255)
,`email` varchar(45)
,`website` varchar(45)
,`address` mediumtext
);

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

--
-- Stand-in structure for view `contact_view`
-- (See below for the actual view)
--
CREATE TABLE `contact_view` (
`id` int(11)
,`tblcompany_id` int(11)
,`com_name` varchar(45)
,`name` varchar(45)
,`surname` varchar(45)
,`phone` varchar(45)
,`email` varchar(45)
,`status` enum('Active','Inactive')
);

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

--
-- Stand-in structure for view `deal_activity_view`
-- (See below for the actual view)
--
CREATE TABLE `deal_activity_view` (
`id` int(11)
,`detail` longtext
,`datetime` datetime
,`status` enum('Active','Inactive')
,`tbldeal_id` int(11)
,`name` varchar(45)
);

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

--
-- Stand-in structure for view `deal_view`
-- (See below for the actual view)
--
CREATE TABLE `deal_view` (
`deal_id` int(11)
,`deal_name` varchar(45)
,`dealstatus` enum('New','Dealing','Win','Lost','In-progress','Complete','Teminate')
,`dealval` decimal(10,0)
,`tblcompany_id` int(11)
,`company_name` varchar(45)
,`tblcontact_id` int(11)
,`contact_fullname` varchar(91)
,`deal_status` enum('Active','Inactive')
,`tbldealtype_id` int(11)
,`dealtype_name` varchar(45)
,`tblsource_id` int(11)
,`source_name` varchar(45)
,`detail` longtext
,`tbluser_id` int(11)
,`user_fullname` varchar(91)
);

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

--
-- 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, '2019_12_14_000001_create_personal_access_tokens_table', 1),
(2, '2023_08_02_170427_create_sessions_table', 1);

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

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

CREATE TABLE `personal_access_tokens` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `tokenable_type` varchar(255) NOT NULL,
  `tokenable_id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `token` varchar(64) NOT NULL,
  `abilities` text 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 `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
('KFO4pjgZ2E7D1c7ek3c48KKpLuEP6CAG0KJZ8aD2', NULL, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36', 'YTo0OntzOjY6Il90b2tlbiI7czo0MDoiNmFSZnNMVkl3Mk1aSzNpOUV2ZXEzM1RGSnhJaHBTRVp4SVNJY3dSNiI7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6Mjk6Imh0dHA6Ly8xMjcuMC4wLjE6ODAwMC9jb21wYW55Ijt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319czoxNDoiY3VycmVudFNlc3Npb24iO3M6NDoidHJ1ZSI7fQ==', 1691129064);

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

--
-- Table structure for table `tblcompany`
--

CREATE TABLE `tblcompany` (
  `id` int(11) NOT NULL,
  `name` varchar(45) NOT NULL COMMENT 'ชื่อของบริษัทที่ติดต่อ',
  `tblcompanytype_id` int(11) NOT NULL,
  `tblindustry_id` int(11) NOT NULL,
  `email` varchar(45) DEFAULT NULL COMMENT 'email ของบริษัทที่ติดต่อ',
  `website` varchar(45) DEFAULT NULL COMMENT 'เว็บไซต์ของบริษัทที่ติดต่อ',
  `address` mediumtext DEFAULT NULL COMMENT 'ที่อยู่ของบริษัทที่ติดต่อ'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='ตารางเก็บข้อมูลบริษัทที่ติดต่อ';

--
-- Dumping data for table `tblcompany`
--

INSERT INTO `tblcompany` (`id`, `name`, `tblcompanytype_id`, `tblindustry_id`, `email`, `website`, `address`) VALUES
(1, 'AIS', 1, 1, 'ais@co.th', 'https://www.ais.th/', 'น้อมจิตต์ N Mark Plaza, 3105 ชั้น2 Lat Phrao Rd, Khlong Chan, Bang Kapi District, Bangkok 10240'),
(2, 'Kiatnakin Phatra Bank PCL', 1, 1, 'kkpcontactcenter@kkpfg.com', 'https://bank.kkpfg.com/', '209 อาคารเคเคพี ทาวเวอร์ ถนนสุขุมวิท 21 (อโศก) แขวงคลองเตยเหนือ เขตวัฒนา กรุงเทพฯ 10110'),
(3, 'Muang Thai Life (MTL)', 1, 2, 'muangthai@gmail.com', 'https://www.muangthai.co.th/', '250 ถนนรัชดาภิเษก แขวง ห้วยขวาง เขตห้วยขวาง กรุงเทพมหานคร 10310'),
(4, 'SINO S Tech', 2, 1, 'bounta@sinostech.co.th', 'https://www.sinostech.co.th/', '2991-46  Kiertlada Building, Ladprao Road, Soi 101-3'),
(5, 'SINO S Tech', 1, 2, 'bounta@sinostech.co.th', 'f', '2991-46  Kiertlada Building, Ladprao Road, Soi 101-3');

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

--
-- Table structure for table `tblcompanytype`
--

CREATE TABLE `tblcompanytype` (
  `id` int(11) NOT NULL,
  `name` varchar(255) NOT NULL COMMENT 'ชื่อข้อมูลประเภทของบริษัท',
  `status` enum('Active','Inactive') NOT NULL COMMENT 'สถาานะข้องข้อมูลประภทของบริษัท'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='ตารางเก็บข้อมูลประเภทของบริษัท';

--
-- Dumping data for table `tblcompanytype`
--

INSERT INTO `tblcompanytype` (`id`, `name`, `status`) VALUES
(1, 'Telecomunication', 'Active'),
(2, 'Vendor', 'Active'),
(3, 'Partner', 'Active'),
(4, 'hhh', 'Active');

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

--
-- Table structure for table `tblcontact`
--

CREATE TABLE `tblcontact` (
  `id` int(11) NOT NULL,
  `tblcompany_id` int(11) NOT NULL,
  `name` varchar(45) NOT NULL COMMENT 'ชื่อของผู้ติดต่อ',
  `surname` varchar(45) NOT NULL COMMENT 'นามสกุลของผู้ติดต่อ',
  `phone` varchar(45) NOT NULL COMMENT 'เบอร์โทรศัพท์ของผู้ติดต่อ',
  `email` varchar(45) NOT NULL COMMENT 'email ของผู้ติดต่อ',
  `status` enum('Active','Inactive') NOT NULL COMMENT 'สถานะข้อมูลของผู้ติดต่อ'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

--
-- Dumping data for table `tblcontact`
--

INSERT INTO `tblcontact` (`id`, `tblcompany_id`, `name`, `surname`, `phone`, `email`, `status`) VALUES
(1, 2, 'Example 1', 'Example 1', '02 165 5555', 'kkpcontactcenter@kkpfg.com', 'Active'),
(2, 3, 'Bounta', 'Bouphavong', '0641158803', 'bounta@sinostech.co.th', 'Active'),
(3, 1, 'Nawut', 'Virakoun', '0900000000', 'nawat@gmail.com', 'Active'),
(4, 4, 'Bounta', 'Bouphavong', '0641158803', 'bounta@sinostech.co.th', 'Inactive'),
(5, 1, 'Bounta', 'Bouphavong', '0641158803', 'sss@d', 'Active');

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

--
-- Table structure for table `tbldeal`
--

CREATE TABLE `tbldeal` (
  `id` int(11) NOT NULL,
  `name` varchar(45) NOT NULL COMMENT 'ชื่อของดีลหรือโปรเจคต์',
  `dealstatus` enum('New','Dealing','Win','Lost','In-progress','Complete','Teminate') NOT NULL COMMENT 'สถานะของดีล',
  `dealval` decimal(10,0) NOT NULL COMMENT 'มูลค่าของดีล',
  `tblcompany_id` int(11) NOT NULL,
  `tblcontact_id` int(11) NOT NULL,
  `status` enum('Active','Inactive') NOT NULL,
  `tbldealtype_id` int(11) NOT NULL,
  `tblsource_id` int(11) NOT NULL,
  `detail` longtext DEFAULT NULL COMMENT 'ข้อมูลเบื้องต้นของดีล',
  `tbluser_id` int(11) NOT NULL COMMENT 'id ของ user ผู้ดูแลดีล'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='ตารางเก็บข้อมูลดีลหรือโปรเจคต์';

--
-- Dumping data for table `tbldeal`
--

INSERT INTO `tbldeal` (`id`, `name`, `dealstatus`, `dealval`, `tblcompany_id`, `tblcontact_id`, `status`, `tbldealtype_id`, `tblsource_id`, `detail`, `tbluser_id`) VALUES
(1, 'Test System', 'Win', '300000', 2, 1, 'Active', 1, 2, 'Test a system', 2),
(2, 'MTL BD Search', 'Dealing', '20000', 3, 2, 'Active', 1, 1, 'Example', 2),
(3, 'Amazon x AIS', 'Win', '30000', 1, 3, 'Active', 1, 2, '- xxx\r\n- yyy', 2),
(4, 'AAA', 'Lost', '20000', 2, 1, 'Inactive', 1, 2, 'ddd', 2);

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

--
-- Table structure for table `tbldealactivity`
--

CREATE TABLE `tbldealactivity` (
  `id` int(11) NOT NULL,
  `detail` longtext NOT NULL COMMENT 'รายละเอียดของ activity',
  `datetime` datetime NOT NULL COMMENT 'วันเวลาที่ทำการสร้างข้อมูล',
  `status` enum('Active','Inactive') NOT NULL,
  `tbldeal_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='ตารางเก็บข้อมูล deal activity';

--
-- Dumping data for table `tbldealactivity`
--

INSERT INTO `tbldealactivity` (`id`, `detail`, `datetime`, `status`, `tbldeal_id`) VALUES
(1, '- Get data', '2023-07-20 19:00:00', 'Active', 2),
(2, 'กกก', '2023-08-01 12:00:00', 'Active', 1);

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

--
-- Table structure for table `tbldealtype`
--

CREATE TABLE `tbldealtype` (
  `id` int(11) NOT NULL,
  `name` varchar(45) NOT NULL COMMENT 'ประเภทของดีล',
  `status` enum('Active','Inactive') NOT NULL COMMENT 'สถานะของข้อมูลประเภทของดีล'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='ตารางเก็บข้อมูลประเภทของดีล';

--
-- Dumping data for table `tbldealtype`
--

INSERT INTO `tbldealtype` (`id`, `name`, `status`) VALUES
(1, 'Professional Service', 'Active'),
(2, 'xxx', 'Inactive');

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

--
-- Table structure for table `tblindustry`
--

CREATE TABLE `tblindustry` (
  `id` int(11) NOT NULL,
  `name` varchar(255) NOT NULL COMMENT 'ชื่อประเภทของอุตสาหกรรม',
  `status` enum('Active','Inactive') NOT NULL COMMENT 'สถานะของข้อมูลประเภทอุตสาหกรรม'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='ตารางเก็บข้อมูลประเภทของอุตสาหกรรม';

--
-- Dumping data for table `tblindustry`
--

INSERT INTO `tblindustry` (`id`, `name`, `status`) VALUES
(1, 'Telecomunication', 'Active'),
(2, 'Banking', 'Active');

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

--
-- Table structure for table `tblsource`
--

CREATE TABLE `tblsource` (
  `id` int(11) NOT NULL,
  `name` varchar(45) DEFAULT NULL COMMENT 'ชื่อข้อมูลแหล่งที่มา',
  `status` enum('Active','Inactive') DEFAULT NULL COMMENT 'สถานะของข้อมูลแหล่งที่มา'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='ตารางเก็บข้อมูลแหล่งที่มา';

--
-- Dumping data for table `tblsource`
--

INSERT INTO `tblsource` (`id`, `name`, `status`) VALUES
(1, 'Directly deal', 'Inactive'),
(2, 'Source 1', 'Active'),
(3, 'Source 2', 'Inactive'),
(4, 'Source 3', 'Active');

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

--
-- Table structure for table `tbluser`
--

CREATE TABLE `tbluser` (
  `id` int(11) NOT NULL,
  `name` varchar(45) NOT NULL COMMENT 'เก็บข้อมูลชื่อของ User',
  `surname` varchar(45) NOT NULL COMMENT 'เก็บข้อมูลนามสกุลของ User',
  `referenceId` varchar(120) NOT NULL COMMENT 'เก็บข้อมูล id หรือค่า unique ของ User จากฝั่ง Domain',
  `status` enum('Active','Inactive') NOT NULL DEFAULT 'Active' COMMENT 'เก็บข้อมูลสถานะของ User'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='ตารางเก็บข้อมูล user (ได้มาจากการ Authentication ผ่าน Domain)';

--
-- Dumping data for table `tbluser`
--

INSERT INTO `tbluser` (`id`, `name`, `surname`, `referenceId`, `status`) VALUES
(2, 'Bounta', 'Bouphavong', 'iKPqQ7ER7Y8NMCjIw4ftU4Kg8b1AYQs+4/UF0uVUYKx4tKn8SU7WiZwAcyxhZCs3rfd5AeP48sEN1yv/GbpiDvFmRQy+llDWed2+qRtAFDw=', 'Active'),
(5, 'Patinya', 'Ungletakul', '71C5Orzp0BrvXIGOBgsHP5pmQISHMlD4YKoTWW56mOyRGNasEc4sZfIduHd4YYejoSJDT4e4YGdQvZ5fz+OnhhwGO0d/4jVHyWG8WsQcqMU=', 'Active'),
(6, 'Tanapohn', 'Mongkolsukthae', 'ULSteYhdiUBkpwFdISLB45Y1EQ1OQrhZJm7UrvqSxntw+ahYT69wOnRMJC4RWCjiTuMgzdj5ws9WMqARsvm/m+MlFsC11d85ALUnLjZFYwU=', 'Active');

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

--
-- Structure for view `company_view`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `company_view`  AS SELECT `tblcompany`.`id` AS `id`, `tblcompany`.`name` AS `name`, `tblcompany`.`tblcompanytype_id` AS `tblcompanytype_id`, `tblcompanytype`.`name` AS `company_type`, `tblcompany`.`tblindustry_id` AS `tblindustry_id`, `tblindustry`.`name` AS `industry_name`, `tblcompany`.`email` AS `email`, `tblcompany`.`website` AS `website`, `tblcompany`.`address` AS `address` FROM ((`tblcompany` join `tblcompanytype`) join `tblindustry`) WHERE `tblcompany`.`tblcompanytype_id` = `tblcompanytype`.`id` AND `tblcompany`.`tblindustry_id` = `tblindustry`.`id``id`  ;

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

--
-- Structure for view `contact_view`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `contact_view`  AS SELECT `tblcontact`.`id` AS `id`, `tblcontact`.`tblcompany_id` AS `tblcompany_id`, `tblcompany`.`name` AS `com_name`, `tblcontact`.`name` AS `name`, `tblcontact`.`surname` AS `surname`, `tblcontact`.`phone` AS `phone`, `tblcontact`.`email` AS `email`, `tblcontact`.`status` AS `status` FROM (`tblcontact` join `tblcompany`) WHERE `tblcontact`.`tblcompany_id` = `tblcompany`.`id``id`  ;

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

--
-- Structure for view `deal_activity_view`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `deal_activity_view`  AS SELECT `tbldealactivity`.`id` AS `id`, `tbldealactivity`.`detail` AS `detail`, `tbldealactivity`.`datetime` AS `datetime`, `tbldealactivity`.`status` AS `status`, `tbldealactivity`.`tbldeal_id` AS `tbldeal_id`, `tbldeal`.`name` AS `name` FROM (`tbldealactivity` join `tbldeal`) WHERE `tbldealactivity`.`tbldeal_id` = `tbldeal`.`id``id`  ;

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

--
-- Structure for view `deal_view`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `deal_view`  AS SELECT `tbldeal`.`id` AS `deal_id`, `tbldeal`.`name` AS `deal_name`, `tbldeal`.`dealstatus` AS `dealstatus`, `tbldeal`.`dealval` AS `dealval`, `tbldeal`.`tblcompany_id` AS `tblcompany_id`, `tblcompany`.`name` AS `company_name`, `tbldeal`.`tblcontact_id` AS `tblcontact_id`, concat(`tblcontact`.`name`,' ',`tblcontact`.`surname`) AS `contact_fullname`, `tbldeal`.`status` AS `deal_status`, `tbldeal`.`tbldealtype_id` AS `tbldealtype_id`, `tbldealtype`.`name` AS `dealtype_name`, `tbldeal`.`tblsource_id` AS `tblsource_id`, `tblsource`.`name` AS `source_name`, `tbldeal`.`detail` AS `detail`, `tbldeal`.`tbluser_id` AS `tbluser_id`, concat(`tbluser`.`name`,' ',`tbluser`.`surname`) AS `user_fullname` FROM (((((`tbldeal` join `tblcompany`) join `tblcontact`) join `tbldealtype`) join `tblsource`) join `tbluser`) WHERE `tbldeal`.`tblcompany_id` = `tblcompany`.`id` AND `tbldeal`.`tblcontact_id` = `tblcontact`.`id` AND `tbldeal`.`tbldealtype_id` = `tbldealtype`.`id` AND `tbldeal`.`tblsource_id` = `tblsource`.`id` AND `tbldeal`.`tbluser_id` = `tbluser`.`id``id`  ;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `migrations`
--
ALTER TABLE `migrations`
  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 `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 `tblcompany`
--
ALTER TABLE `tblcompany`
  ADD PRIMARY KEY (`id`),
  ADD KEY `tblcompanytype_id_idx` (`tblcompanytype_id`),
  ADD KEY `tblindustry_id_idx` (`tblindustry_id`);

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

--
-- Indexes for table `tblcontact`
--
ALTER TABLE `tblcontact`
  ADD PRIMARY KEY (`id`),
  ADD KEY `tblcompany_id_idx` (`tblcompany_id`);

--
-- Indexes for table `tbldeal`
--
ALTER TABLE `tbldeal`
  ADD PRIMARY KEY (`id`),
  ADD KEY `tblcompany_id_idx` (`tblcompany_id`),
  ADD KEY `tblcontact_id_idx` (`tblcontact_id`),
  ADD KEY `tbldealtype_id_idx` (`tbldealtype_id`),
  ADD KEY `tblsource_id_idx` (`tblsource_id`),
  ADD KEY `tbluser_id_idx` (`tbluser_id`);

--
-- Indexes for table `tbldealactivity`
--
ALTER TABLE `tbldealactivity`
  ADD PRIMARY KEY (`id`),
  ADD KEY `tbldeal_id_idx` (`tbldeal_id`);

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

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

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

--
-- Indexes for table `tbluser`
--
ALTER TABLE `tbluser`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `referenceId_UNIQUE` (`referenceId`);

--
-- AUTO_INCREMENT for dumped tables
--

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

--
-- 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 `tblcompany`
--
ALTER TABLE `tblcompany`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `tblcompanytype`
--
ALTER TABLE `tblcompanytype`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `tblcontact`
--
ALTER TABLE `tblcontact`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `tbldeal`
--
ALTER TABLE `tbldeal`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `tblindustry`
--
ALTER TABLE `tblindustry`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `tblsource`
--
ALTER TABLE `tblsource`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `tbluser`
--
ALTER TABLE `tbluser`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `tblcompany`
--
ALTER TABLE `tblcompany`
  ADD CONSTRAINT `tblcompanytype_id` FOREIGN KEY (`tblcompanytype_id`) REFERENCES `tblcompanytype` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  ADD CONSTRAINT `tblindustry_id` FOREIGN KEY (`tblindustry_id`) REFERENCES `tblindustry` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;

--
-- Constraints for table `tblcontact`
--
ALTER TABLE `tblcontact`
  ADD CONSTRAINT `tblcompany_id` FOREIGN KEY (`tblcompany_id`) REFERENCES `tblcompany` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;

--
-- Constraints for table `tbldeal`
--
ALTER TABLE `tbldeal`
  ADD CONSTRAINT `tblcompanyd_id` FOREIGN KEY (`tblcompany_id`) REFERENCES `tblcompany` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  ADD CONSTRAINT `tblcontactd_id` FOREIGN KEY (`tblcontact_id`) REFERENCES `tblcontact` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  ADD CONSTRAINT `tbldealtype_id` FOREIGN KEY (`tbldealtype_id`) REFERENCES `tbldealtype` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  ADD CONSTRAINT `tblsource_id` FOREIGN KEY (`tblsource_id`) REFERENCES `tblsource` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  ADD CONSTRAINT `tbluser_id` FOREIGN KEY (`tbluser_id`) REFERENCES `tbluser` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;

--
-- Constraints for table `tbldealactivity`
--
ALTER TABLE `tbldealactivity`
  ADD CONSTRAINT `tbldeal_id` FOREIGN KEY (`tbldeal_id`) REFERENCES `tbldeal` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
COMMIT;

