475 lines
19 KiB
SQL
475 lines
19 KiB
SQL
-- phpMyAdmin SQL Dump
|
|
-- version 5.2.1
|
|
-- https://www.phpmyadmin.net/
|
|
--
|
|
-- Hôte : 127.0.0.1
|
|
-- Généré le : lun. 18 sep. 2023 à 14:10
|
|
-- Version du serveur : 10.4.27-MariaDB
|
|
-- Version de PHP : 8.2.0
|
|
|
|
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 */;
|
|
|
|
--
|
|
-- Base de données : `proserveapi`
|
|
--
|
|
DROP DATABASE IF EXISTS proserveapi;
|
|
CREATE DATABASE proserveapi;
|
|
USE proserveapi;
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
--
|
|
-- Structure de la table `participates`
|
|
--
|
|
|
|
CREATE TABLE `participates` (
|
|
`userId` int(11) NOT NULL COMMENT 'user id',
|
|
`sessionId` int(11) NOT NULL COMMENT 'session id',
|
|
`score` int(11) NOT NULL DEFAULT 0 COMMENT 'user score in the session',
|
|
`firePrecision` float NOT NULL DEFAULT 0 COMMENT 'user precision during the session',
|
|
`reactionTime` float NOT NULL DEFAULT 0 COMMENT 'average reaction time of the user in this session',
|
|
`nbEnemyHit` int(11) NOT NULL DEFAULT 0 COMMENT 'nb of enemies hit',
|
|
`nbCivilsHit` int(11) NOT NULL DEFAULT 0 COMMENT 'nb of civils hit',
|
|
`damageTaken` int(11) NOT NULL DEFAULT 0 COMMENT 'nb hits received',
|
|
`endStatus` int(1) NOT NULL DEFAULT 1 COMMENT 'user status at the end of the session (0=>dead, 1=>alive, add 2 for injured ?)',
|
|
`avatar` varchar(255) NOT NULL COMMENT 'avatar of user for this session',
|
|
`weapon` varchar(255) NOT NULL COMMENT 'weapon of user for this session',
|
|
`role` int(11) NOT NULL DEFAULT 0 COMMENT 'user role in the session',
|
|
`results` text NOT NULL DEFAULT '\'\'' COMMENT 'user''s results (objectives) in session (JSON format)'
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
--
|
|
-- Structure de la table `reacteventmodes`
|
|
--
|
|
|
|
CREATE TABLE `reacteventmodes` (
|
|
`id` int(11) NOT NULL COMMENT 'id',
|
|
`displayName` varchar(255) NOT NULL COMMENT 'name',
|
|
`description` varchar(255) NOT NULL COMMENT 'description'
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
|
|
--
|
|
-- Déchargement des données de la table `reacteventmodes`
|
|
--
|
|
|
|
INSERT INTO `reacteventmodes` (`id`, `displayName`, `description`) VALUES
|
|
(0, 'Penetration', ''),
|
|
(1, 'Ricochet', ''),
|
|
(2, 'Termination', '');
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
--
|
|
-- Structure de la table `reactevents`
|
|
--
|
|
|
|
CREATE TABLE `reactevents` (
|
|
`id` int(11) NOT NULL COMMENT 'event id',
|
|
`srcEventSessionId` int(11) NOT NULL COMMENT 'session id',
|
|
`srcEventIndex` int(11) NOT NULL COMMENT 'id of the triggering event that initiated this reaction event',
|
|
`reactType` int(11) NOT NULL COMMENT 'react event type',
|
|
`reactMode` int(11) NOT NULL DEFAULT 0 COMMENT 'react event mode (penetration, ricochet, termination)',
|
|
`hitUserId` int(11) NOT NULL DEFAULT 0 COMMENT 'id of the user that has been hit (0 if enemy/civil/env/game)',
|
|
`hitTargetName` varchar(255) NOT NULL COMMENT 'target hit by the event',
|
|
`hitBoneName` varchar(255) NOT NULL COMMENT 'bone hit on the target',
|
|
`damage` float NOT NULL DEFAULT 0 COMMENT 'damage points for the event',
|
|
`targetKilled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'did target got killed by the event ?',
|
|
`objectHitLocationX` float NOT NULL DEFAULT 0 COMMENT 'when hitting a target (object) record X position on texture',
|
|
`objectHitLocationY` float NOT NULL DEFAULT 0 COMMENT 'when hitting a target (object) record Y position on texture',
|
|
`objectHitTagLocation` varchar(255) NOT NULL COMMENT 'tag on the hit object',
|
|
`hitPrecision` float NOT NULL DEFAULT 1 COMMENT 'precision of the hit',
|
|
`distance` float NOT NULL DEFAULT 0 COMMENT 'distance from source to target hit',
|
|
`reactTime` float NOT NULL DEFAULT 0 COMMENT 'reaction time (for challenges)',
|
|
`timeStamp` float NOT NULL DEFAULT 0 COMMENT 'timeStamp react shot was registered'
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
--
|
|
-- Structure de la table `reacteventtypes`
|
|
--
|
|
|
|
CREATE TABLE `reacteventtypes` (
|
|
`id` int(11) NOT NULL COMMENT 'type id',
|
|
`displayName` varchar(255) NOT NULL COMMENT 'name',
|
|
`description` varchar(255) NOT NULL COMMENT 'description'
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
|
|
--
|
|
-- Déchargement des données de la table `reacteventtypes`
|
|
--
|
|
|
|
INSERT INTO `reacteventtypes` (`id`, `displayName`, `description`) VALUES
|
|
(0, 'EnemyHit', 'An enemy has been hit'),
|
|
(1, 'CivilianHit', 'A civilian has been hit'),
|
|
(2, 'PoliceHit', 'Another player has been hit by himself'),
|
|
(3, 'ObjectHit', 'A target (object) has been hit'),
|
|
(4, 'PaperTargetHit', ''),
|
|
(5, 'TargetHit', ''),
|
|
(6, 'DeadBodyHit', 'An already-dead body has been hit');
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
--
|
|
-- Doublure de structure pour la vue `sessiondebriefs`
|
|
-- (Voir ci-dessous la vue réelle)
|
|
--
|
|
CREATE TABLE `sessiondebriefs` (
|
|
`SessionId` int(11)
|
|
,`SessionTypeId` int(11)
|
|
,`SessionType` varchar(255)
|
|
,`SessionName` varchar(255)
|
|
,`SessionDate` datetime
|
|
,`MapName` varchar(255)
|
|
,`ScenarioName` varchar(255)
|
|
,`SessionSuccessful` tinyint(1)
|
|
,`SessionDuration` float
|
|
,`TriggerTypeId` int(11)
|
|
,`TriggerType` varchar(255)
|
|
,`ShooterId` int(11)
|
|
,`ShooterName` varchar(255)
|
|
,`ShooterRoleId` int(11)
|
|
,`ShooterRole` varchar(255)
|
|
,`ShotIndex` int(11)
|
|
,`ReactId` int(11)
|
|
,`ReactModeId` int(11)
|
|
,`ReactMode` varchar(255)
|
|
,`ReactTypeId` int(11)
|
|
,`ReactType` varchar(255)
|
|
,`TargetUserId` int(11)
|
|
,`TargetUserName` varchar(255)
|
|
,`TargetRoleId` int(11)
|
|
,`TargetRole` varchar(255)
|
|
,`TargetName` varchar(255)
|
|
,`TargetBoneName` varchar(255)
|
|
,`TargetKilled` int(4)
|
|
,`HitLocationX` double
|
|
,`HitLocationY` double
|
|
,`HitLocationTag` varchar(255)
|
|
,`HitPrecision` double
|
|
,`HitTargetDistance` double
|
|
,`ReactionTime` double
|
|
,`TimeStamp` double
|
|
,`NbHit` bigint(21)
|
|
,`NbKilled` bigint(21)
|
|
);
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
--
|
|
-- Structure de la table `sessions`
|
|
--
|
|
|
|
CREATE TABLE `sessions` (
|
|
`id` int(11) NOT NULL COMMENT 'session id',
|
|
`sessionType` int(11) NOT NULL COMMENT 'session type',
|
|
`sessionName` varchar(255) NOT NULL COMMENT 'session name',
|
|
`sessionDate` datetime NOT NULL DEFAULT current_timestamp() COMMENT 'date/time of the session',
|
|
`mapName` varchar(255) NOT NULL COMMENT 'map of the session',
|
|
`scenarioName` varchar(255) NOT NULL COMMENT 'scenario name that was played',
|
|
`success` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'was the session successful (scenario objective reached) ?',
|
|
`timeToFinish` float NOT NULL DEFAULT 0 COMMENT 'session duration',
|
|
`score` int(11) NOT NULL DEFAULT 0 COMMENT 'user score',
|
|
`nbEnemyHit` int(11) NOT NULL DEFAULT 0 COMMENT 'nb of enemies hit',
|
|
`nbCivilsHit` int(11) NOT NULL DEFAULT 0 COMMENT 'nb of civils saved',
|
|
`damageTaken` float NOT NULL DEFAULT 0 COMMENT 'total damage taken',
|
|
`replayFileName` varchar(255) NOT NULL COMMENT 'filename of the session replay'
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
--
|
|
-- Structure de la table `sessiontypes`
|
|
--
|
|
|
|
CREATE TABLE `sessiontypes` (
|
|
`id` int(11) NOT NULL COMMENT 'session type id',
|
|
`displayName` varchar(255) NOT NULL COMMENT 'displayed name of the session type',
|
|
`description` varchar(255) NOT NULL COMMENT 'description of the session type'
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
|
|
--
|
|
-- Déchargement des données de la table `sessiontypes`
|
|
--
|
|
|
|
INSERT INTO `sessiontypes` (`id`, `displayName`, `description`) VALUES
|
|
(0, 'FireRange', ''),
|
|
(1, 'Challenge', ''),
|
|
(2, 'Protect', ''),
|
|
(3, 'De-Escalation', ''),
|
|
(4, 'Terrorism', ''),
|
|
(5, 'FireExtinction', ''),
|
|
(6, 'Recovering', '');
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
--
|
|
-- Structure de la table `triggerevents`
|
|
--
|
|
|
|
CREATE TABLE `triggerevents` (
|
|
`sessionId` int(11) NOT NULL COMMENT 'id of the user session during which the event was triggered',
|
|
`indexCount` int(11) NOT NULL COMMENT 'index of event in session',
|
|
`srcUserId` int(11) NOT NULL COMMENT 'id of the user that triggered the shot',
|
|
`type` int(11) NOT NULL COMMENT 'type of event',
|
|
`successful` tinyint(1) NOT NULL COMMENT 'was the shot (or triggered event) successful (hit a target) ?',
|
|
`timeStamp` float NOT NULL COMMENT 'time the event occurred at'
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
--
|
|
-- Structure de la table `triggereventtypes`
|
|
--
|
|
|
|
CREATE TABLE `triggereventtypes` (
|
|
`id` int(11) NOT NULL COMMENT 'event type id',
|
|
`displayName` varchar(255) NOT NULL COMMENT 'displayed name of the event type',
|
|
`description` varchar(255) NOT NULL COMMENT 'description of the event type'
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
|
|
--
|
|
-- Déchargement des données de la table `triggereventtypes`
|
|
--
|
|
|
|
INSERT INTO `triggereventtypes` (`id`, `displayName`, `description`) VALUES
|
|
(0, 'Fire', 'Player has fired');
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
--
|
|
-- Structure de la table `userroles`
|
|
--
|
|
|
|
CREATE TABLE `userroles` (
|
|
`id` int(11) NOT NULL COMMENT 'session type id',
|
|
`displayName` varchar(255) NOT NULL COMMENT 'displayed name of the session type',
|
|
`description` varchar(255) NOT NULL COMMENT 'description of the session type'
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
|
|
--
|
|
-- Déchargement des données de la table `userroles`
|
|
--
|
|
|
|
INSERT INTO `userroles` (`id`, `displayName`, `description`) VALUES
|
|
(0, 'Police', 'Player is Police/SWAT'),
|
|
(1, 'Enemy', 'Player is an Enemy'),
|
|
(2, 'Civil', 'Player is a Civilian'),
|
|
(3, 'IA', 'Role for IA and NPC');
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
--
|
|
-- Structure de la table `users`
|
|
--
|
|
|
|
CREATE TABLE `users` (
|
|
`id` int(11) NOT NULL COMMENT 'user id',
|
|
`username` varchar(255) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COMMENT 'username',
|
|
`password` varchar(255) NOT NULL COMMENT 'password',
|
|
`firstName` varchar(255) NOT NULL COMMENT 'first name',
|
|
`lastName` varchar(255) NOT NULL COMMENT 'last name',
|
|
`created` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date/time of the creation of the user account',
|
|
`leftHanded` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'is user left handed?',
|
|
`maleGender` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'is user a man (true) or a woman?',
|
|
`charSkinAssetName` varchar(255) NOT NULL COMMENT 'name of the asset for the character skin',
|
|
`weaponAssetName` varchar(255) NOT NULL COMMENT 'name of the asset for the weapon',
|
|
`lastConnection` datetime NOT NULL DEFAULT current_timestamp() COMMENT 'date/time of the last connection',
|
|
`avgPrecision` float NOT NULL COMMENT 'average precision when firing',
|
|
`avgReaction` float NOT NULL COMMENT 'average reaction time',
|
|
`avgFault` float NOT NULL COMMENT 'average error rate',
|
|
`avgRapidity` float NOT NULL COMMENT 'average rapidity time',
|
|
`size` int(6) NOT NULL DEFAULT 175
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
|
|
|
|
|
INSERT INTO `users` (`id`, `username`, `password`, `firstName`, `lastName`, `created`, `leftHanded`, `maleGender`, `charSkinAssetName`, `weaponAssetName`, `lastConnection`, `avgPrecision`, `avgReaction`, `avgFault`, `avgRapidity`, `size`) VALUES
|
|
(0, 'game', '', '', '', '2023-01-24 10:52:35', 0, 0, '', '', '2023-01-24 11:52:35', 0, 0, 0, 0, 0);
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
--
|
|
-- Structure de la table `userstatus`
|
|
--
|
|
|
|
CREATE TABLE `userstatus` (
|
|
`id` int(11) NOT NULL COMMENT 'status id',
|
|
`displayName` varchar(255) NOT NULL COMMENT 'display name for status (alive, dead)',
|
|
`description` varchar(255) NOT NULL COMMENT 'description'
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
|
|
--
|
|
-- Déchargement des données de la table `userstatus`
|
|
--
|
|
|
|
INSERT INTO `userstatus` (`id`, `displayName`, `description`) VALUES
|
|
(0, 'Alive', 'avatar is alive'),
|
|
(1, 'Lightly Injured', 'avatar has been slightly injured'),
|
|
(2, 'Seriously Injured', 'avatar has been seriously injured'),
|
|
(3, 'Dead', 'avatar is dead');
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
--
|
|
-- Structure de la vue `sessiondebriefs`
|
|
--
|
|
DROP TABLE IF EXISTS `sessiondebriefs`;
|
|
|
|
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `sessiondebriefs` AS SELECT `s`.`id` AS `SessionId`, `s`.`sessionType` AS `SessionTypeId`, `st`.`displayName` AS `SessionType`, `s`.`sessionName` AS `SessionName`, `s`.`sessionDate` AS `SessionDate`, `s`.`mapName` AS `MapName`, `s`.`scenarioName` AS `ScenarioName`, `s`.`success` AS `SessionSuccessful`, `s`.`timeToFinish` AS `SessionDuration`, coalesce(`t`.`type`,-1) AS `TriggerTypeId`, coalesce(`tt`.`displayName`,'') AS `TriggerType`, (select ifnull(`t`.`srcUserId`,`ps`.`userId`)) AS `ShooterId`, `us`.`username` AS `ShooterName`, (select ifnull(`ps`.`role`,3)) AS `ShooterRoleId`, (select `r`.`displayName` from `userroles` `r` where `r`.`id` = `ShooterRoleId`) AS `ShooterRole`, coalesce(`t`.`indexCount`,-1) AS `ShotIndex`, coalesce(`r`.`id`,-1) AS `ReactId`, coalesce(`r`.`reactMode`,2) AS `ReactModeId`, coalesce(`rm`.`displayName`,'') AS `ReactMode`, coalesce(`r`.`reactType`,-1) AS `ReactTypeId`, coalesce(`rt`.`displayName`,'') AS `ReactType`, coalesce(`r`.`hitUserId`,-1) AS `TargetUserId`, coalesce(`uh`.`username`,'') AS `TargetUserName`, (select ifnull(`ph`.`role`,3)) AS `TargetRoleId`, (select `r`.`displayName` from `userroles` `r` where `r`.`id` = `TargetRoleId`) AS `TargetRole`, coalesce(`r`.`hitTargetName`,'') AS `TargetName`, coalesce(`r`.`hitBoneName`,'') AS `TargetBoneName`, coalesce(`r`.`targetKilled`,0) AS `TargetKilled`, coalesce(`r`.`objectHitLocationX`,0) AS `HitLocationX`, coalesce(`r`.`objectHitLocationY`,0) AS `HitLocationY`, coalesce(`r`.`objectHitTagLocation`,'') AS `HitLocationTag`, coalesce(`r`.`hitPrecision`,0) AS `HitPrecision`, coalesce(`r`.`distance`,0) AS `HitTargetDistance`, coalesce(`r`.`reactTime`,0) AS `ReactionTime`, coalesce(`r`.`timeStamp`,0) AS `TimeStamp`, count(distinct `r`.`id`) AS `NbHit`, count(distinct `rk`.`srcEventIndex`,`rk`.`hitTargetName`) AS `NbKilled` FROM (((((((((((`sessions` `s` left join `participates` `ps` on(`s`.`id` = `ps`.`sessionId`)) left join `participates` `ph` on(`s`.`id` = `ph`.`sessionId`)) left join `triggerevents` `t` on(`s`.`id` = `t`.`sessionId`)) left join `triggereventtypes` `tt` on(`tt`.`id` = `t`.`type`)) left join `sessiontypes` `st` on(`st`.`id` = `s`.`sessionType`)) left join `reactevents` `r` on(`t`.`indexCount` = `r`.`srcEventIndex` and `t`.`sessionId` = `r`.`srcEventSessionId`)) left join `users` `uh` on(`uh`.`id` = `r`.`hitUserId`)) left join `users` `us` on(`us`.`id` = `t`.`srcUserId` or `us`.`id` = `ps`.`userId`)) left join `reacteventtypes` `rt` on(`rt`.`id` = `r`.`reactType`)) left join `reacteventmodes` `rm` on(`rm`.`id` = coalesce(`r`.`reactMode`,2))) left join `reactevents` `rk` on(`r`.`id` = `rk`.`id` and `rk`.`targetKilled` = 1)) GROUP BY `s`.`id`, (select ifnull(`t`.`srcUserId`,`ps`.`userId`)), `t`.`indexCount`, `r`.`hitTargetName` ORDER BY `s`.`id` ASC, (select ifnull(`t`.`srcUserId`,`ps`.`userId`)) ASC, `t`.`indexCount` ASC, `r`.`id` ASC ;
|
|
|
|
--
|
|
-- Index pour les tables déchargées
|
|
--
|
|
|
|
--
|
|
-- Index pour la table `participates`
|
|
--
|
|
ALTER TABLE `participates`
|
|
ADD PRIMARY KEY (`userId`,`sessionId`),
|
|
ADD KEY `FK_Participates_SessionId` (`sessionId`),
|
|
ADD KEY `FK_Participates_UserStatus` (`endStatus`),
|
|
ADD KEY `FK_Participates_UserRole` (`role`);
|
|
|
|
--
|
|
-- Index pour la table `reacteventmodes`
|
|
--
|
|
ALTER TABLE `reacteventmodes`
|
|
ADD PRIMARY KEY (`id`);
|
|
|
|
--
|
|
-- Index pour la table `reactevents`
|
|
--
|
|
ALTER TABLE `reactevents`
|
|
ADD PRIMARY KEY (`id`),
|
|
ADD KEY `FK_React_TypeId` (`reactType`),
|
|
ADD KEY `FK_React_HitUserId` (`hitUserId`),
|
|
ADD KEY `FK_React_EventIndex` (`srcEventIndex`),
|
|
ADD KEY `FK_React_SessionId` (`srcEventSessionId`),
|
|
ADD KEY `FK_React_Mode` (`reactMode`);
|
|
|
|
--
|
|
-- Index pour la table `reacteventtypes`
|
|
--
|
|
ALTER TABLE `reacteventtypes`
|
|
ADD PRIMARY KEY (`id`);
|
|
|
|
--
|
|
-- Index pour la table `sessions`
|
|
--
|
|
ALTER TABLE `sessions`
|
|
ADD PRIMARY KEY (`id`),
|
|
ADD KEY `FK_sessionType` (`sessionType`) USING BTREE;
|
|
|
|
--
|
|
-- Index pour la table `sessiontypes`
|
|
--
|
|
ALTER TABLE `sessiontypes`
|
|
ADD PRIMARY KEY (`id`);
|
|
|
|
--
|
|
-- Index pour la table `triggerevents`
|
|
--
|
|
ALTER TABLE `triggerevents`
|
|
ADD PRIMARY KEY (`indexCount`,`sessionId`),
|
|
ADD KEY `FK_TriggerEvent_SrcUserId` (`srcUserId`),
|
|
ADD KEY `FK_TriggerEvent_Type` (`type`),
|
|
ADD KEY `FK_TriggerEvent_UserId` (`sessionId`);
|
|
|
|
--
|
|
-- Index pour la table `triggereventtypes`
|
|
--
|
|
ALTER TABLE `triggereventtypes`
|
|
ADD PRIMARY KEY (`id`);
|
|
|
|
--
|
|
-- Index pour la table `userroles`
|
|
--
|
|
ALTER TABLE `userroles`
|
|
ADD PRIMARY KEY (`id`);
|
|
|
|
--
|
|
-- Index pour la table `users`
|
|
--
|
|
ALTER TABLE `users`
|
|
ADD PRIMARY KEY (`id`),
|
|
ADD UNIQUE KEY `username` (`username`);
|
|
|
|
--
|
|
-- Index pour la table `userstatus`
|
|
--
|
|
ALTER TABLE `userstatus`
|
|
ADD PRIMARY KEY (`id`);
|
|
|
|
--
|
|
-- AUTO_INCREMENT pour les tables déchargées
|
|
--
|
|
|
|
--
|
|
-- AUTO_INCREMENT pour la table `reactevents`
|
|
--
|
|
ALTER TABLE `reactevents`
|
|
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'event id';
|
|
|
|
--
|
|
-- AUTO_INCREMENT pour la table `sessions`
|
|
--
|
|
ALTER TABLE `sessions`
|
|
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'session id';
|
|
|
|
--
|
|
-- AUTO_INCREMENT pour la table `users`
|
|
--
|
|
ALTER TABLE `users`
|
|
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'user id';
|
|
|
|
--
|
|
-- Contraintes pour les tables déchargées
|
|
--
|
|
|
|
--
|
|
-- Contraintes pour la table `participates`
|
|
--
|
|
ALTER TABLE `participates`
|
|
ADD CONSTRAINT `FK_Participates_SessionId` FOREIGN KEY (`sessionId`) REFERENCES `sessions` (`id`) ON DELETE CASCADE,
|
|
ADD CONSTRAINT `FK_Participates_UserId` FOREIGN KEY (`userId`) REFERENCES `users` (`id`) ON DELETE CASCADE,
|
|
ADD CONSTRAINT `FK_Participates_UserRole` FOREIGN KEY (`role`) REFERENCES `userroles` (`id`),
|
|
ADD CONSTRAINT `FK_Participates_UserStatus` FOREIGN KEY (`endStatus`) REFERENCES `userstatus` (`id`);
|
|
|
|
--
|
|
-- Contraintes pour la table `reactevents`
|
|
--
|
|
ALTER TABLE `reactevents`
|
|
ADD CONSTRAINT `FK_React_HitUserId` FOREIGN KEY (`hitUserId`) REFERENCES `users` (`id`),
|
|
ADD CONSTRAINT `FK_React_Mode` FOREIGN KEY (`reactMode`) REFERENCES `reacteventmodes` (`id`),
|
|
ADD CONSTRAINT `FK_React_SessionId` FOREIGN KEY (`srcEventSessionId`) REFERENCES `sessions` (`id`) ON DELETE CASCADE,
|
|
ADD CONSTRAINT `FK_React_TypeId` FOREIGN KEY (`reactType`) REFERENCES `reacteventtypes` (`id`);
|
|
|
|
--
|
|
-- Contraintes pour la table `sessions`
|
|
--
|
|
ALTER TABLE `sessions`
|
|
ADD CONSTRAINT `FK_SessionType` FOREIGN KEY (`sessionType`) REFERENCES `sessiontypes` (`id`);
|
|
|
|
--
|
|
-- Contraintes pour la table `triggerevents`
|
|
--
|
|
ALTER TABLE `triggerevents`
|
|
ADD CONSTRAINT `FK_TriggerEvent_SrcUserId` FOREIGN KEY (`srcUserId`) REFERENCES `users` (`id`) ON DELETE CASCADE,
|
|
ADD CONSTRAINT `FK_TriggerEvent_Type` FOREIGN KEY (`type`) REFERENCES `triggereventtypes` (`id`),
|
|
ADD CONSTRAINT `FK_TriggerEvent_UserId` FOREIGN KEY (`sessionId`) REFERENCES `sessions` (`id`) ON DELETE 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 */;
|