Manejo de cookies

This commit is contained in:
2026-09-29 11:26:42 +02:00
parent 22f38f924f
commit 02c109662d
10 changed files with 226 additions and 3368 deletions
-346
View File
@@ -1,346 +0,0 @@
-- phpMyAdmin SQL Dump
-- version 5.2.3
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3307
-- Generation Time: Sep 23, 2026 at 12:02 PM
-- Server version: 8.4.3
-- PHP Version: 8.3.30
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: `triviagmatico`
--
-- --------------------------------------------------------
--
-- Table structure for table `categoria`
--
CREATE TABLE `categoria` (
`idCategoria` int NOT NULL,
`nombreCategoria` varchar(50) COLLATE utf8mb4_spanish_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
-- --------------------------------------------------------
--
-- Table structure for table `equipo`
--
CREATE TABLE `equipo` (
`idEquipo` int NOT NULL,
`nombreEquipo` varchar(50) COLLATE utf8mb4_spanish_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
-- --------------------------------------------------------
--
-- Table structure for table `equipoxpartida`
--
CREATE TABLE `equipoxpartida` (
`idEquipoxPartida` int NOT NULL,
`idPartida` int DEFAULT NULL,
`idEquipo` int DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
-- --------------------------------------------------------
--
-- Table structure for table `equipoxusuario`
--
CREATE TABLE `equipoxusuario` (
`idEquipoxUsuario` int NOT NULL,
`idUsuario` int NOT NULL,
`idEquipo` int NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
-- --------------------------------------------------------
--
-- Table structure for table `partida`
--
CREATE TABLE `partida` (
`idPartida` int NOT NULL,
`nombrePartida` varchar(100) COLLATE utf8mb4_spanish_ci NOT NULL,
`idUsuario` int NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
-- --------------------------------------------------------
--
-- Table structure for table `partidaxpregunta`
--
CREATE TABLE `partidaxpregunta` (
`idPartidaxPregunta` int NOT NULL,
`idPartida` int NOT NULL,
`idPregunta` int NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
-- --------------------------------------------------------
--
-- Table structure for table `pregunta`
--
CREATE TABLE `pregunta` (
`idPregunta` int NOT NULL,
`idCategoria` int NOT NULL,
`nombrePregunta` varchar(255) COLLATE utf8mb4_spanish_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
-- --------------------------------------------------------
--
-- Table structure for table `respuesta`
--
CREATE TABLE `respuesta` (
`idRespuesta` int NOT NULL,
`idPregunta` int NOT NULL,
`nombreRespuesta` varchar(255) COLLATE utf8mb4_spanish_ci NOT NULL,
`correcta` tinyint(1) DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
-- --------------------------------------------------------
--
-- Table structure for table `respuestaalmacenada`
--
CREATE TABLE `respuestaalmacenada` (
`idRespuestaAlmacenada` int NOT NULL,
`idPartidaxPregunta` int NOT NULL,
`idUsuario` int NOT NULL,
`idRespuesta` int NOT NULL,
`primero` tinyint(1) DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
-- --------------------------------------------------------
--
-- Table structure for table `usuario`
--
CREATE TABLE `usuario` (
`idUsuario` int NOT NULL,
`nombreUsuario` varchar(50) COLLATE utf8mb4_spanish_ci NOT NULL,
`contrasena` varchar(100) COLLATE utf8mb4_spanish_ci NOT NULL,
`email` varchar(50) COLLATE utf8mb4_spanish_ci NOT NULL,
`avatar` varchar(200) COLLATE utf8mb4_spanish_ci DEFAULT NULL,
`cookie` varchar(200) COLLATE utf8mb4_spanish_ci DEFAULT NULL,
`aciertos` int NOT NULL,
`victorias` int NOT NULL,
`derrotas` int NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `categoria`
--
ALTER TABLE `categoria`
ADD PRIMARY KEY (`idCategoria`);
--
-- Indexes for table `equipo`
--
ALTER TABLE `equipo`
ADD PRIMARY KEY (`idEquipo`);
--
-- Indexes for table `equipoxpartida`
--
ALTER TABLE `equipoxpartida`
ADD PRIMARY KEY (`idEquipoxPartida`),
ADD KEY `FK idEquipo tabla equipo` (`idEquipo`),
ADD KEY `FK idPartida tabla partida` (`idPartida`);
--
-- Indexes for table `equipoxusuario`
--
ALTER TABLE `equipoxusuario`
ADD PRIMARY KEY (`idEquipoxUsuario`),
ADD KEY `idUsuario` (`idUsuario`),
ADD KEY `idEquipo` (`idEquipo`);
--
-- Indexes for table `partida`
--
ALTER TABLE `partida`
ADD PRIMARY KEY (`idPartida`),
ADD KEY `FK idUsuario tabla usuario` (`idUsuario`);
--
-- Indexes for table `partidaxpregunta`
--
ALTER TABLE `partidaxpregunta`
ADD PRIMARY KEY (`idPartidaxPregunta`),
ADD KEY `idPartida` (`idPartida`),
ADD KEY `idPregunta` (`idPregunta`);
--
-- Indexes for table `pregunta`
--
ALTER TABLE `pregunta`
ADD PRIMARY KEY (`idPregunta`),
ADD KEY `idCategoria` (`idCategoria`);
--
-- Indexes for table `respuesta`
--
ALTER TABLE `respuesta`
ADD PRIMARY KEY (`idRespuesta`),
ADD KEY `idPregunta` (`idPregunta`);
--
-- Indexes for table `respuestaalmacenada`
--
ALTER TABLE `respuestaalmacenada`
ADD PRIMARY KEY (`idRespuestaAlmacenada`),
ADD KEY `idPartidaxPregunta` (`idPartidaxPregunta`),
ADD KEY `idUsuario` (`idUsuario`),
ADD KEY `idRespuesta` (`idRespuesta`);
--
-- Indexes for table `usuario`
--
ALTER TABLE `usuario`
ADD PRIMARY KEY (`idUsuario`),
ADD UNIQUE KEY `email` (`email`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `categoria`
--
ALTER TABLE `categoria`
MODIFY `idCategoria` int NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `equipo`
--
ALTER TABLE `equipo`
MODIFY `idEquipo` int NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `equipoxpartida`
--
ALTER TABLE `equipoxpartida`
MODIFY `idEquipoxPartida` int NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `equipoxusuario`
--
ALTER TABLE `equipoxusuario`
MODIFY `idEquipoxUsuario` int NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `partida`
--
ALTER TABLE `partida`
MODIFY `idPartida` int NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `partidaxpregunta`
--
ALTER TABLE `partidaxpregunta`
MODIFY `idPartidaxPregunta` int NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `pregunta`
--
ALTER TABLE `pregunta`
MODIFY `idPregunta` int NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `respuesta`
--
ALTER TABLE `respuesta`
MODIFY `idRespuesta` int NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `respuestaalmacenada`
--
ALTER TABLE `respuestaalmacenada`
MODIFY `idRespuestaAlmacenada` int NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `usuario`
--
ALTER TABLE `usuario`
MODIFY `idUsuario` int NOT NULL AUTO_INCREMENT;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `equipoxpartida`
--
ALTER TABLE `equipoxpartida`
ADD CONSTRAINT `FK idEquipo tabla equipo` FOREIGN KEY (`idEquipo`) REFERENCES `equipo` (`idEquipo`) ON DELETE RESTRICT ON UPDATE RESTRICT,
ADD CONSTRAINT `FK idPartida tabla partida` FOREIGN KEY (`idPartida`) REFERENCES `partida` (`idPartida`) ON DELETE RESTRICT ON UPDATE RESTRICT;
--
-- Constraints for table `equipoxusuario`
--
ALTER TABLE `equipoxusuario`
ADD CONSTRAINT `equipoxusuario_ibfk_1` FOREIGN KEY (`idUsuario`) REFERENCES `usuario` (`idUsuario`),
ADD CONSTRAINT `equipoxusuario_ibfk_2` FOREIGN KEY (`idEquipo`) REFERENCES `equipo` (`idEquipo`);
--
-- Constraints for table `partida`
--
ALTER TABLE `partida`
ADD CONSTRAINT `FK idUsuario tabla usuario` FOREIGN KEY (`idUsuario`) REFERENCES `usuario` (`idUsuario`) ON DELETE RESTRICT ON UPDATE RESTRICT;
--
-- Constraints for table `partidaxpregunta`
--
ALTER TABLE `partidaxpregunta`
ADD CONSTRAINT `partidaxpregunta_ibfk_1` FOREIGN KEY (`idPartida`) REFERENCES `partida` (`idPartida`),
ADD CONSTRAINT `partidaxpregunta_ibfk_2` FOREIGN KEY (`idPregunta`) REFERENCES `pregunta` (`idPregunta`);
--
-- Constraints for table `pregunta`
--
ALTER TABLE `pregunta`
ADD CONSTRAINT `pregunta_ibfk_1` FOREIGN KEY (`idCategoria`) REFERENCES `categoria` (`idCategoria`);
--
-- Constraints for table `respuesta`
--
ALTER TABLE `respuesta`
ADD CONSTRAINT `respuesta_ibfk_1` FOREIGN KEY (`idPregunta`) REFERENCES `pregunta` (`idPregunta`);
--
-- Constraints for table `respuestaalmacenada`
--
ALTER TABLE `respuestaalmacenada`
ADD CONSTRAINT `respuestaalmacenada_ibfk_1` FOREIGN KEY (`idPartidaxPregunta`) REFERENCES `partidaxpregunta` (`idPartidaxPregunta`) ON DELETE CASCADE,
ADD CONSTRAINT `respuestaalmacenada_ibfk_2` FOREIGN KEY (`idUsuario`) REFERENCES `usuario` (`idUsuario`) ON DELETE CASCADE,
ADD CONSTRAINT `respuestaalmacenada_ibfk_3` FOREIGN KEY (`idRespuesta`) REFERENCES `respuesta` (`idRespuesta`) 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 */;