-
Notifications
You must be signed in to change notification settings - Fork 0
/
blogdb.sql
147 lines (124 loc) · 4.9 KB
/
blogdb.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
-- phpMyAdmin SQL Dump
-- version 4.7.4
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1:3306
-- Tiempo de generación: 27-08-2018 a las 23:27:32
-- Versión del servidor: 5.7.19
-- Versión de PHP: 5.6.31
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
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: `blogdb`
--
CREATE DATABASE IF NOT EXISTS `blogdb` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `blogdb`;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `comment`
--
DROP TABLE IF EXISTS `comment`;
CREATE TABLE IF NOT EXISTS `comment` (
`idcomment` int(11) NOT NULL AUTO_INCREMENT,
`comment_info` varchar(82) NOT NULL,
`post_idpost` int(11) NOT NULL,
`post_users_idusers` int(11) NOT NULL,
PRIMARY KEY (`idcomment`,`post_idpost`,`post_users_idusers`),
KEY `fk_comment_post1_idx` (`post_idpost`,`post_users_idusers`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `comment`
--
INSERT INTO `comment` (`idcomment`, `comment_info`, `post_idpost`, `post_users_idusers`) VALUES
(1, 'asd', 2, 1),
(2, 'hola wey', 2, 1),
(3, 'hola wey', 2, 1);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `post`
--
DROP TABLE IF EXISTS `post`;
CREATE TABLE IF NOT EXISTS `post` (
`idpost` int(11) NOT NULL AUTO_INCREMENT,
`post_title` varchar(45) NOT NULL,
`post_info` varchar(370) NOT NULL,
`users_idusers` int(11) NOT NULL,
`post_date` datetime NOT NULL,
PRIMARY KEY (`idpost`,`users_idusers`),
KEY `fk_post_users_idx` (`users_idusers`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `post`
--
INSERT INTO `post` (`idpost`, `post_title`, `post_info`, `users_idusers`, `post_date`) VALUES
(2, 'a', 'a', 1, '0000-00-00 00:00:00'),
(3, 'La vaca lola', 'tiene cabeza y tiene cola', 1, '0000-00-00 00:00:00'),
(4, 'pimpon es un muñeco', 'w', 1, '0000-00-00 00:00:00');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `users`
--
DROP TABLE IF EXISTS `users`;
CREATE TABLE IF NOT EXISTS `users` (
`idusers` int(11) NOT NULL AUTO_INCREMENT,
`user_name` varchar(45) NOT NULL,
`user_lastname` varchar(45) DEFAULT NULL,
`user_mail` varchar(45) NOT NULL,
`user_password` varchar(45) NOT NULL,
`user_pseudo` varchar(45) DEFAULT NULL,
PRIMARY KEY (`idusers`),
UNIQUE KEY `user_mail_UNIQUE` (`user_mail`)
) ENGINE=InnoDB AUTO_INCREMENT=39 DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `users`
--
INSERT INTO `users` (`idusers`, `user_name`, `user_lastname`, `user_mail`, `user_password`, `user_pseudo`) VALUES
(1, 'Paul', 'Salazar', '[email protected]', 'qwerty', 'paul'),
(7, 'Paul2', 'Salazar2', '[email protected]', 'qwerty', 'paul'),
(9, 'qwe', 'asd', 'as@d', 'qwsw', 'rrffr'),
(11, 'qwerty', 'qwerty', 'abc@qwerty', '123', 'qwerty'),
(12, 'qwe', 'asd', '[email protected]', 'q', 'q'),
(13, 'qwe', 'wew', '[email protected]', 'q', 'q'),
(15, 'juan', 'wew', 'qww@de', 'qwe', 'q'),
(16, 'qwe', 'wew', 'as@ds', 'qwe', 'qwe'),
(17, 'qwerty', 'wew', '[email protected]', 'm', 'm'),
(18, 'qqwww', 'qwwq', '[email protected]', 'a', 'q'),
(19, 'qwerty', 'qwwq', '[email protected]', 'q', 'q'),
(21, 'asd', 'asd2', 'asd', 'ytqwv', 'usa'),
(22, 'asd', 'asd2', 'asdd', 'ytqwv', 'usa'),
(23, 'asd', 'asd2', 'assdd', 'ytqwv', 'usa'),
(24, 'asd', 'asd2', 'asssdd', 'ytqwv', 'usa'),
(25, 'asd', 'asd2', 'asssadd', 'ytqwv', 'usa'),
(26, 'asd', 'asd2', 'assssadd', 'ytqwv', 'usa'),
(27, 'asd', 'asd2', 'asssssadd', 'ytqwv', 'usa'),
(28, 'asd', 'asd2', 'assssgsadd', 'ytqwv', 'usa'),
(29, 'asd', 'asd2', 'asssssgsadd', 'ytqwv', 'usa'),
(32, 'asd', 'asd2', 'assswessgsadd', 'ytqwv', 'usa'),
(33, 'asd', 'asd2', 'assswessegsadd', 'ytqwv', 'usa'),
(34, 'asd', 'asd2', 'assswsessegsadd', 'ytqwv', 'usa'),
(35, 'asd', 'asd2', 'assswsesssegsadd', 'ytqwv', 'usa'),
(36, 'asd', 'asd2', 'assswsessssegsadd', 'ytqwv', 'usa'),
(38, 'hola', 'sjo', 'asd@a', 'asd', 'asd');
--
-- Restricciones para tablas volcadas
--
--
-- Filtros para la tabla `comment`
--
ALTER TABLE `comment`
ADD CONSTRAINT `fk_comment_post1` FOREIGN KEY (`post_idpost`,`post_users_idusers`) REFERENCES `post` (`idpost`, `users_idusers`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Filtros para la tabla `post`
--
ALTER TABLE `post`
ADD CONSTRAINT `fk_post_users` FOREIGN KEY (`users_idusers`) REFERENCES `users` (`idusers`) 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 */;