 /*!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 utf8 */;
+/*!40101 SET NAMES utf8mb4 */;
 
 --
 -- Base de datos: `appmultimedia`
 --
+
+-- --------------------------------------------------------
+
+--
+-- Estructura de tabla para la tabla `comments`
+--
+
+CREATE TABLE IF NOT EXISTS `comments` (
+  `id` int(11) NOT NULL,
+  `user_id` int(11) NOT NULL,
+  `file_id` int(11) NOT NULL,
+  `comment` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
+  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
 
 -- --------------------------------------------------------
 

-- Índices para tablas volcadas
--

CREATE TABLE IF NOT EXISTS `shareds` (
  `id` int(11) NOT NULL,
  `of_who` int(11) NOT NULL,
  `for_who` int(11) NOT NULL,
  `file_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `FK_user` (`of_who`),
  KEY `FK_file` (`file_id`),
  CONSTRAINT `FK_file` FOREIGN KEY (`file_id`) REFERENCES `files` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `FK_user` FOREIGN KEY (`of_who`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='This table has data related with the commentaries';

--
-- Indices de la tabla `files`
--
ALTER TABLE `files`
  ADD PRIMARY KEY (`id`), ADD KEY `FK__format` (`format_id`), ADD KEY `FK__users` (`user_id`);

--
-- Indices de la tabla `formats`
--
ALTER TABLE `formats`
  ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `UNIQUE NAME` (`name`), ADD KEY `FK_type` (`type_id`);

--
-- Indices de la tabla `rols`
--
ALTER TABLE `rols`
  ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `NAME UNIQUE` (`name`);

--
-- Indices de la tabla `types`

(7, 'xls', 'This is a format by Excel''s document', 3, '2016-09-21 14:30:49', '2016-09-21 14:30:49'),
(8, 'pdf', 'This is a format by PDF''s document', 3, '2016-09-21 14:30:52', '2016-09-21 14:30:52'),
(9, 'txt', 'This is a format by TXT''s document', 3, '2016-09-21 14:30:53', '2016-09-21 14:30:53'),
(10, 'xlsx', 'This is a format Excel''s document (2007)', 3, '2016-09-21 14:30:55', '2016-09-21 14:30:55'),
(11, 'jpeg', 'Image format', 2, '2016-09-28 20:48:55', '2016-09-28 20:48:55');

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `notifications`
--

CREATE TABLE IF NOT EXISTS `notifications` (
  `id` int(11) NOT NULL,
  `notification_id` int(11) NOT NULL,
  `state` varchar(5) COLLATE utf8_unicode_ci NOT NULL DEFAULT '1',
  `type` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Volcado de datos para la tabla `notifications`
--

INSERT INTO `notifications` (`id`, `notification_id`, `state`, `type`, `created_at`, `updated_at`) VALUES
(1, 9, '1', 'shared', '2016-10-04 02:45:43', '2016-10-03 19:56:55'),
(2, 10, '0', 'shared', '2016-10-04 02:45:44', '2016-10-03 21:16:42');

-- --------------------------------------------------------

