-- phpMyAdmin SQL Dump
-- version 4.9.0.1
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Apr 10, 2021 at 01:57 PM
-- Server version: 10.3.27-MariaDB-0+deb10u1
-- PHP Version: 7.3.27-1~deb10u1

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
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: `paredu_chat`
--

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

--
-- Table structure for table `chats`
--

CREATE TABLE `chats` (
  `chat_id` int(4) NOT NULL,
  `chat_user_id` int(3) NOT NULL,
  `chat_user2_id` int(3) NOT NULL,
  `chat_message` text NOT NULL,
  `chat_sent_by` int(1) NOT NULL,
  `chat_date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `chats_from`
--

CREATE TABLE `chats_from` (
  `chat_id` int(4) NOT NULL,
  `chat_user_id` int(4) NOT NULL,
  `chat_user_from` int(4) NOT NULL,
  `chat_type` varchar(10) NOT NULL DEFAULT 'received',
  `chat_message` varchar(255) NOT NULL,
  `chat_date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `chats_to`
--

CREATE TABLE `chats_to` (
  `chat_id` int(4) NOT NULL,
  `chat_to_user_id` int(4) NOT NULL,
  `chat_user_id_to` int(4) NOT NULL,
  `chat_type` varchar(10) NOT NULL DEFAULT 'sent',
  `chat_message` varchar(255) NOT NULL,
  `chat_date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `users`
--

CREATE TABLE `users` (
  `user_id` int(3) NOT NULL,
  `user_name` varchar(50) NOT NULL,
  `users_pass` varchar(255) NOT NULL,
  `user_picture` varchar(100) NOT NULL,
  `user_status` int(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `chats`
--
ALTER TABLE `chats`
  ADD PRIMARY KEY (`chat_id`);

--
-- Indexes for table `chats_from`
--
ALTER TABLE `chats_from`
  ADD PRIMARY KEY (`chat_id`);

--
-- Indexes for table `chats_to`
--
ALTER TABLE `chats_to`
  ADD PRIMARY KEY (`chat_id`);

--
-- Indexes for table `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`user_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `chats`
--
ALTER TABLE `chats`
  MODIFY `chat_id` int(4) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `chats_from`
--
ALTER TABLE `chats_from`
  MODIFY `chat_id` int(4) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `chats_to`
--
ALTER TABLE `chats_to`
  MODIFY `chat_id` int(4) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
  MODIFY `user_id` int(3) 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 */;
