diff --git a/structure.sql b/structure.sql new file mode 100644 index 0000000..ec2ccc8 --- /dev/null +++ b/structure.sql @@ -0,0 +1,84 @@ +-- phpMyAdmin SQL Dump +-- version 5.2.1 +-- https://www.phpmyadmin.net/ +-- +-- Host: localhost +-- Generation Time: Jun 13, 2024 at 01:45 AM +-- Server version: 8.0.36-0ubuntu0.22.04.1 +-- PHP Version: 8.1.29 + +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; +START TRANSACTION; +SET time_zone = "+00:00"; + +-- +-- Database: `uem` +-- + +-- -------------------------------------------------------- + +-- +-- Table structure for table `accounts` +-- + +CREATE TABLE `accounts` ( + `id` smallint NOT NULL, + `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' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `elo_entries` +-- + +CREATE TABLE `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 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; + +-- +-- Indexes for dumped tables +-- + +-- +-- Indexes for table `accounts` +-- +ALTER TABLE `accounts` + ADD PRIMARY KEY (`id`), + ADD UNIQUE KEY `RiotID` (`gameName`,`tagLine`) USING BTREE, + ADD UNIQUE KEY `puuid` (`puuid`); + +-- +-- Indexes for table `elo_entries` +-- +ALTER TABLE `elo_entries` + ADD PRIMARY KEY (`accountId`,`date`), + ADD KEY `date` (`date`); + +-- +-- AUTO_INCREMENT for dumped tables +-- + +-- +-- AUTO_INCREMENT for table `accounts` +-- +ALTER TABLE `accounts` + MODIFY `id` smallint NOT NULL AUTO_INCREMENT; + +-- +-- 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;