|
|
-- phpMyAdmin SQL Dump
-- version 5.1.1
-- https://www.phpmyadmin.net/
--
-- Servidor: localhost:3306
-- Tiempo de generación: 02-08-2021 a las 11:11:37
-- Versión del servidor: 5.7.33
-- Versión de PHP: 7.4.19
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 datos: `puertos`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `bonos`
--
CREATE TABLE `bonos` ( `id` int(11) NOT NULL, `id_producto` int(11) NOT NULL, `id_cliente` int(11) NOT NULL, `id_factura` int(11) NOT NULL, `tiempo_total` time NOT NULL, `tiempo_consumido` time NOT NULL, `hash` varchar(255) NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `categorias`
--
CREATE TABLE `categorias` ( `id` int(11) NOT NULL, `id_categoria` int(11) NOT NULL, `nombre` text NOT NULL, `descripcion` text NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `clientes`
--
CREATE TABLE `clientes` ( `id` int(11) NOT NULL, `nombre` varchar(255) NOT NULL, `apellidos` varchar(255) NOT NULL, `nif` varchar(255) NOT NULL, `empresa` varchar(255) NOT NULL, `email` varchar(255) NOT NULL, `username` varchar(255) NOT NULL, `password` text NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `comentarios`
--
CREATE TABLE `comentarios` ( `id` int(11) NOT NULL, `id_cliente` int(11) NOT NULL, `id_producto` int(11) NOT NULL, `comentario` text NOT NULL, `fecha` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `rating` int(11) NOT NULL DEFAULT '5') ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `configuracion`
--
CREATE TABLE `configuracion` ( `id` int(11) NOT NULL, `clave` text NOT NULL, `valor` text NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `direcciones`
--
CREATE TABLE `direcciones` ( `id` int(11) NOT NULL, `id_cliente` int(11) NOT NULL, `dieccion` text NOT NULL, `cp` varchar(10) NOT NULL, `poblacion` varchar(255) NOT NULL, `provincia` varchar(255) NOT NULL, `pais` varchar(10) NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `facturas`
--
CREATE TABLE `facturas` ( `id` int(11) NOT NULL, `id_cliente` int(11) NOT NULL, `fecha` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `estado` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'Estado pendiente o pagado.', `numerofactura` varchar(10) NOT NULL, `filepdf` text NOT NULL, `precio` float NOT NULL, `impuestos` float NOT NULL COMMENT 'total de los impuestos en euros', `total` float NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `facturaslinea`
--
CREATE TABLE `facturaslinea` ( `id` int(11) NOT NULL, `id_producto` int(11) NOT NULL, `cantidad` int(11) NOT NULL COMMENT 'Cantidad de productos', `precio` float NOT NULL COMMENT 'Precio unitario en el momento de la compra', `impuestos` float NOT NULL COMMENT 'Porcentaje de impuestos', `id_variante` int(11) NOT NULL, `id_factura` int(11) NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `formularios`
--
CREATE TABLE `formularios` ( `id` int(11) NOT NULL, `nombre` text NOT NULL, `descripcion` text, `id_plantilla` int(11) NOT NULL, `alias` varchar(255) NOT NULL, `fecha_creacion` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `fecha_modificacion` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `idioma`
--
CREATE TABLE `idioma` ( `id` int(11) NOT NULL, `codigo` varchar(3) NOT NULL, `nombre` varchar(255) NOT NULL, `activo` tinyint(4) NOT NULL DEFAULT '0') ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `imagenes`
--
CREATE TABLE `imagenes` ( `id` int(11) NOT NULL, `url` text, `title` text, `base64` text
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `menu`
--
CREATE TABLE `menu` ( `id` int(11) NOT NULL, `alias` int(11) NOT NULL, `titulo` int(11) NOT NULL, `descripcion` int(11) DEFAULT NULL) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `menuitem`
--
CREATE TABLE `menuitem` ( `id` int(11) NOT NULL, `id_menu` int(11) NOT NULL, `posicion` int(11) NOT NULL, `alias` int(11) NOT NULL, `nombre` int(11) NOT NULL, `descripcion` int(11) NOT NULL, `id_imagen` int(11) DEFAULT NULL) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `modulos`
--
CREATE TABLE `modulos` ( `id` int(11) NOT NULL, `tipo` varchar(20) NOT NULL, `nombre` varchar(255) NOT NULL, `tabla` varchar(255) DEFAULT NULL, `activo` tinyint(4) NOT NULL DEFAULT '0', `fecha_creacion` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `fecha_modificacion` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `pagina`
--
CREATE TABLE `pagina` ( `id` int(11) NOT NULL, `id_plantilla` int(11) NOT NULL, `url` int(11) NOT NULL, `titulo` int(11) NOT NULL, `contenido` int(11) DEFAULT NULL, `publicada` tinyint(4) NOT NULL DEFAULT '0', `fecha_creacion` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `fecha_actualizacion` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `plantillas`
--
CREATE TABLE `plantillas` ( `id` int(11) NOT NULL, `nombre` varchar(255) NOT NULL, `alias` varchar(255) NOT NULL, `twig` text NOT NULL, `ispdf` tinyint(4) NOT NULL DEFAULT '0', `twigpdf` text NOT NULL, `iscomponent` tinyint(4) NOT NULL DEFAULT '0') ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `preguntaformulario`
--
CREATE TABLE `preguntaformulario` ( `id` int(11) NOT NULL, `alias` varchar(255) NOT NULL, `nombre` text NOT NULL, `descripcion` text NOT NULL, `id_tipo` int(11) NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `presupuestos`
--
CREATE TABLE `presupuestos` ( `id` int(11) NOT NULL, `id_cliente` int(11) NOT NULL, `id_producto` int(11) NOT NULL, `cantidad` int(11) NOT NULL, `id_variante` int(11) NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `productocategoria`
--
CREATE TABLE `productocategoria` ( `id_producto` int(11) NOT NULL, `id_categoria` int(11) NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `productos`
--
CREATE TABLE `productos` ( `id` int(11) NOT NULL, `nombre` text NOT NULL, `descripcion` text NOT NULL, `precio` float NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `productosimagen`
--
CREATE TABLE `productosimagen` ( `id_imagen` int(11) NOT NULL, `id_producto` int(11) NOT NULL, `id_variante` int(11) NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `productovariantes`
--
CREATE TABLE `productovariantes` ( `id` int(11) NOT NULL, `id_producto` int(11) NOT NULL, `nombre` text, `descripcion` text, `precio` float DEFAULT NULL) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `respuestaformulario`
--
CREATE TABLE `respuestaformulario` ( `id` int(11) NOT NULL, `id_pregunta` int(11) NOT NULL, `id_formulario` int(11) NOT NULL, `id_cliente` int(11) NOT NULL, `valor` int(11) NOT NULL, `fecha` date NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `tipopregunta`
--
CREATE TABLE `tipopregunta` ( `id` int(11) NOT NULL, `nombre` varchar(255) NOT NULL, `alias` varchar(255) NOT NULL, `id_plantilla` int(11) NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `bonos`
--
ALTER TABLE `bonos` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `hash` (`hash`), ADD KEY `id_producto` (`id_producto`), ADD KEY `id_cliente` (`id_cliente`), ADD KEY `id_factura` (`id_factura`);
--
-- Indices de la tabla `categorias`
--
ALTER TABLE `categorias` ADD PRIMARY KEY (`id`), ADD KEY `id_categoria` (`id_categoria`);
--
-- Indices de la tabla `clientes`
--
ALTER TABLE `clientes` ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `comentarios`
--
ALTER TABLE `comentarios` ADD PRIMARY KEY (`id`), ADD KEY `id_cliente` (`id_cliente`), ADD KEY `id_producto` (`id_producto`);
--
-- Indices de la tabla `configuracion`
--
ALTER TABLE `configuracion` ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `direcciones`
--
ALTER TABLE `direcciones` ADD PRIMARY KEY (`id`), ADD KEY `id_cliente` (`id_cliente`);
--
-- Indices de la tabla `facturas`
--
ALTER TABLE `facturas` ADD PRIMARY KEY (`id`), ADD KEY `id_cliente` (`id_cliente`);
--
-- Indices de la tabla `facturaslinea`
--
ALTER TABLE `facturaslinea` ADD PRIMARY KEY (`id`), ADD KEY `id_producto` (`id_producto`), ADD KEY `id_variante` (`id_variante`), ADD KEY `id_factura` (`id_factura`);
--
-- Indices de la tabla `formularios`
--
ALTER TABLE `formularios` ADD PRIMARY KEY (`id`), ADD KEY `id_plantilla` (`id_plantilla`);
--
-- Indices de la tabla `idioma`
--
ALTER TABLE `idioma` ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `imagenes`
--
ALTER TABLE `imagenes` ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `menu`
--
ALTER TABLE `menu` ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `menuitem`
--
ALTER TABLE `menuitem` ADD PRIMARY KEY (`id`), ADD KEY `id_menu` (`id_menu`), ADD KEY `id_imagen` (`id_imagen`);
--
-- Indices de la tabla `modulos`
--
ALTER TABLE `modulos` ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `pagina`
--
ALTER TABLE `pagina` ADD PRIMARY KEY (`id`), ADD KEY `id_plantilla` (`id_plantilla`);
--
-- Indices de la tabla `plantillas`
--
ALTER TABLE `plantillas` ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `preguntaformulario`
--
ALTER TABLE `preguntaformulario` ADD PRIMARY KEY (`id`), ADD KEY `id_tipo` (`id_tipo`);
--
-- Indices de la tabla `presupuestos`
--
ALTER TABLE `presupuestos` ADD PRIMARY KEY (`id`), ADD KEY `id_cliente` (`id_cliente`), ADD KEY `id_producto` (`id_producto`), ADD KEY `id_variante` (`id_variante`);
--
-- Indices de la tabla `productocategoria`
--
ALTER TABLE `productocategoria` ADD PRIMARY KEY (`id_categoria`,`id_producto`) USING BTREE, ADD KEY `id_producto` (`id_producto`);
--
-- Indices de la tabla `productos`
--
ALTER TABLE `productos` ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `productosimagen`
--
ALTER TABLE `productosimagen` ADD PRIMARY KEY (`id_imagen`,`id_producto`,`id_variante`), ADD KEY `id_variante` (`id_variante`), ADD KEY `id_producto` (`id_producto`);
--
-- Indices de la tabla `productovariantes`
--
ALTER TABLE `productovariantes` ADD PRIMARY KEY (`id`), ADD KEY `id_producto` (`id_producto`);
--
-- Indices de la tabla `respuestaformulario`
--
ALTER TABLE `respuestaformulario` ADD PRIMARY KEY (`id`), ADD KEY `id_pregunta` (`id_pregunta`), ADD KEY `id_formulario` (`id_formulario`), ADD KEY `id_cliente` (`id_cliente`);
--
-- Indices de la tabla `tipopregunta`
--
ALTER TABLE `tipopregunta` ADD PRIMARY KEY (`id`), ADD KEY `id_plantilla` (`id_plantilla`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `bonos`
--
ALTER TABLE `bonos` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `categorias`
--
ALTER TABLE `categorias` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `clientes`
--
ALTER TABLE `clientes` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `comentarios`
--
ALTER TABLE `comentarios` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `configuracion`
--
ALTER TABLE `configuracion` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `direcciones`
--
ALTER TABLE `direcciones` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `facturas`
--
ALTER TABLE `facturas` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `facturaslinea`
--
ALTER TABLE `facturaslinea` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `formularios`
--
ALTER TABLE `formularios` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `idioma`
--
ALTER TABLE `idioma` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `imagenes`
--
ALTER TABLE `imagenes` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `menu`
--
ALTER TABLE `menu` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `menuitem`
--
ALTER TABLE `menuitem` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `modulos`
--
ALTER TABLE `modulos` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `pagina`
--
ALTER TABLE `pagina` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `plantillas`
--
ALTER TABLE `plantillas` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `preguntaformulario`
--
ALTER TABLE `preguntaformulario` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `presupuestos`
--
ALTER TABLE `presupuestos` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `productos`
--
ALTER TABLE `productos` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `respuestaformulario`
--
ALTER TABLE `respuestaformulario` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `tipopregunta`
--
ALTER TABLE `tipopregunta` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- Restricciones para tablas volcadas
--
--
-- Filtros para la tabla `bonos`
--
ALTER TABLE `bonos` ADD CONSTRAINT `bonos_ibfk_1` FOREIGN KEY (`id_producto`) REFERENCES `productos` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, ADD CONSTRAINT `bonos_ibfk_2` FOREIGN KEY (`id_cliente`) REFERENCES `clientes` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, ADD CONSTRAINT `bonos_ibfk_3` FOREIGN KEY (`id_factura`) REFERENCES `facturas` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Filtros para la tabla `categorias`
--
ALTER TABLE `categorias` ADD CONSTRAINT `categorias_ibfk_1` FOREIGN KEY (`id_categoria`) REFERENCES `categorias` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Filtros para la tabla `comentarios`
--
ALTER TABLE `comentarios` ADD CONSTRAINT `comentarios_ibfk_1` FOREIGN KEY (`id_cliente`) REFERENCES `clientes` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, ADD CONSTRAINT `comentarios_ibfk_2` FOREIGN KEY (`id_producto`) REFERENCES `productos` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Filtros para la tabla `direcciones`
--
ALTER TABLE `direcciones` ADD CONSTRAINT `direcciones_ibfk_1` FOREIGN KEY (`id_cliente`) REFERENCES `clientes` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION;
--
-- Filtros para la tabla `facturas`
--
ALTER TABLE `facturas` ADD CONSTRAINT `facturas_ibfk_1` FOREIGN KEY (`id_cliente`) REFERENCES `clientes` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Filtros para la tabla `facturaslinea`
--
ALTER TABLE `facturaslinea` ADD CONSTRAINT `facturaslinea_ibfk_2` FOREIGN KEY (`id_producto`) REFERENCES `productos` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, ADD CONSTRAINT `facturaslinea_ibfk_3` FOREIGN KEY (`id_factura`) REFERENCES `facturas` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION, ADD CONSTRAINT `facturaslinea_ibfk_4` FOREIGN KEY (`id_variante`) REFERENCES `productovariantes` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Filtros para la tabla `formularios`
--
ALTER TABLE `formularios` ADD CONSTRAINT `formularios_ibfk_1` FOREIGN KEY (`id_plantilla`) REFERENCES `plantillas` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Filtros para la tabla `imagenes`
--
ALTER TABLE `imagenes` ADD CONSTRAINT `imagenes_ibfk_1` FOREIGN KEY (`id`) REFERENCES `productosimagen` (`id_imagen`) ON DELETE CASCADE;
--
-- Filtros para la tabla `menuitem`
--
ALTER TABLE `menuitem` ADD CONSTRAINT `menuitem_ibfk_1` FOREIGN KEY (`id_menu`) REFERENCES `menu` (`id`) ON DELETE CASCADE;
--
-- Filtros para la tabla `pagina`
--
ALTER TABLE `pagina` ADD CONSTRAINT `pagina_ibfk_1` FOREIGN KEY (`id_plantilla`) REFERENCES `plantillas` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Filtros para la tabla `preguntaformulario`
--
ALTER TABLE `preguntaformulario` ADD CONSTRAINT `preguntaformulario_ibfk_1` FOREIGN KEY (`id_tipo`) REFERENCES `tipopregunta` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Filtros para la tabla `presupuestos`
--
ALTER TABLE `presupuestos` ADD CONSTRAINT `presupuestos_ibfk_1` FOREIGN KEY (`id_producto`) REFERENCES `productos` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, ADD CONSTRAINT `presupuestos_ibfk_2` FOREIGN KEY (`id_cliente`) REFERENCES `clientes` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, ADD CONSTRAINT `presupuestos_ibfk_3` FOREIGN KEY (`id_variante`) REFERENCES `productovariantes` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Filtros para la tabla `productocategoria`
--
ALTER TABLE `productocategoria` ADD CONSTRAINT `productocategoria_ibfk_1` FOREIGN KEY (`id_producto`) REFERENCES `productos` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION, ADD CONSTRAINT `productocategoria_ibfk_2` FOREIGN KEY (`id_categoria`) REFERENCES `categorias` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Filtros para la tabla `productosimagen`
--
ALTER TABLE `productosimagen` ADD CONSTRAINT `productosimagen_ibfk_1` FOREIGN KEY (`id_variante`) REFERENCES `productovariantes` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION, ADD CONSTRAINT `productosimagen_ibfk_2` FOREIGN KEY (`id_producto`) REFERENCES `productos` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION;
--
-- Filtros para la tabla `productovariantes`
--
ALTER TABLE `productovariantes` ADD CONSTRAINT `productovariantes_ibfk_1` FOREIGN KEY (`id_producto`) REFERENCES `productos` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION;
--
-- Filtros para la tabla `respuestaformulario`
--
ALTER TABLE `respuestaformulario` ADD CONSTRAINT `respuestaformulario_ibfk_1` FOREIGN KEY (`id_formulario`) REFERENCES `formularios` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, ADD CONSTRAINT `respuestaformulario_ibfk_2` FOREIGN KEY (`id_pregunta`) REFERENCES `preguntaformulario` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, ADD CONSTRAINT `respuestaformulario_ibfk_3` FOREIGN KEY (`id_cliente`) REFERENCES `clientes` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Filtros para la tabla `tipopregunta`
--
ALTER TABLE `tipopregunta` ADD CONSTRAINT `tipopregunta_ibfk_1` FOREIGN KEY (`id_plantilla`) REFERENCES `plantillas` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;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 */;
|