-- phpMyAdmin SQL Dump
-- version 5.2.2
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: May 28, 2026 at 08:18 AM
-- Server version: 10.6.27-MariaDB-log
-- PHP Version: 8.3.31

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

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

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

CREATE TABLE `clients` (
  `ID` int(10) 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) DEFAULT NULL,
  `Phone` varchar(255) NOT NULL,
  `FullName` varchar(255) DEFAULT NULL,
  `OfficePhone` varchar(32) DEFAULT NULL,
  `OrgName` varchar(64) DEFAULT NULL,
  `Specials` varchar(32) DEFAULT NULL,
  `Comment` varchar(255) DEFAULT NULL,
  `Visible` tinyint(1) UNSIGNED NOT NULL DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

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

--
-- Table structure for table `devices`
--

CREATE TABLE `devices` (
  `ID` int(11) NOT NULL,
  `ClientID` varchar(64) NOT NULL,
  `PostDate` datetime NOT NULL,
  `LastUpdate` datetime NOT NULL,
  `IP` varchar(32) NOT NULL,
  `UserAgent` varchar(266) NOT NULL,
  `Visible` tinyint(3) UNSIGNED NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

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

CREATE TABLE `halls` (
  `ID` int(10) UNSIGNED NOT NULL,
  `PostDate` datetime NOT NULL,
  `LastUpdate` datetime NOT NULL,
  `HallName` varchar(64) NOT NULL,
  `Background` varchar(64) NOT NULL,
  `Visible` tinyint(1) UNSIGNED NOT NULL,
  `ItemPosition` tinyint(3) UNSIGNED NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

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

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

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

CREATE TABLE `reservations` (
  `ID` int(10) 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(10) UNSIGNED NOT NULL DEFAULT 0,
  `UserID` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `ResDate` date NOT NULL DEFAULT '0000-00-00',
  `ResTime` time NOT NULL DEFAULT '00:00:00',
  `Stay` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `Seats` tinyint(2) UNSIGNED NOT NULL DEFAULT 0,
  `Specials` varchar(32) DEFAULT NULL COMMENT 'K=капаро,T=избрана маса,M=избрано меню',
  `Comment` varchar(255) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

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

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

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

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

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

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

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

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

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

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

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

CREATE TABLE `tables` (
  `ID` int(10) UNSIGNED NOT NULL,
  `PostDate` datetime NOT NULL,
  `LastUpdate` datetime NOT NULL,
  `HallID` int(10) UNSIGNED NOT NULL,
  `Number` varchar(10) NOT NULL,
  `Shape` varchar(10) NOT NULL,
  `Seats` int(10) UNSIGNED NOT NULL,
  `AdSeats` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `Row` tinyint(2) UNSIGNED NOT NULL,
  `Col` tinyint(2) UNSIGNED NOT NULL,
  `Visible` tinyint(1) UNSIGNED NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

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

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

CREATE TABLE `users` (
  `ID` int(10) 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(125) DEFAULT NULL,
  `Password` varchar(32) DEFAULT NULL,
  `FullName` varchar(255) DEFAULT NULL,
  `StaffPosition` varchar(32) DEFAULT NULL,
  `Access` enum('admin','staff') NOT NULL DEFAULT 'staff',
  `Visible` tinyint(1) UNSIGNED NOT NULL DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

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

--
-- Indexes for table `devices`
--
ALTER TABLE `devices`
  ADD PRIMARY KEY (`ID`),
  ADD UNIQUE KEY `ClientID` (`ClientID`) USING BTREE;

--
-- 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 `UserID` (`UserID`);

--
-- Indexes for table `reservation_tables`
--
ALTER TABLE `reservation_tables`
  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`);

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

--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `clients`
--
ALTER TABLE `clients`
  MODIFY `ID` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `devices`
--
ALTER TABLE `devices`
  MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;

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

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

--
-- AUTO_INCREMENT for table `tables`
--
ALTER TABLE `tables`
  MODIFY `ID` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

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