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

START TRANSACTION;



--
-- Database: `vopt`
--

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

--
-- Table structure for table `appointments`
--

CREATE TABLE IF NOT EXISTS `appointments` (
  `ID` int NOT NULL AUTO_INCREMENT,
  `Trainee_ID` int DEFAULT NULL,
  `Trainer_ID` int DEFAULT NULL,
  `TV_ID` int DEFAULT NULL,
  `Status` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci,
  `Created_At` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`ID`),
  KEY `Trainee_ID` (`Trainee_ID`),
  KEY `Trainer_ID` (`Trainer_ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `sessions`
--

CREATE TABLE IF NOT EXISTS `sessions` (
  `ID` int NOT NULL AUTO_INCREMENT,
  `Appointment_ID` int DEFAULT NULL,
  `Session_Start` datetime DEFAULT NULL,
  `Session_End` datetime DEFAULT NULL,
  `Duration_Minutes` int GENERATED ALWAYS AS (timestampdiff(MINUTE,`Session_Start`,`Session_End`)) STORED,
  `Session_Notes` text COLLATE utf8mb4_general_ci,
  `Total_Cost` decimal(5,2) NOT NULL,
  PRIMARY KEY (`ID`),
  KEY `Appointment_ID` (`Appointment_ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `traineravailability`
--

CREATE TABLE IF NOT EXISTS `traineravailability` (
  `ID` int NOT NULL AUTO_INCREMENT,
  `Trainer_ID` int DEFAULT NULL,
  `Date` date DEFAULT NULL,
  `From_Time` time DEFAULT NULL,
  `To_Time` time NOT NULL,
  PRIMARY KEY (`ID`),
  KEY `Trainer_ID` (`Trainer_ID`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `traineravailability`
--

INSERT INTO `traineravailability` (`ID`, `Trainer_ID`, `Date`, `From_Time`, `To_Time`) VALUES
(1, 1, '2025-09-02', '10:00:00', '11:00:00');
COMMIT;

