-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Jun 25, 2024 at 01:07 AM
-- Server version: 8.0.37-0ubuntu0.22.04.3
-- PHP Version: 8.1.29

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

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

--
-- Table structure for table `accounts`
--

CREATE TABLE IF NOT EXISTS `accounts` (
                                          `id` smallint NOT NULL AUTO_INCREMENT,
                                          `puuid` varchar(78) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_as_cs NOT NULL,
                                          `gameName` varchar(32) NOT NULL,
                                          `tagLine` varchar(16) NOT NULL,
                                          `profileIconId` int NOT NULL DEFAULT '0',
                                          PRIMARY KEY (`id`),
                                          UNIQUE KEY `RiotID` (`gameName`,`tagLine`) USING BTREE,
                                          UNIQUE KEY `puuid` (`puuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

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

--
-- Table structure for table `elo_entries`
--

CREATE TABLE IF NOT EXISTS `elo_entries` (
                                             `accountId` smallint NOT NULL,
                                             `date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
                                             `tier` enum('IRON','BRONZE','SILVER','GOLD','PLATINUM','EMERALD','DIAMOND','MASTER','GRANDMASTER','CHALLENGER') NOT NULL,
                                             `rank` enum('I','II','III','IV') NOT NULL,
                                             `points` smallint NOT NULL,
                                             PRIMARY KEY (`accountId`,`date`),
                                             KEY `date` (`date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

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

--
-- Table structure for table `updates`
--

CREATE TABLE IF NOT EXISTS `updates` (
                                         `id` int NOT NULL AUTO_INCREMENT,
                                         `date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
                                         `status` enum('RUNNING','COMPLETE') CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT 'RUNNING',
                                         PRIMARY KEY (`id`),
                                         KEY `date` (`date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `elo_entries`
--
ALTER TABLE `elo_entries`
    ADD CONSTRAINT `elo_entries_ibfk_1` FOREIGN KEY (`accountId`) REFERENCES `accounts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
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 */;