-- phpMyAdmin SQL Dump
-- version 5.2.0
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Oct 30, 2022 at 09:23 AM
-- Server version: 10.4.25-MariaDB
-- PHP Version: 8.0.23

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

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

--
-- Table structure for table `asset`
--

CREATE TABLE `asset` (
  `AssetID` varchar(50) NOT NULL,
  `AssetName` varchar(100) NOT NULL,
  `IsActive` tinyint(1) NOT NULL DEFAULT 1,
  `CreatedAt` timestamp NOT NULL DEFAULT current_timestamp(),
  `UpdatedAt` timestamp(1) NOT NULL DEFAULT current_timestamp(1),
  `AssetCategoryID` int(11) NOT NULL,
  `IsInServiceCenter` tinyint(1) NOT NULL DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `asset`
--

INSERT INTO `asset` (`AssetID`, `AssetName`, `IsActive`, `CreatedAt`, `UpdatedAt`, `AssetCategoryID`, `IsInServiceCenter`) VALUES
('HE5130TK22157196', 'Lithium - ion Battery', 1, '2022-10-28 09:06:49', '2022-10-28 09:06:49.2', 1, 0),
('HE5130TK22158489', 'Lithium - ion Battery', 1, '2022-10-28 09:09:14', '2022-10-28 09:09:14.1', 1, 1),
('HE5130TK22159795', 'Lithium Battery', 1, '2022-10-28 10:41:17', '2022-10-28 10:41:17.3', 1, 1);

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

--
-- Table structure for table `assetcategory`
--

CREATE TABLE `assetcategory` (
  `AssetCategoryID` int(11) NOT NULL,
  `AssetCategoryTitle` varchar(20) NOT NULL,
  `IsActive` tinyint(1) DEFAULT 1,
  `CreatedAt` timestamp NOT NULL DEFAULT current_timestamp(),
  `UpdatedAt` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `assetcategory`
--

INSERT INTO `assetcategory` (`AssetCategoryID`, `AssetCategoryTitle`, `IsActive`, `CreatedAt`, `UpdatedAt`) VALUES
(1, 'Battery', 1, '2022-10-28 09:08:24', '2022-10-28 09:08:24'),
(2, 'Vehicle', 1, '2022-10-28 09:08:29', '2022-10-28 09:08:29');

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

--
-- Table structure for table `paymenttypes`
--

CREATE TABLE `paymenttypes` (
  `PaymentTypeID` int(11) NOT NULL,
  `PaymentTypeTitle` varchar(20) NOT NULL,
  `IsActive` int(11) NOT NULL,
  `CreatedAt` timestamp NOT NULL DEFAULT current_timestamp(),
  `UpdatedAt` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `rechargehistory`
--

CREATE TABLE `rechargehistory` (
  `RechargeHistoryID` int(11) NOT NULL,
  `RiderID` varchar(20) NOT NULL,
  `TransactionID` varchar(20) DEFAULT NULL,
  `PaymentTypeID` int(11) NOT NULL DEFAULT 1,
  `IsActive` int(11) NOT NULL DEFAULT 1,
  `CreatedAt` timestamp NULL DEFAULT current_timestamp(),
  `UpdatedAt` timestamp NOT NULL DEFAULT current_timestamp(),
  `RechargeCount` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `rechargehistory`
--

INSERT INTO `rechargehistory` (`RechargeHistoryID`, `RiderID`, `TransactionID`, `PaymentTypeID`, `IsActive`, `CreatedAt`, `UpdatedAt`, `RechargeCount`) VALUES
(1, '8124308141', '', 1, 1, '2022-10-28 09:10:21', '2022-10-28 09:10:21', 2),
(2, '7305325141', '', 1, 1, '2022-10-28 10:38:37', '2022-10-28 10:38:37', 2);

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

--
-- Table structure for table `refer`
--

CREATE TABLE `refer` (
  `ReferID` int(11) NOT NULL,
  `UserID` int(11) NOT NULL,
  `UserReferID` int(11) NOT NULL,
  `ReferedUserID` int(11) NOT NULL,
  `IsApproved` tinyint(1) NOT NULL DEFAULT 0,
  `IsActive` tinyint(1) NOT NULL DEFAULT 1,
  `CreatedAt` timestamp NOT NULL DEFAULT current_timestamp(),
  `UpdatedAt` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `rider`
--

CREATE TABLE `rider` (
  `RiderID` varchar(20) NOT NULL,
  `UserID` int(11) NOT NULL,
  `IsActive` tinyint(1) NOT NULL DEFAULT 1,
  `CreatedAt` timestamp NOT NULL DEFAULT current_timestamp(),
  `UpdatedAt` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `rider`
--

INSERT INTO `rider` (`RiderID`, `UserID`, `IsActive`, `CreatedAt`, `UpdatedAt`) VALUES
('7305325141', 2, 1, '2022-10-28 10:32:23', '2022-10-28 10:32:23'),
('8124308141', 1, 1, '2022-10-28 09:04:51', '2022-10-28 09:04:51'),
('9789910828', 3, 1, '2022-10-28 11:35:19', '2022-10-28 11:35:19');

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

--
-- Table structure for table `servicehistory`
--

CREATE TABLE `servicehistory` (
  `ServiceHistoryID` int(11) NOT NULL,
  `AssetID` varchar(20) NOT NULL,
  `isServiced` tinyint(1) NOT NULL DEFAULT 0,
  `outWard` timestamp NOT NULL DEFAULT current_timestamp(),
  `InWard` timestamp NULL DEFAULT NULL,
  `IsActive` tinyint(1) NOT NULL DEFAULT 1,
  `CreatedAt` timestamp NOT NULL DEFAULT current_timestamp(),
  `UpdatedAt` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `servicehistory`
--

INSERT INTO `servicehistory` (`ServiceHistoryID`, `AssetID`, `isServiced`, `outWard`, `InWard`, `IsActive`, `CreatedAt`, `UpdatedAt`) VALUES
(1, 'HE5130TK22157196', 1, '2022-10-28 09:09:44', '2022-10-28 09:09:54', 1, '2022-10-28 09:09:44', '2022-10-28 09:09:44'),
(2, 'HE5130TK22157196', 1, '2022-10-28 10:39:54', '2022-10-28 10:40:16', 1, '2022-10-28 10:39:54', '2022-10-28 10:39:54'),
(3, 'HE5130TK22158489', 1, '2022-10-28 10:55:03', '2022-10-28 10:55:22', 1, '2022-10-28 10:55:03', '2022-10-28 10:55:03');

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

--
-- Table structure for table `swap`
--

CREATE TABLE `swap` (
  `SwapID` int(11) NOT NULL,
  `RiderID` varchar(20) NOT NULL,
  `SwapReferID` int(11) DEFAULT 0,
  `SwapRechargeID` int(11) DEFAULT 0,
  `ReturnBatterID` varchar(20) NOT NULL,
  `SwappedBatterID` varchar(20) NOT NULL,
  `IsFreeSwap` tinyint(1) NOT NULL DEFAULT 1,
  `IsActive` tinyint(1) NOT NULL DEFAULT 1,
  `CreatedAt` timestamp NOT NULL DEFAULT current_timestamp(),
  `UpdatedAt` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `swap`
--

INSERT INTO `swap` (`SwapID`, `RiderID`, `SwapReferID`, `SwapRechargeID`, `ReturnBatterID`, `SwappedBatterID`, `IsFreeSwap`, `IsActive`, `CreatedAt`, `UpdatedAt`) VALUES
(1, '8124308141', 0, 0, 'HE5130TK22157196', 'HE5130TK22158489', 1, 1, '2022-10-28 09:13:34', '2022-10-28 09:13:34'),
(2, '8124308141', 0, 0, 'HE5130TK22158489', 'HE5130TK22157196', 1, 1, '2022-10-28 09:15:34', '2022-10-28 09:15:34'),
(3, '8124308141', 0, 1, 'HE5130TK22157196', 'HE5130TK22158489', 0, 1, '2022-10-28 09:16:14', '2022-10-28 09:16:14'),
(4, '8124308141', 0, 1, 'HE5130TK22158489', 'HE5130TK22157196', 0, 1, '2022-10-28 10:36:52', '2022-10-28 10:36:52');

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

--
-- Table structure for table `swaprecharge`
--

CREATE TABLE `swaprecharge` (
  `SwapRechargeID` int(11) NOT NULL,
  `RiderID` varchar(20) NOT NULL,
  `TotalRechargedSwapCount` varchar(20) NOT NULL,
  `UsedSwapCount` varchar(20) NOT NULL,
  `AvailableSwapCount` varchar(20) NOT NULL,
  `IsActive` tinyint(1) NOT NULL DEFAULT 1,
  `CreatedAt` timestamp NOT NULL DEFAULT current_timestamp(),
  `UpdatedAt` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `swaprecharge`
--

INSERT INTO `swaprecharge` (`SwapRechargeID`, `RiderID`, `TotalRechargedSwapCount`, `UsedSwapCount`, `AvailableSwapCount`, `IsActive`, `CreatedAt`, `UpdatedAt`) VALUES
(1, '8124308141', '2', '2', '0', 1, '2022-10-28 09:04:51', '2022-10-28 09:04:51'),
(2, '7305325141', '2', '0', '2', 1, '2022-10-28 10:32:23', '2022-10-28 10:32:23'),
(3, '9789910828', '0', '0', '0', 1, '2022-10-28 11:35:19', '2022-10-28 11:35:19');

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

--
-- Table structure for table `swaprefer`
--

CREATE TABLE `swaprefer` (
  `SwapReferID` int(11) NOT NULL,
  `RiderID` varchar(20) NOT NULL,
  `TotalFreeSwapCount` varchar(20) NOT NULL,
  `UsedSwapCount` varchar(20) NOT NULL,
  `AvailableSwapCount` varchar(20) NOT NULL,
  `IsActive` tinyint(1) NOT NULL DEFAULT 1,
  `CreatedAt` timestamp NOT NULL DEFAULT current_timestamp(),
  `UpdatedAt` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `swaprefer`
--

INSERT INTO `swaprefer` (`SwapReferID`, `RiderID`, `TotalFreeSwapCount`, `UsedSwapCount`, `AvailableSwapCount`, `IsActive`, `CreatedAt`, `UpdatedAt`) VALUES
(1, '8124308141', '0', '0', '0', 1, '2022-10-28 09:04:51', '2022-10-28 09:04:51'),
(2, '7305325141', '0', '0', '0', 1, '2022-10-28 10:32:23', '2022-10-28 10:32:23'),
(3, '9789910828', '0', '0', '0', 1, '2022-10-28 11:35:19', '2022-10-28 11:35:19');

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

--
-- Table structure for table `user`
--

CREATE TABLE `user` (
  `UserID` int(11) NOT NULL,
  `UserName` varchar(20) NOT NULL,
  `PhoneNumber` varchar(20) NOT NULL,
  `Password` varchar(50) NOT NULL,
  `IsAdmin` int(11) NOT NULL DEFAULT 0,
  `IsActive` tinyint(1) NOT NULL DEFAULT 1,
  `CreatedAt` timestamp NOT NULL DEFAULT current_timestamp(),
  `UpdatedAt` timestamp NOT NULL DEFAULT current_timestamp(),
  `DEID` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `user`
--

INSERT INTO `user` (`UserID`, `UserName`, `PhoneNumber`, `Password`, `IsAdmin`, `IsActive`, `CreatedAt`, `UpdatedAt`, `DEID`) VALUES
(1, 'Dinesh', '8124308141', '12345', 1, 1, '2022-10-28 09:04:51', '2022-10-28 09:04:51', ''),
(2, 'Dinesh', '7305325141', '12345', 0, 1, '2022-10-28 10:32:23', '2022-10-28 10:32:23', ''),
(3, 'Vishnu', '9789910828', '12345', 0, 1, '2022-10-28 11:35:19', '2022-10-28 11:35:19', 'DIN001487459');

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

--
-- Table structure for table `userrefer`
--

CREATE TABLE `userrefer` (
  `UserReferID` int(11) NOT NULL,
  `UserID` int(11) NOT NULL,
  `IsActive` tinyint(1) NOT NULL DEFAULT 1,
  `CreatedAt` timestamp NOT NULL DEFAULT current_timestamp(),
  `UpdatedAt` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `asset`
--
ALTER TABLE `asset`
  ADD PRIMARY KEY (`AssetID`);

--
-- Indexes for table `assetcategory`
--
ALTER TABLE `assetcategory`
  ADD PRIMARY KEY (`AssetCategoryID`);

--
-- Indexes for table `rechargehistory`
--
ALTER TABLE `rechargehistory`
  ADD PRIMARY KEY (`RechargeHistoryID`);

--
-- Indexes for table `refer`
--
ALTER TABLE `refer`
  ADD PRIMARY KEY (`ReferID`);

--
-- Indexes for table `rider`
--
ALTER TABLE `rider`
  ADD PRIMARY KEY (`RiderID`),
  ADD UNIQUE KEY `UserID` (`UserID`);

--
-- Indexes for table `servicehistory`
--
ALTER TABLE `servicehistory`
  ADD PRIMARY KEY (`ServiceHistoryID`);

--
-- Indexes for table `swap`
--
ALTER TABLE `swap`
  ADD PRIMARY KEY (`SwapID`);

--
-- Indexes for table `swaprecharge`
--
ALTER TABLE `swaprecharge`
  ADD PRIMARY KEY (`SwapRechargeID`),
  ADD UNIQUE KEY `RaiderID` (`RiderID`);

--
-- Indexes for table `swaprefer`
--
ALTER TABLE `swaprefer`
  ADD PRIMARY KEY (`SwapReferID`);

--
-- Indexes for table `user`
--
ALTER TABLE `user`
  ADD PRIMARY KEY (`UserID`);

--
-- Indexes for table `userrefer`
--
ALTER TABLE `userrefer`
  ADD PRIMARY KEY (`UserReferID`);

--
-- AUTO_INCREMENT for dumped tables
--

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

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

--
-- AUTO_INCREMENT for table `refer`
--
ALTER TABLE `refer`
  MODIFY `ReferID` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `servicehistory`
--
ALTER TABLE `servicehistory`
  MODIFY `ServiceHistoryID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

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

--
-- AUTO_INCREMENT for table `swaprecharge`
--
ALTER TABLE `swaprecharge`
  MODIFY `SwapRechargeID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `swaprefer`
--
ALTER TABLE `swaprefer`
  MODIFY `SwapReferID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `user`
--
ALTER TABLE `user`
  MODIFY `UserID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `userrefer`
--
ALTER TABLE `userrefer`
  MODIFY `UserReferID` 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 */;
