-- phpMyAdmin SQL Dump
-- version 5.2.0
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Aug 14, 2024 at 01:51 PM
-- Server version: 8.0.30
-- PHP Version: 7.4.33

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";

--
-- Database: `constantinoff_rbs`
--

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

--
-- Table structure for table `clients`utf8
--

CREATE TABLE `clients` (
  `ID` int UNSIGNED NOT NULL,
  `RegDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `LastUpdate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `EMail` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `Phone` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `FullName` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `OfficePhone` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `OrgName` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `Specials` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `Comment` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `Visible` tinyint UNSIGNED NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `halls`
--

CREATE TABLE `halls` (
  `ID` int UNSIGNED NOT NULL,
  `PostDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `LastUpdate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `HallName` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `Background` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `Visible` tinyint UNSIGNED NOT NULL DEFAULT '0',
  `ItemPosition` tinyint UNSIGNED NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `reservations`
--

CREATE TABLE `reservations` (
  `ID` int UNSIGNED NOT NULL,
  `PostDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `LastUpdate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `ClientID` int UNSIGNED NOT NULL DEFAULT '0',
  `CallID` int UNSIGNED NOT NULL DEFAULT '0',
  `UserID` int UNSIGNED NOT NULL DEFAULT '0',
  `ResDate` date NOT NULL DEFAULT '0000-00-00',
  `ResTime` time NOT NULL DEFAULT '00:00:00',
  `Stay` int UNSIGNED NOT NULL DEFAULT '0',
  `Seats` tinyint UNSIGNED NOT NULL DEFAULT '0',
  `Specials` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'K=капаро,T=избрана маса,M=избрано меню',
  `Comment` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `reservation_tables`
--

CREATE TABLE `reservation_tables` (
  `ReservationID` int UNSIGNED NOT NULL,
  `TableID` int UNSIGNED NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `res_arrived`
--

CREATE TABLE `res_arrived` (
  `ReservationID` int UNSIGNED NOT NULL,
  `UserID` int UNSIGNED NOT NULL,
  `PostDate` datetime NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `res_cancellations`
--

CREATE TABLE `res_cancellations` (
  `ReservationID` int UNSIGNED NOT NULL,
  `UserID` int UNSIGNED NOT NULL,
  `PostDate` datetime NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `tables`
--

CREATE TABLE `tables` (
  `ID` int UNSIGNED NOT NULL,
  `PostDate` datetime NOT NULL,
  `LastUpdate` datetime NOT NULL,
  `HallID` int UNSIGNED NOT NULL,
  `Number` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `Shape` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `Seats` int UNSIGNED NOT NULL,
  `AdSeats` int UNSIGNED NOT NULL DEFAULT '0',
  `Row` tinyint UNSIGNED NOT NULL,
  `Col` tinyint UNSIGNED NOT NULL,
  `Visible` tinyint UNSIGNED NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `clients`
--
ALTER TABLE `clients`
  ADD PRIMARY KEY (`ID`),
  ADD KEY `Phone` (`Phone`);

--
-- Indexes for table `halls`
--
ALTER TABLE `halls`
  ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `reservations`
--
ALTER TABLE `reservations`
  ADD PRIMARY KEY (`ID`),
  ADD KEY `ResDate` (`ResDate`,`ResTime`),
  ADD KEY `ClientID` (`ClientID`),
  ADD KEY `CallID` (`CallID`),
  ADD KEY `UserID` (`UserID`);

--
-- Indexes for table `reservation_tables`
--
ALTER TABLE `reservation_tables`
  ADD PRIMARY KEY (`ReservationID`,`TableID`) USING BTREE,
  ADD KEY `ReservationID` (`ReservationID`);

--
-- Indexes for table `res_arrived`
--
ALTER TABLE `res_arrived`
  ADD PRIMARY KEY (`ReservationID`),
  ADD KEY `UserID` (`UserID`);

--
-- Indexes for table `res_cancellations`
--
ALTER TABLE `res_cancellations`
  ADD PRIMARY KEY (`ReservationID`),
  ADD KEY `UserID` (`UserID`);

--
-- Indexes for table `tables`
--
ALTER TABLE `tables`
  ADD PRIMARY KEY (`ID`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `clients`
--
ALTER TABLE `clients`
  MODIFY `ID` int UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `halls`
--
ALTER TABLE `halls`
  MODIFY `ID` int UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `reservations`
--
ALTER TABLE `reservations`
  MODIFY `ID` int UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tables`
--
ALTER TABLE `tables`
  MODIFY `ID` int UNSIGNED NOT NULL AUTO_INCREMENT;
COMMIT;
