-- phpMyAdmin SQL Dump
-- version 4.5.4.1
-- http://www.phpmyadmin.net
--
-- Client :  localhost
-- Généré le :  Sam 27 Septembre 2025 à 10:34
-- Version du serveur :  5.7.11
-- Version de PHP :  7.0.3

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
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 */;

--
-- Base de données :  `mgs`
--

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

--
-- Structure de la table `mgs_board`
--

CREATE TABLE `mgs_board` (
  `uid` char(32) COLLATE utf8_bin NOT NULL COMMENT 'ID name',
  `name` char(128) COLLATE utf8_bin NOT NULL COMMENT 'Display name',
  `game` char(32) COLLATE utf8_bin NOT NULL COMMENT 'Game UID',
  `ranking` enum('Ascending','Descending') COLLATE utf8_bin NOT NULL DEFAULT 'Descending' COMMENT 'Ranking order',
  `hidden` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Is hidden?',
  `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Timestamp'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

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

--
-- Structure de la table `mgs_game`
--

CREATE TABLE `mgs_game` (
  `uid` char(32) COLLATE utf8_bin NOT NULL,
  `name` char(128) COLLATE utf8_bin NOT NULL COMMENT 'Display name',
  `owner` char(32) COLLATE utf8_bin NOT NULL COMMENT 'Owner',
  `decoder` char(32) COLLATE utf8_bin NOT NULL DEFAULT 'msxgl1' COMMENT 'Decoder algorithm',
  `signature` char(32) COLLATE utf8_bin NOT NULL COMMENT 'Encoder key',
  `manualboard` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Is board have to be selected',
  `needlogin` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Is player login mandatory',
  `metadata` char(255) COLLATE utf8_bin DEFAULT NULL COMMENT 'Metadata headers',
  `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

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

--
-- Structure de la table `mgs_score`
--

CREATE TABLE `mgs_score` (
  `uid` int(11) NOT NULL COMMENT 'Unique ID',
  `game` char(32) COLLATE utf8_bin NOT NULL COMMENT 'Game ID',
  `board` char(32) COLLATE utf8_bin NOT NULL COMMENT 'Scoreboard ID',
  `player` char(128) COLLATE utf8_bin NOT NULL COMMENT 'Player name',
  `player_signed` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Is signed player?',
  `score` int(11) NOT NULL COMMENT 'Sort value ',
  `rank` int(11) NOT NULL COMMENT 'Scoreboard ranking',
  `metadata` text COLLATE utf8_bin COMMENT 'Metadata',
  `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Timestamp'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

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

--
-- Structure de la table `mgs_tips`
--

CREATE TABLE `mgs_tips` (
  `uid` int(11) NOT NULL,
  `game` char(32) COLLATE utf8_bin NOT NULL,
  `title` char(128) COLLATE utf8_bin NOT NULL,
  `message` text COLLATE utf8_bin NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

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

--
-- Structure de la table `mgs_user`
--

CREATE TABLE `mgs_user` (
  `uid` int(11) NOT NULL,
  `login` char(64) COLLATE utf8_unicode_ci NOT NULL,
  `password` char(33) COLLATE utf8_unicode_ci NOT NULL,
  `email` char(128) COLLATE utf8_unicode_ci NOT NULL,
  `displayname` char(128) COLLATE utf8_unicode_ci DEFAULT NULL,
  `familyname` char(128) COLLATE utf8_unicode_ci DEFAULT NULL,
  `firstname` char(128) COLLATE utf8_unicode_ci DEFAULT NULL,
  `birthday` date DEFAULT NULL,
  `avatar` longblob,
  `role` tinyint(4) DEFAULT '1',
  `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Index pour les tables exportées
--

--
-- Index pour la table `mgs_board`
--
ALTER TABLE `mgs_board`
  ADD PRIMARY KEY (`uid`),
  ADD UNIQUE KEY `id` (`uid`);

--
-- Index pour la table `mgs_game`
--
ALTER TABLE `mgs_game`
  ADD PRIMARY KEY (`uid`),
  ADD UNIQUE KEY `id` (`uid`);

--
-- Index pour la table `mgs_score`
--
ALTER TABLE `mgs_score`
  ADD PRIMARY KEY (`uid`),
  ADD UNIQUE KEY `uid` (`uid`);

--
-- Index pour la table `mgs_tips`
--
ALTER TABLE `mgs_tips`
  ADD PRIMARY KEY (`uid`);

--
-- Index pour la table `mgs_user`
--
ALTER TABLE `mgs_user`
  ADD PRIMARY KEY (`uid`),
  ADD UNIQUE KEY `id` (`uid`),
  ADD UNIQUE KEY `login` (`login`),
  ADD KEY `id_2` (`uid`);

--
-- AUTO_INCREMENT pour les tables exportées
--

--
-- AUTO_INCREMENT pour la table `mgs_score`
--
ALTER TABLE `mgs_score`
  MODIFY `uid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique ID', AUTO_INCREMENT=116;
--
-- AUTO_INCREMENT pour la table `mgs_tips`
--
ALTER TABLE `mgs_tips`
  MODIFY `uid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT pour la table `mgs_user`
--
ALTER TABLE `mgs_user`
  MODIFY `uid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
/*!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 */;
