2021-03-25 17:27:05 +01:00
|
|
|
-- --------------------------------------------------------
|
|
|
|
-- Host: localhost
|
|
|
|
-- Versión del servidor: 10.5.8-MariaDB - mariadb.org binary distribution
|
|
|
|
-- SO del servidor: Win64
|
|
|
|
-- HeidiSQL Versión: 11.0.0.5919
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
|
|
|
/*!40101 SET NAMES utf8 */;
|
|
|
|
/*!50503 SET NAMES utf8mb4 */;
|
|
|
|
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
|
|
|
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
|
|
|
|
|
|
|
|
|
|
|
-- Volcando estructura de base de datos para discofy
|
|
|
|
CREATE DATABASE IF NOT EXISTS `discofy` /*!40100 DEFAULT CHARACTER SET latin1 */;
|
|
|
|
USE `discofy`;
|
|
|
|
|
2021-05-15 13:00:29 +02:00
|
|
|
-- Volcando estructura para tabla discofy.bono
|
|
|
|
CREATE TABLE IF NOT EXISTS `bono` (
|
|
|
|
`id` int(11) NOT NULL,
|
|
|
|
`UserID` tinyint(4) NOT NULL DEFAULT 0,
|
|
|
|
`DiscotecaID` tinyint(4) DEFAULT NULL,
|
|
|
|
`tipoBono` int(11) DEFAULT NULL,
|
|
|
|
PRIMARY KEY (`id`),
|
|
|
|
KEY `FKUserB` (`UserID`),
|
|
|
|
KEY `FKDiscotecaB` (`DiscotecaID`),
|
|
|
|
CONSTRAINT `FKDiscotecaB` FOREIGN KEY (`DiscotecaID`) REFERENCES `discoteca` (`discotecaID`),
|
|
|
|
CONSTRAINT `FKUserB` FOREIGN KEY (`UserID`) REFERENCES `user` (`userID`)
|
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
|
|
|
|
|
|
|
-- La exportación de datos fue deseleccionada.
|
|
|
|
|
|
|
|
-- Volcando estructura para tabla discofy.codigo
|
|
|
|
CREATE TABLE IF NOT EXISTS `codigo` (
|
|
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
|
|
`UserID` tinyint(4) NOT NULL DEFAULT 0,
|
|
|
|
`ReservaID` smallint(6) NOT NULL DEFAULT 0,
|
|
|
|
`codigo` varchar(50) DEFAULT NULL,
|
|
|
|
`numReservas` int(11) DEFAULT NULL,
|
|
|
|
PRIMARY KEY (`id`),
|
|
|
|
KEY `FKUserCo` (`UserID`),
|
|
|
|
KEY `FKReservaCo` (`ReservaID`) USING BTREE,
|
|
|
|
CONSTRAINT `FKReservaCo` FOREIGN KEY (`ReservaID`) REFERENCES `reserva` (`id`),
|
|
|
|
CONSTRAINT `FKUserCo` FOREIGN KEY (`UserID`) REFERENCES `user` (`userID`)
|
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
|
|
|
|
|
|
|
-- La exportación de datos fue deseleccionada.
|
|
|
|
|
2021-03-25 17:27:05 +01:00
|
|
|
-- Volcando estructura para tabla discofy.discoteca
|
|
|
|
CREATE TABLE IF NOT EXISTS `discoteca` (
|
|
|
|
`discotecaID` tinyint(4) NOT NULL AUTO_INCREMENT,
|
|
|
|
`nombre` char(50) NOT NULL DEFAULT '0',
|
|
|
|
`telefono` char(50) NOT NULL DEFAULT '0',
|
|
|
|
`localizacion` char(50) NOT NULL DEFAULT '0',
|
|
|
|
PRIMARY KEY (`discotecaID`) USING BTREE
|
|
|
|
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
|
|
|
|
|
|
|
|
-- La exportación de datos fue deseleccionada.
|
|
|
|
|
|
|
|
-- Volcando estructura para tabla discofy.evento
|
|
|
|
CREATE TABLE IF NOT EXISTS `evento` (
|
|
|
|
`id` tinyint(4) NOT NULL AUTO_INCREMENT,
|
|
|
|
`discotecaID` tinyint(4) NOT NULL,
|
|
|
|
`nombre` tinytext NOT NULL DEFAULT '',
|
|
|
|
`localizacion` tinytext NOT NULL DEFAULT '',
|
|
|
|
`fecha` date NOT NULL DEFAULT curdate(),
|
|
|
|
`hora` time NOT NULL DEFAULT curtime(),
|
|
|
|
`descripcion` text DEFAULT NULL,
|
|
|
|
`precio1` tinyint(4) DEFAULT NULL,
|
|
|
|
`precio2` tinyint(4) DEFAULT NULL,
|
|
|
|
PRIMARY KEY (`id`),
|
|
|
|
KEY `FK_DiscotecaEvento` (`discotecaID`),
|
|
|
|
CONSTRAINT `FK_DiscotecaEvento` FOREIGN KEY (`discotecaID`) REFERENCES `discoteca` (`discotecaID`)
|
2021-05-15 13:00:29 +02:00
|
|
|
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=latin1;
|
|
|
|
|
|
|
|
-- La exportación de datos fue deseleccionada.
|
|
|
|
|
|
|
|
-- Volcando estructura para tabla discofy.reserva
|
|
|
|
CREATE TABLE IF NOT EXISTS `reserva` (
|
|
|
|
`id` smallint(6) NOT NULL DEFAULT 0,
|
|
|
|
`UserID` tinyint(4) NOT NULL,
|
|
|
|
`EventoID` tinyint(4) NOT NULL,
|
|
|
|
`codigoDescuento` varchar(50) DEFAULT NULL,
|
|
|
|
`codigoUnico` int(11) DEFAULT NULL,
|
|
|
|
PRIMARY KEY (`id`),
|
|
|
|
KEY `FKUser` (`UserID`),
|
|
|
|
KEY `FKEvento` (`EventoID`),
|
|
|
|
KEY `FKCodigo` (`codigoUnico`),
|
|
|
|
CONSTRAINT `FKCodigo` FOREIGN KEY (`codigoUnico`) REFERENCES `codigo` (`id`),
|
|
|
|
CONSTRAINT `FKEvento` FOREIGN KEY (`EventoID`) REFERENCES `evento` (`id`),
|
|
|
|
CONSTRAINT `FKUser` FOREIGN KEY (`UserID`) REFERENCES `user` (`userID`)
|
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
2021-03-25 17:27:05 +01:00
|
|
|
|
|
|
|
-- La exportación de datos fue deseleccionada.
|
|
|
|
|
|
|
|
-- Volcando estructura para tabla discofy.user
|
|
|
|
CREATE TABLE IF NOT EXISTS `user` (
|
|
|
|
`userID` tinyint(4) NOT NULL AUTO_INCREMENT,
|
2021-05-15 13:00:29 +02:00
|
|
|
`discotecaID` tinyint(4) DEFAULT NULL,
|
2021-03-25 17:27:05 +01:00
|
|
|
`userType` tinyint(4) NOT NULL DEFAULT 0,
|
|
|
|
`username` tinytext DEFAULT NULL,
|
|
|
|
`password` char(50) DEFAULT NULL,
|
|
|
|
PRIMARY KEY (`userID`),
|
|
|
|
KEY `FK_Discoteca` (`discotecaID`),
|
|
|
|
CONSTRAINT `FK_Discoteca` FOREIGN KEY (`discotecaID`) REFERENCES `discoteca` (`discotecaID`)
|
2021-05-15 13:00:29 +02:00
|
|
|
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
|
2021-03-25 17:27:05 +01:00
|
|
|
|
|
|
|
-- La exportación de datos fue deseleccionada.
|
|
|
|
|
|
|
|
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
|
|
|
|
/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
|
|
|
|
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|