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

START TRANSACTION;



--
-- Database: `48924`
--

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

--
-- Table structure for table `contacts`
--

CREATE TABLE `contacts` (
  `id` int(11) NOT NULL,
  `name` varchar(90) NOT NULL,
  `email` varchar(50) NOT NULL,
  `user_id` int(11) NOT NULL,
  `created_by` int(11) NOT NULL,
  `version` int(1) NOT NULL DEFAULT 0,
  `last_msg_date` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `contacts`
--

INSERT INTO `contacts` (`id`, `name`, `email`, `user_id`, `created_by`, `version`, `last_msg_date`) VALUES
(53, 'Test', 'test@test.com', 5, 4, 0, '2023-09-17 15:22:40'),
(54, 'demo', 'demo@demo.com', 4, 5, 0, NULL),
(55, 'admin', 'admin@gmail.com', 8, 7, 0, NULL),
(56, 'walton', 'walton@gmail.com', 7, 8, 0, NULL),
(57, 'test', 'test@test.com', 5, 13, 0, '2023-09-17 15:22:40'),
(58, '1926 Real', '', 14, 12, 0, '2023-09-17 15:37:27'),
(59, 'Kirill Chernikov', 'kiril@gmail.com', 11, 12, 0, '2023-09-17 15:37:27'),
(60, '1926 Real', '', 13, 12, 0, '2023-09-17 15:37:27'),
(61, '1926 Real', '', 14, 12, 0, NULL),
(62, 'testuser', '', 15, 12, 0, NULL),
(63, 'charles', '', 16, 12, 0, '2023-09-18 10:02:02');

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

--
-- Table structure for table `groups`
--

CREATE TABLE `groups` (
  `id` int(11) NOT NULL,
  `name` varchar(50) NOT NULL,
  `description` text NOT NULL,
  `userId` int(11) NOT NULL,
  `version` tinyint(1) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `groups`
--

INSERT INTO `groups` (`id`, `name`, `description`, `userId`, `version`) VALUES
(2, 'test group - 1', 'test', 1, 0);

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

--
-- Table structure for table `group_messages`
--

CREATE TABLE `group_messages` (
  `id` int(11) NOT NULL,
  `message` text CHARACTER SET utf8mb4 NOT NULL,
  `sender_id` int(11) NOT NULL,
  `group_id` int(11) NOT NULL,
  `file_upload` varchar(255) DEFAULT NULL,
  `unread` tinyint(1) NOT NULL DEFAULT 0,
  `createdAt` datetime NOT NULL DEFAULT current_timestamp(),
  `updatedAt` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `version` tinyint(1) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `group_messages`
--

INSERT INTO `group_messages` (`id`, `message`, `sender_id`, `group_id`, `file_upload`, `unread`, `createdAt`, `updatedAt`, `version`) VALUES
(7, '', 1, 2, '8149.jpg', 0, '2022-08-12 13:58:35', '2022-08-12 13:58:35', 0),
(10, 'ets', 1, 2, '', 0, '2022-08-12 16:35:55', '2022-08-12 16:35:55', 0),
(11, ' set', 1, 2, '', 0, '2022-08-12 16:36:00', '2022-08-12 16:36:00', 0),
(12, 'set', 1, 2, '', 0, '2022-08-12 16:36:02', '2022-08-12 16:36:02', 0),
(13, 'ser', 1, 2, '', 0, '2022-08-12 16:36:04', '2022-08-12 16:36:04', 0),
(14, 'wer', 1, 2, '', 0, '2022-08-12 16:36:05', '2022-08-12 16:36:05', 0);

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

--
-- Table structure for table `group_users`
--

CREATE TABLE `group_users` (
  `id` int(11) NOT NULL,
  `contact_id` int(11) NOT NULL,
  `group_id` int(11) NOT NULL,
  `unread` int(1) NOT NULL DEFAULT 1,
  `is_admin` tinyint(1) NOT NULL,
  `createdAt` datetime NOT NULL DEFAULT current_timestamp(),
  `updatedAt` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `version` tinyint(1) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `group_users`
--

INSERT INTO `group_users` (`id`, `contact_id`, `group_id`, `unread`, `is_admin`, `createdAt`, `updatedAt`, `version`) VALUES
(3, 2, 2, 0, 0, '2022-08-12 13:57:59', '2022-08-12 13:58:10', 0),
(4, 1, 2, 0, 1, '2022-08-12 13:57:59', '2022-08-12 13:58:00', 0);

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

--
-- Table structure for table `messages`
--

CREATE TABLE `messages` (
  `id` int(11) NOT NULL,
  `message` longtext CHARACTER SET utf8mb4 NOT NULL,
  `sender_id` varchar(50) NOT NULL,
  `receiver_id` varchar(50) NOT NULL,
  `file_upload` text NOT NULL,
  `unread` tinyint(1) NOT NULL DEFAULT 0,
  `createdAt` datetime NOT NULL DEFAULT current_timestamp(),
  `updatedAt` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `version` tinyint(1) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `messages`
--

INSERT INTO `messages` (`id`, `message`, `sender_id`, `receiver_id`, `file_upload`, `unread`, `createdAt`, `updatedAt`, `version`) VALUES
(103, 'tert', '1', '2', '', 0, '2022-08-12 18:08:55', '2022-08-12 18:08:55', 0),
(104, 'Hii', '4', '5', '', 0, '2022-09-20 05:29:31', '2022-09-20 05:29:31', 0),
(105, 'Hii', '4', '5', '', 0, '2022-09-20 05:31:31', '2022-09-20 05:31:31', 0),
(106, 'Hii', '7', '8', '', 0, '2023-09-16 14:36:21', '2023-09-16 14:36:21', 0),
(107, 'Hii', '8', '7', '', 1, '2023-09-16 14:36:21', '2023-09-16 14:36:26', 0),
(108, 'Hii', '12', '5', '', 0, '2023-09-17 15:22:34', '2023-09-17 15:22:34', 0),
(109, 'Hii', '5', '12', '', 1, '2023-09-17 15:22:34', '2023-09-17 15:22:36', 0),
(110, 'hi', '12', '5', '', 0, '2023-09-17 15:22:40', '2023-09-17 15:22:40', 0),
(111, 'Hii', '12', '11', '', 0, '2023-09-17 15:37:14', '2023-09-17 15:37:14', 0),
(112, 'Hii', '11', '12', '', 1, '2023-09-17 15:37:14', '2023-09-17 15:37:24', 0),
(113, 'hlw', '12', '11', '', 0, '2023-09-17 15:37:27', '2023-09-17 15:37:27', 0),
(114, 'hi', '12', '16', '', 0, '2023-09-18 10:02:02', '2023-09-18 10:02:02', 0);

--
-- Indexes for dumped tables
--

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

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

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

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

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

--
-- AUTO_INCREMENT for dumped tables
--

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

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

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

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

--
-- AUTO_INCREMENT for table `messages`
--
ALTER TABLE `messages`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=115;
COMMIT;

