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

START TRANSACTION;



--
-- Database: `u137120877_nenowelfare`
--

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

--
-- Table structure for table `contribution`
--

CREATE TABLE `contribution` (
  `contributionid` int(10) NOT NULL,
  `amount` double(10,2) DEFAULT NULL,
  `dated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `contributiontypeid` int(10) DEFAULT NULL,
  `contributionstagenameid` int(10) DEFAULT NULL,
  `vehicledriverid` int(10) DEFAULT NULL,
  `userid` int(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `contribution`
--

INSERT INTO `contribution` (`contributionid`, `amount`, `dated`, `contributiontypeid`, `contributionstagenameid`, `vehicledriverid`, `userid`) VALUES
(1, 200.00, '2020-10-17 06:46:12', 3, 3, 5, 5),
(2, 250.00, '2020-10-17 06:46:52', 3, 5, 6, 5),
(3, 150.00, '2020-10-17 06:53:14', 3, 6, 5, 5),
(4, 100.00, '2020-10-17 07:12:24', 3, 7, 5, 5),
(5, 100.00, '2020-10-17 07:30:00', 2, 2, 5, 5),
(6, 200.00, '2020-10-17 07:30:00', 1, 2, 5, 5),
(7, 200.00, '2020-10-17 11:55:49', 3, 4, 7, 5),
(8, 150.00, '2020-10-17 14:40:04', 3, 7, 6, 5),
(9, 200.00, '2020-10-22 11:39:48', 3, 3, 5, 5),
(10, 150.00, '2020-10-22 11:55:15', 3, 3, 5, 5),
(11, 250.00, '2020-10-22 11:56:09', 3, 6, 5, 5),
(12, 350.00, '2020-10-22 11:57:55', 3, 7, 6, 5),
(13, 100.00, '2020-10-23 15:05:34', 1, 6, 6, 5),
(14, 300.00, '2020-10-23 15:05:34', 2, 6, 6, 5);

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

--
-- Table structure for table `contributionstagename`
--

CREATE TABLE `contributionstagename` (
  `contributionstagenameid` int(10) NOT NULL,
  `contributionstagename` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `contributionstagename`
--

INSERT INTO `contributionstagename` (`contributionstagenameid`, `contributionstagename`) VALUES
(1, 'EMBU MAIN'),
(2, 'EMBU-MERU'),
(3, 'EMBU-KITUI'),
(4, 'EMBU-THIKA'),
(5, 'NAIROBI'),
(6, 'THIKA'),
(7, 'ISHIARA'),
(8, 'KAWANJARA'),
(9, 'MATUU');

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

--
-- Table structure for table `contributiontype`
--

CREATE TABLE `contributiontype` (
  `contributiontypeid` int(10) NOT NULL,
  `contributiontypename` varchar(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `contributiontype`
--

INSERT INTO `contributiontype` (`contributiontypeid`, `contributiontypename`) VALUES
(1, 'NHIF'),
(2, 'NSSF'),
(3, 'WELFARE CONTRIBUTION');

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

--
-- Table structure for table `designation`
--

CREATE TABLE `designation` (
  `designationid` int(10) NOT NULL,
  `designationname` varchar(500) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `designation`
--

INSERT INTO `designation` (`designationid`, `designationname`) VALUES
(1, 'OWNER'),
(2, 'DRIVER');

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

--
-- Table structure for table `driverprocess`
--

CREATE TABLE `driverprocess` (
  `driverprocessid` int(10) NOT NULL,
  `dated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `processnameid` int(10) DEFAULT NULL,
  `vehicledriverid` int(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `driverprocess`
--

INSERT INTO `driverprocess` (`driverprocessid`, `dated`, `processnameid`, `vehicledriverid`) VALUES
(4, '2020-10-17 07:18:07', 2, 6);

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

--
-- Table structure for table `driverresolution`
--

CREATE TABLE `driverresolution` (
  `driverresolutionid` int(10) NOT NULL,
  `dated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `resolutionnameid` int(10) DEFAULT NULL,
  `driverprocessid` int(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `ownerprocess`
--

CREATE TABLE `ownerprocess` (
  `ownerprocessid` int(10) NOT NULL,
  `dated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `processnameid` int(10) DEFAULT NULL,
  `vehicleownerid` int(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `ownerresolution`
--

CREATE TABLE `ownerresolution` (
  `ownerresolutionid` int(10) NOT NULL,
  `dated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `resolutionnameid` int(10) DEFAULT NULL,
  `ownerprocessid` int(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `person`
--

CREATE TABLE `person` (
  `personid` int(10) NOT NULL,
  `name` varchar(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  `idno` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  `telno` varchar(12) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  `nhifno` varchar(10) DEFAULT NULL,
  `nssfno` varchar(10) DEFAULT NULL,
  `residence` varchar(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  `others` varchar(500) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  `transactiondate` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `person`
--

INSERT INTO `person` (`personid`, `name`, `idno`, `telno`, `nhifno`, `nssfno`, `residence`, `others`, `transactiondate`) VALUES
(1, 'peter nenoadmin', '11', '11', NULL, NULL, 'EMBU', NULL, '2020-08-18 07:57:34'),
(2, 'john greenadmin', '22', '22', NULL, NULL, 'MANYATTA', NULL, '2020-08-18 07:57:34'),
(3, 'joyce eemoadmin', '33', '33', NULL, NULL, 'ISHIARA', NULL, '2020-08-18 07:57:34'),
(4, 'RINA NEEMA', '22578615', '0728451236', NULL, NULL, 'KIBUGU', NULL, '2020-08-18 07:58:57'),
(5, 'NINA REHEMA', '25639874', '0725486923', NULL, NULL, 'KANGETHIA', NULL, '2020-08-18 08:00:54'),
(6, 'DESTINY MWENDE', '5234512', '0723698521', NULL, NULL, 'WEUMIRIRIE', NULL, '2020-08-18 08:02:14'),
(7, 'ERIC MWAMUNGA', '1111', '01111', NULL, NULL, 'LAMU', NULL, '2020-08-18 08:03:51'),
(8, 'WISDOM NGARI', '28074156', '0724156325', NULL, NULL, 'KIAMBU', NULL, '2020-08-18 08:04:01'),
(9, 'NINA KARIMI', '21456389', '072536295', NULL, NULL, 'KIKUYU', NULL, '2020-08-18 08:06:16'),
(10, 'GEORGE KARIUKI', '3311', '0333333', NULL, NULL, 'KITALE', NULL, '2020-08-18 08:06:47'),
(11, 'DORIS KAMAU', '3322', '0333322', NULL, NULL, 'MACHAKOS', NULL, '2020-08-18 08:09:16'),
(12, 'MIKE NJIRU', '3333', '03333330', NULL, NULL, 'RUNDA', NULL, '2020-08-18 08:21:45'),
(13, 'KEN WANJALA', '3344', '033334', NULL, NULL, 'KEROKA', NULL, '2020-08-18 08:23:59'),
(14, 'BORIS YELSTIN', '3355', '0333335', NULL, NULL, 'MOSCOW', NULL, '2020-08-18 08:29:32'),
(15, 'ANN CHEBET', '8899', '078888', NULL, NULL, 'VOI', NULL, '2020-08-18 10:25:52'),
(16, 'WILLIAM KIOMET', '4466', '07222555', NULL, NULL, 'AINAMOI', NULL, '2020-08-18 10:28:43'),
(17, 'Thomas MWangi', '1809698', '0719623344', NULL, NULL, 'Sabasaba', NULL, '2020-08-18 10:41:09'),
(18, 'ANNET NDWIGA', '9966', '07999999', NULL, NULL, 'BLUE VALLEY', NULL, '2020-08-18 10:56:09'),
(19, 'Mukundi Nkagi', '4455661', '0708456789', NULL, NULL, 'Kutus', NULL, '2020-08-18 16:09:47'),
(20, 'Kimani Murimi Joseph', '45678911', '0800223344', NULL, NULL, 'Meru', NULL, '2020-08-18 16:47:52'),
(21, 'IIAn Woody Smith', '3456789', '0775346579', NULL, NULL, 'Naro', NULL, '2020-08-18 16:52:01'),
(22, 'Don Kiku Mocha', '4231568', '0778346123', NULL, NULL, 'Koimbe', NULL, '2020-08-18 16:56:19'),
(23, 'SAM MUTUGI', '111111', '0111111', NULL, NULL, 'KIBUGU', NULL, '2020-08-19 05:43:04'),
(24, 'WILLIAM KAMAU', '2222', '0222222', NULL, NULL, 'EMBU', NULL, '2020-08-19 05:45:27'),
(25, 'MERCY WAITHAKA', '114433', '00114433', NULL, NULL, 'KANGUNDO', NULL, '2020-08-21 11:51:53'),
(26, 'MARTHA KOOME', '332233', '0332233', NULL, NULL, 'NKUBU', NULL, '2020-08-21 12:09:38'),
(27, 'PETER KARANJA', '5656', '0724545454', NULL, NULL, 'MUIGA', NULL, '2020-08-25 11:50:59'),
(28, 'DIDMUS BARAZA', '336699', '0336699', '336633', '663366', 'BUTERE', NULL, '2020-09-13 00:28:41');

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

--
-- Table structure for table `persondesignation`
--

CREATE TABLE `persondesignation` (
  `persondesignationid` int(10) NOT NULL,
  `personid` int(10) DEFAULT NULL,
  `designationid` int(10) DEFAULT NULL,
  `status` int(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `persondesignation`
--

INSERT INTO `persondesignation` (`persondesignationid`, `personid`, `designationid`, `status`) VALUES
(7, 7, 1, NULL),
(8, 11, 1, NULL),
(9, 24, 2, NULL),
(10, 18, 2, NULL),
(11, 16, 2, NULL);

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

--
-- Table structure for table `personvehicle`
--

CREATE TABLE `personvehicle` (
  `personvehicleid` int(10) NOT NULL,
  `driverpassenger` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  `deletestatus` int(10) DEFAULT NULL,
  `transactionnumberid` int(10) DEFAULT NULL,
  `personid` int(10) DEFAULT NULL,
  `vehicleid` int(10) DEFAULT NULL,
  `seatid` int(10) DEFAULT NULL,
  `stagefromid` int(10) DEFAULT NULL,
  `stagetoid` int(10) DEFAULT NULL,
  `userid` int(10) DEFAULT NULL,
  `transactiondate` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `personvehicle`
--

INSERT INTO `personvehicle` (`personvehicleid`, `driverpassenger`, `deletestatus`, `transactionnumberid`, `personid`, `vehicleid`, `seatid`, `stagefromid`, `stagetoid`, `userid`, `transactiondate`) VALUES
(1, NULL, 1, 4, 5, 1, 4, 3, 6, NULL, '2020-08-18 08:00:54'),
(2, NULL, 1, 4, 6, 1, 4, 3, 6, NULL, '2020-08-18 08:02:14'),
(3, NULL, 1, 5, 8, 2, 5, 1, 2, NULL, '2020-08-18 08:04:01'),
(4, NULL, 1, 5, 9, 2, 5, 1, 2, NULL, '2020-08-18 08:06:16'),
(5, NULL, 1, 6, 10, 3, 5, 2, 5, NULL, '2020-08-18 08:06:47'),
(6, NULL, 1, 6, 11, 3, 5, 2, 5, NULL, '2020-08-18 08:09:16'),
(7, NULL, 1, 6, 12, 3, 2, 2, 5, NULL, '2020-08-18 08:21:45'),
(8, NULL, 1, 6, 13, 3, 6, 2, 5, NULL, '2020-08-18 08:23:59'),
(9, NULL, 1, 6, 14, 3, 4, 2, 5, NULL, '2020-08-18 08:29:32'),
(10, NULL, 1, 8, 16, 2, 4, 2, 4, NULL, '2020-08-18 10:28:43'),
(11, NULL, 1, 6, 18, 1, 5, 2, 5, NULL, '2020-08-18 10:56:09'),
(12, NULL, 1, 2, 19, 1, 3, 6, 3, NULL, '2020-08-18 16:09:47'),
(13, NULL, 1, 13, 24, 1, 3, 1, 2, NULL, '2020-08-19 05:45:27'),
(14, NULL, 1, 13, 12, 1, 4, 1, 2, 11, '2020-08-19 05:46:44'),
(15, NULL, 1, 1, 27, 1, 4, 3, 5, NULL, '2020-08-25 11:50:59'),
(16, NULL, 1, 15, 14, 2, 3, 3, 4, 5, '2020-10-17 11:58:29'),
(17, NULL, 1, 15, 12, 2, 5, 3, 4, 5, '2020-10-17 11:59:06'),
(18, NULL, 1, 15, 18, 1, 3, 3, 5, 5, '2020-10-23 14:21:00');

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

--
-- Table structure for table `processname`
--

CREATE TABLE `processname` (
  `processnameid` int(10) NOT NULL,
  `processname` varchar(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  `details` varchar(500) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `processname`
--

INSERT INTO `processname` (`processnameid`, `processname`, `details`) VALUES
(1, 'SOLD', 'VEHICLE SOLD'),
(2, 'SUSPENDED', 'OVERSPEEDING'),
(3, 'SUSPENDED', 'BAD LANGUAGE'),
(4, 'SUSPENDED', 'FIGHTING');

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

--
-- Table structure for table `resolutionname`
--

CREATE TABLE `resolutionname` (
  `resolutionnameid` int(10) NOT NULL,
  `resolutionname` varchar(500) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `resolutionname`
--

INSERT INTO `resolutionname` (`resolutionnameid`, `resolutionname`) VALUES
(1, 'VEHICLE SOLD'),
(2, 'SUSPENDED 2 WEEKS'),
(3, 'FINED'),
(4, 'SACKED');

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

--
-- Table structure for table `sacco`
--

CREATE TABLE `sacco` (
  `saccoid` int(10) NOT NULL,
  `sacconame` varchar(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  `saccousers` int(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `sacco`
--

INSERT INTO `sacco` (`saccoid`, `sacconame`, `saccousers`) VALUES
(1, 'NENO SACCO', 20),
(2, 'GREENLAND SACCO', 4),
(3, 'EEMO SACCO', 5);

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

--
-- Table structure for table `seat`
--

CREATE TABLE `seat` (
  `seatid` int(10) NOT NULL,
  `seatno` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `seat`
--

INSERT INTO `seat` (`seatid`, `seatno`) VALUES
(1, 'A0'),
(2, 'A1'),
(3, 'B1'),
(4, 'B2'),
(5, 'C1'),
(6, 'C2');

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

--
-- Table structure for table `stagefrom`
--

CREATE TABLE `stagefrom` (
  `stagefromid` int(10) NOT NULL,
  `stagefromname` varchar(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `stagefrom`
--

INSERT INTO `stagefrom` (`stagefromid`, `stagefromname`) VALUES
(1, 'NAIROBI'),
(2, 'EMBU'),
(3, 'THIKA'),
(4, 'RUNYENJES'),
(5, 'MATUU'),
(6, 'KITUI');

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

--
-- Table structure for table `stageto`
--

CREATE TABLE `stageto` (
  `stagetoid` int(10) NOT NULL,
  `stagetoname` varchar(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `stageto`
--

INSERT INTO `stageto` (`stagetoid`, `stagetoname`) VALUES
(1, 'NAIROBI'),
(2, 'EMBU'),
(3, 'THIKA'),
(4, 'RUNYENJES'),
(5, 'MATUU'),
(6, 'KITUI');

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

--
-- Table structure for table `transactionnumber`
--

CREATE TABLE `transactionnumber` (
  `transactionnumberid` int(10) NOT NULL,
  `transactionnumber` int(10) DEFAULT NULL,
  `userid` int(10) DEFAULT NULL,
  `transactiondate` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `transactionnumber`
--

INSERT INTO `transactionnumber` (`transactionnumberid`, `transactionnumber`, `userid`, `transactiondate`) VALUES
(1, 1, 1, '2020-08-18 07:57:34'),
(2, 1, 2, '2020-08-18 07:57:34'),
(3, 1, 3, '2020-08-18 07:57:34'),
(4, 1, 4, '2020-08-18 07:58:57'),
(5, 2, 4, '2020-08-18 08:02:31'),
(6, 1, 5, '2020-08-18 08:03:51'),
(7, 3, 4, '2020-08-18 08:33:22'),
(8, 1, 6, '2020-08-18 10:25:52'),
(9, 1, 7, '2020-08-18 10:41:09'),
(10, 1, 8, '2020-08-18 16:47:52'),
(11, 1, 9, '2020-08-18 16:52:01'),
(12, 1, 10, '2020-08-18 16:56:19'),
(13, 1, 11, '2020-08-19 05:43:04'),
(14, 2, 11, '2020-08-19 05:48:30'),
(15, 2, 5, '2020-10-17 11:57:22');

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

--
-- Table structure for table `vehicle`
--

CREATE TABLE `vehicle` (
  `vehicleid` int(10) NOT NULL,
  `regno` varchar(8) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  `description` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  `passengers` int(10) DEFAULT NULL,
  `userid` int(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `vehicle`
--

INSERT INTO `vehicle` (`vehicleid`, `regno`, `description`, `passengers`, `userid`) VALUES
(1, 'KAA 111A', 'shuttle', NULL, 1),
(2, 'KAB 111B', 'shuttle', NULL, 1),
(3, 'KAC 111C', 'shuttle', NULL, 1),
(4, 'KAD 111D', '14 seater', NULL, 1),
(5, 'KAE 111E', 'shuttle', NULL, 1),
(6, 'KCG 111G', '14 SEATER', NULL, 1),
(7, 'KCW 111A', 'SHUTTLE', NULL, 1),
(8, 'KCW 111B', 'SHUTTLE', NULL, 1),
(9, 'KCV 333E', '14 SEATER', NULL, 1),
(10, 'KAA 333T', '14 SEATER', NULL, 1),
(11, 'KAL 111L', '7 SEATER', NULL, 5);

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

--
-- Table structure for table `vehicledriver`
--

CREATE TABLE `vehicledriver` (
  `vehicledriverid` int(10) NOT NULL,
  `dated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `persondesignationid` int(10) DEFAULT NULL,
  `vehicleownerid` int(10) DEFAULT NULL,
  `attachmentstatus` int(10) DEFAULT NULL,
  `suspensionstatus` int(10) DEFAULT NULL,
  `userid` int(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `vehicledriver`
--

INSERT INTO `vehicledriver` (`vehicledriverid`, `dated`, `persondesignationid`, `vehicleownerid`, `attachmentstatus`, `suspensionstatus`, `userid`) VALUES
(5, '2020-10-17 06:28:19', 9, 4, 1, 1, 5),
(6, '2020-10-17 06:30:41', 10, 5, 1, 1, 5),
(7, '2020-10-17 06:32:44', 11, 6, 1, 1, 5);

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

--
-- Table structure for table `vehicleowner`
--

CREATE TABLE `vehicleowner` (
  `vehicleownerid` int(10) NOT NULL,
  `dated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `persondesignationid` int(10) DEFAULT NULL,
  `vehicleid` int(10) DEFAULT NULL,
  `attachmentstatus` int(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `vehicleowner`
--

INSERT INTO `vehicleowner` (`vehicleownerid`, `dated`, `persondesignationid`, `vehicleid`, `attachmentstatus`) VALUES
(4, '2020-10-17 06:23:59', 7, 1, 1),
(5, '2020-10-17 06:25:53', 7, 2, 1),
(6, '2020-10-17 06:26:21', 8, 3, 1);

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

--
-- Stand-in structure for view `viewdrivers`
-- (See below for the actual view)
--
CREATE TABLE `viewdrivers` (
`name` varchar(200)
,`idno` varchar(10)
,`telno` varchar(12)
,`regno` varchar(8)
,`driverprocessid` int(10)
,`processnameid` int(10)
,`issuedate` timestamp
,`driverresolutionid` int(10)
,`resolutionnameid` int(10)
,`resolutiondate` timestamp
,`attachmentstatus` int(10)
,`vehicledriverid` int(10)
,`username` varchar(50)
,`usertype` varchar(100)
,`userid` int(10)
);

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

--
-- Structure for view `viewdrivers`
--

--
-- Indexes for dumped tables
--

--
-- Indexes for table `contribution`
--
ALTER TABLE `contribution`
  ADD PRIMARY KEY (`contributionid`),
  ADD KEY `contributionstagenameid` (`contributionstagenameid`),
  ADD KEY `vehicledriverid` (`vehicledriverid`),
  ADD KEY `contributiontypeid` (`contributiontypeid`);

--
-- Indexes for table `contributionstagename`
--
ALTER TABLE `contributionstagename`
  ADD PRIMARY KEY (`contributionstagenameid`);

--
-- Indexes for table `contributiontype`
--
ALTER TABLE `contributiontype`
  ADD PRIMARY KEY (`contributiontypeid`);

--
-- Indexes for table `designation`
--
ALTER TABLE `designation`
  ADD PRIMARY KEY (`designationid`);

--
-- Indexes for table `driverprocess`
--
ALTER TABLE `driverprocess`
  ADD PRIMARY KEY (`driverprocessid`),
  ADD KEY `processnameid` (`processnameid`),
  ADD KEY `vehicledriverid` (`vehicledriverid`);

--
-- Indexes for table `driverresolution`
--
ALTER TABLE `driverresolution`
  ADD PRIMARY KEY (`driverresolutionid`),
  ADD KEY `resolutionnameid` (`resolutionnameid`),
  ADD KEY `driverprocessid` (`driverprocessid`);

--
-- Indexes for table `ownerprocess`
--
ALTER TABLE `ownerprocess`
  ADD PRIMARY KEY (`ownerprocessid`),
  ADD KEY `processnameid` (`processnameid`),
  ADD KEY `vehicleownerid` (`vehicleownerid`);

--
-- Indexes for table `ownerresolution`
--
ALTER TABLE `ownerresolution`
  ADD PRIMARY KEY (`ownerresolutionid`),
  ADD KEY `resolutionnameid` (`resolutionnameid`),
  ADD KEY `ownerprocessid` (`ownerprocessid`);

--
-- Indexes for table `person`
--
ALTER TABLE `person`
  ADD PRIMARY KEY (`personid`);

--
-- Indexes for table `persondesignation`
--
ALTER TABLE `persondesignation`
  ADD PRIMARY KEY (`persondesignationid`),
  ADD KEY `personid` (`personid`),
  ADD KEY `designationid` (`designationid`);

--
-- Indexes for table `personvehicle`
--
ALTER TABLE `personvehicle`
  ADD PRIMARY KEY (`personvehicleid`),
  ADD KEY `personid` (`personid`),
  ADD KEY `vehicleid` (`vehicleid`),
  ADD KEY `seatid` (`seatid`),
  ADD KEY `stagefromid` (`stagefromid`),
  ADD KEY `stagetoid` (`stagetoid`),
  ADD KEY `userid` (`userid`),
  ADD KEY `transactionnumberid` (`transactionnumberid`);

--
-- Indexes for table `processname`
--
ALTER TABLE `processname`
  ADD PRIMARY KEY (`processnameid`);

--
-- Indexes for table `resolutionname`
--
ALTER TABLE `resolutionname`
  ADD PRIMARY KEY (`resolutionnameid`);

--
-- Indexes for table `sacco`
--
ALTER TABLE `sacco`
  ADD PRIMARY KEY (`saccoid`);

--
-- Indexes for table `seat`
--
ALTER TABLE `seat`
  ADD PRIMARY KEY (`seatid`);

--
-- Indexes for table `stagefrom`
--
ALTER TABLE `stagefrom`
  ADD PRIMARY KEY (`stagefromid`);

--
-- Indexes for table `stageto`
--
ALTER TABLE `stageto`
  ADD PRIMARY KEY (`stagetoid`);

--
-- Indexes for table `transactionnumber`
--
ALTER TABLE `transactionnumber`
  ADD PRIMARY KEY (`transactionnumberid`);

--
-- Indexes for table `vehicle`
--
ALTER TABLE `vehicle`
  ADD PRIMARY KEY (`vehicleid`),
  ADD KEY `userid` (`userid`);

--
-- Indexes for table `vehicledriver`
--
ALTER TABLE `vehicledriver`
  ADD PRIMARY KEY (`vehicledriverid`),
  ADD KEY `persondesignationid` (`persondesignationid`),
  ADD KEY `vehicleownerid` (`vehicleownerid`),
  ADD KEY `userid` (`userid`);

--
-- Indexes for table `vehicleowner`
--
ALTER TABLE `vehicleowner`
  ADD PRIMARY KEY (`vehicleownerid`),
  ADD KEY `persondesignationid` (`persondesignationid`),
  ADD KEY `vehicleid` (`vehicleid`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `contribution`
--
ALTER TABLE `contribution`
  MODIFY `contributionid` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;

--
-- AUTO_INCREMENT for table `contributionstagename`
--
ALTER TABLE `contributionstagename`
  MODIFY `contributionstagenameid` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- AUTO_INCREMENT for table `contributiontype`
--
ALTER TABLE `contributiontype`
  MODIFY `contributiontypeid` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `designation`
--
ALTER TABLE `designation`
  MODIFY `designationid` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `driverprocess`
--
ALTER TABLE `driverprocess`
  MODIFY `driverprocessid` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `driverresolution`
--
ALTER TABLE `driverresolution`
  MODIFY `driverresolutionid` int(10) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `ownerprocess`
--
ALTER TABLE `ownerprocess`
  MODIFY `ownerprocessid` int(10) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `ownerresolution`
--
ALTER TABLE `ownerresolution`
  MODIFY `ownerresolutionid` int(10) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `person`
--
ALTER TABLE `person`
  MODIFY `personid` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=29;

--
-- AUTO_INCREMENT for table `persondesignation`
--
ALTER TABLE `persondesignation`
  MODIFY `persondesignationid` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;

--
-- AUTO_INCREMENT for table `personvehicle`
--
ALTER TABLE `personvehicle`
  MODIFY `personvehicleid` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19;

--
-- AUTO_INCREMENT for table `processname`
--
ALTER TABLE `processname`
  MODIFY `processnameid` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `resolutionname`
--
ALTER TABLE `resolutionname`
  MODIFY `resolutionnameid` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `sacco`
--
ALTER TABLE `sacco`
  MODIFY `saccoid` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `seat`
--
ALTER TABLE `seat`
  MODIFY `seatid` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- AUTO_INCREMENT for table `stagefrom`
--
ALTER TABLE `stagefrom`
  MODIFY `stagefromid` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- AUTO_INCREMENT for table `stageto`
--
ALTER TABLE `stageto`
  MODIFY `stagetoid` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- AUTO_INCREMENT for table `transactionnumber`
--
ALTER TABLE `transactionnumber`
  MODIFY `transactionnumberid` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16;

--
-- AUTO_INCREMENT for table `vehicle`
--
ALTER TABLE `vehicle`
  MODIFY `vehicleid` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;

--
-- AUTO_INCREMENT for table `vehicledriver`
--
ALTER TABLE `vehicledriver`
  MODIFY `vehicledriverid` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--
-- AUTO_INCREMENT for table `vehicleowner`
--
ALTER TABLE `vehicleowner`
  MODIFY `vehicleownerid` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `contribution`
--
ALTER TABLE `contribution`
  ADD CONSTRAINT `contribution_ibfk_1` FOREIGN KEY (`contributionstagenameid`) REFERENCES `contributionstagename` (`contributionstagenameid`) ON DELETE NO ACTION ON UPDATE CASCADE,
  ADD CONSTRAINT `contribution_ibfk_2` FOREIGN KEY (`vehicledriverid`) REFERENCES `vehicledriver` (`vehicledriverid`) ON DELETE NO ACTION ON UPDATE CASCADE,
  ADD CONSTRAINT `contribution_ibfk_3` FOREIGN KEY (`contributiontypeid`) REFERENCES `contributiontype` (`contributiontypeid`) ON DELETE NO ACTION ON UPDATE CASCADE;

--
-- Constraints for table `driverprocess`
--
ALTER TABLE `driverprocess`
  ADD CONSTRAINT `driverprocess_ibfk_1` FOREIGN KEY (`processnameid`) REFERENCES `processname` (`processnameid`) ON DELETE NO ACTION ON UPDATE CASCADE,
  ADD CONSTRAINT `driverprocess_ibfk_2` FOREIGN KEY (`vehicledriverid`) REFERENCES `vehicledriver` (`vehicledriverid`) ON DELETE NO ACTION ON UPDATE CASCADE;

--
-- Constraints for table `driverresolution`
--
ALTER TABLE `driverresolution`
  ADD CONSTRAINT `driverresolution_ibfk_1` FOREIGN KEY (`resolutionnameid`) REFERENCES `resolutionname` (`resolutionnameid`) ON DELETE NO ACTION ON UPDATE CASCADE,
  ADD CONSTRAINT `driverresolution_ibfk_2` FOREIGN KEY (`driverprocessid`) REFERENCES `driverprocess` (`driverprocessid`) ON DELETE NO ACTION ON UPDATE CASCADE;

--
-- Constraints for table `ownerprocess`
--
ALTER TABLE `ownerprocess`
  ADD CONSTRAINT `ownerprocess_ibfk_1` FOREIGN KEY (`processnameid`) REFERENCES `processname` (`processnameid`) ON DELETE NO ACTION ON UPDATE CASCADE,
  ADD CONSTRAINT `ownerprocess_ibfk_2` FOREIGN KEY (`vehicleownerid`) REFERENCES `vehicleowner` (`vehicleownerid`) ON DELETE NO ACTION ON UPDATE CASCADE;

--
-- Constraints for table `ownerresolution`
--
ALTER TABLE `ownerresolution`
  ADD CONSTRAINT `ownerresolution_ibfk_1` FOREIGN KEY (`resolutionnameid`) REFERENCES `resolutionname` (`resolutionnameid`) ON DELETE NO ACTION ON UPDATE CASCADE,
  ADD CONSTRAINT `ownerresolution_ibfk_2` FOREIGN KEY (`ownerprocessid`) REFERENCES `ownerprocess` (`ownerprocessid`) ON DELETE NO ACTION ON UPDATE CASCADE;

--
-- Constraints for table `persondesignation`
--
ALTER TABLE `persondesignation`
  ADD CONSTRAINT `persondesignation_ibfk_1` FOREIGN KEY (`personid`) REFERENCES `person` (`personid`) ON DELETE NO ACTION ON UPDATE CASCADE,
  ADD CONSTRAINT `persondesignation_ibfk_2` FOREIGN KEY (`designationid`) REFERENCES `designation` (`designationid`) ON DELETE NO ACTION ON UPDATE CASCADE;

--
-- Constraints for table `personvehicle`
--
ALTER TABLE `personvehicle`
  ADD CONSTRAINT `personvehicle_ibfk_1` FOREIGN KEY (`personid`) REFERENCES `person` (`personid`) ON DELETE NO ACTION ON UPDATE CASCADE,
  ADD CONSTRAINT `personvehicle_ibfk_2` FOREIGN KEY (`vehicleid`) REFERENCES `vehicle` (`vehicleid`) ON DELETE NO ACTION ON UPDATE CASCADE,
  ADD CONSTRAINT `personvehicle_ibfk_3` FOREIGN KEY (`seatid`) REFERENCES `seat` (`seatid`) ON DELETE NO ACTION ON UPDATE CASCADE,
  ADD CONSTRAINT `personvehicle_ibfk_4` FOREIGN KEY (`stagefromid`) REFERENCES `stagefrom` (`stagefromid`) ON DELETE NO ACTION ON UPDATE CASCADE,
  ADD CONSTRAINT `personvehicle_ibfk_5` FOREIGN KEY (`stagetoid`) REFERENCES `stageto` (`stagetoid`) ON DELETE NO ACTION ON UPDATE CASCADE,
  ADD CONSTRAINT `personvehicle_ibfk_6` FOREIGN KEY (`userid`) REFERENCES `user` (`userid`) ON DELETE NO ACTION ON UPDATE CASCADE,
  ADD CONSTRAINT `personvehicle_ibfk_7` FOREIGN KEY (`transactionnumberid`) REFERENCES `transactionnumber` (`transactionnumberid`) ON DELETE NO ACTION ON UPDATE CASCADE;

--
-- Constraints for table `vehicle`
--
ALTER TABLE `vehicle`
  ADD CONSTRAINT `vehicle_ibfk_1` FOREIGN KEY (`userid`) REFERENCES `user` (`userid`) ON DELETE NO ACTION ON UPDATE CASCADE;

--
-- Constraints for table `vehicledriver`
--
ALTER TABLE `vehicledriver`
  ADD CONSTRAINT `vehicledriver_ibfk_1` FOREIGN KEY (`persondesignationid`) REFERENCES `persondesignation` (`persondesignationid`) ON DELETE NO ACTION ON UPDATE CASCADE,
  ADD CONSTRAINT `vehicledriver_ibfk_2` FOREIGN KEY (`vehicleownerid`) REFERENCES `vehicleowner` (`vehicleownerid`) ON DELETE NO ACTION ON UPDATE CASCADE,
  ADD CONSTRAINT `vehicledriver_ibfk_3` FOREIGN KEY (`userid`) REFERENCES `user` (`userid`) ON DELETE NO ACTION ON UPDATE CASCADE;

--
-- Constraints for table `vehicleowner`
--
ALTER TABLE `vehicleowner`
  ADD CONSTRAINT `vehicleowner_ibfk_1` FOREIGN KEY (`persondesignationid`) REFERENCES `persondesignation` (`persondesignationid`) ON DELETE NO ACTION ON UPDATE CASCADE,
  ADD CONSTRAINT `vehicleowner_ibfk_2` FOREIGN KEY (`vehicleid`) REFERENCES `vehicle` (`vehicleid`) ON DELETE NO ACTION ON UPDATE CASCADE;
COMMIT;

