UPDATE `widgets` SET `TABLA` = 'widgets_1' WHERE `widgets`.`ID` = 1;
UPDATE `widgets` SET `TABLA` = 'widgets_2' WHERE `widgets`.`ID` = 2;

ALTER TABLE `widgets_6_rel` CHANGE `idpadre` `idwidget` INT(11) NOT NULL;
ALTER TABLE `widgets_5_rel` CHANGE `idtabla` `idwidget` INT(11) NOT NULL;
ALTER TABLE `widgets_5_urls` CHANGE `idtabla` `idwidget` INT(11) NOT NULL;
ALTER TABLE `widgets_4_rel` CHANGE `idbloque` `idwidget` INT(4) NOT NULL;


ALTER TABLE `categorias` ADD `user_id` INT(7) NOT NULL AFTER `keywords`;
ALTER TABLE `articulos` ADD `user_id` INT(7) NOT NULL AFTER `portada`;
ALTER TABLE `articulos` CHANGE `votos` `votos` VARCHAR(3) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0';
-- https://www.phpmyadmin.net/
--
-- Servidor: localhost
-- Tiempo de generación: 18-12-2018 a las 11:44:51
-- Versión del servidor: 10.1.32-MariaDB
-- Versión de PHP: 7.0.30

START TRANSACTION;

--
-- Base de datos: `blogsite`
--

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

--
-- Estructura de tabla para la tabla `auth_assignment`
--

CREATE TABLE `auth_assignment` (
  `item_name` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
  `user_id` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
  `created_at` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

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

INSERT INTO `auth_assignment` (`item_name`, `user_id`, `created_at`) VALUES
('admin', '1', 1540379229),
('admin', '14', 1539161679),
('admin', '30', 1537806729);

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

--
-- Estructura de tabla para la tabla `auth_item`
--

CREATE TABLE `auth_item` (
  `name` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
  `type` smallint(6) NOT NULL,
  `description` text COLLATE utf8_unicode_ci,
  `rule_name` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL,
  `data` blob,
  `created_at` int(11) DEFAULT NULL,
  `updated_at` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

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

INSERT INTO `auth_item` (`name`, `type`, `description`, `rule_name`, `data`, `created_at`, `updated_at`) VALUES
('admin', 1, NULL, NULL, NULL, 1535444556, 1535444556),
('create', 2, 'Create events, news, results and users', NULL, NULL, 1535444556, 1535444556),
('read', 2, 'See events, news, results and users', NULL, NULL, 1535444556, 1535444556),
('shop', 1, NULL, NULL, NULL, 1535444556, 1535444556),
('update', 2, 'Update all events, news, results and users', NULL, NULL, 1535444556, 1535444556),
('updateOwn', 2, 'Update own events, news and results', 'isAuthor', NULL, 1535444556, 1535444556),
('updateProfile', 2, 'Update own user', 'isAuthor', NULL, 1535444556, 1535444556);

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

--
-- Estructura de tabla para la tabla `auth_item_child`
--

CREATE TABLE `auth_item_child` (
  `parent` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
  `child` varchar(64) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

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

INSERT INTO `auth_item_child` (`parent`, `child`) VALUES
('admin', 'shop'),
('admin', 'update'),
('shop', 'create'),
('shop', 'updateOwn');

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

--
-- Estructura de tabla para la tabla `auth_rule`
--

CREATE TABLE `auth_rule` (
  `name` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
  `data` blob,
  `created_at` int(11) DEFAULT NULL,
  `updated_at` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

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

INSERT INTO `auth_rule` (`name`, `data`, `created_at`, `updated_at`) VALUES
('isAuthor', 0x4f3a32333a226261636b656e645c726261635c417574686f7252756c65223a333a7b733a343a226e616d65223b733a383a226973417574686f72223b733a393a22637265617465644174223b693a313533353434343535363b733a393a22757064617465644174223b693a313533353434343535363b7d, 1535444556, 1535444556);

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

--
-- Estructura de tabla para la tabla `changelog`
--

CREATE TABLE `changelog` (
  `id` int(11) NOT NULL,
  `table_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `row_id` int(11) NOT NULL,
  `event` smallint(6) NOT NULL,
  `created_at` int(11) NOT NULL,
  `created_by` int(11) DEFAULT NULL,
  `field_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `old_value` text COLLATE utf8_unicode_ci,
  `new_value` text COLLATE utf8_unicode_ci
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

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

--
-- Estructura de tabla para la tabla `user`
--

CREATE TABLE `user` (
  `id` int(11) NOT NULL,
  `username` varchar(32) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `auth_key` varchar(32) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `password_hash` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `password_reset_token` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  `email` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `imageFile` varchar(150) DEFAULT NULL,
  `status` smallint(6) NOT NULL DEFAULT '10',
  `notification_document` tinyint(2) DEFAULT '0',
  `notification_promotion` tinyint(2) DEFAULT '0',
  `notification_blog` tinyint(2) DEFAULT '0',
  `created_at` int(11) NOT NULL,
  `updated_at` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

INSERT INTO `user` (`id`, `username`, `auth_key`, `password_hash`, `password_reset_token`, `email`, `imageFile`, `status`, `notification_document`, `notification_promotion`, `notification_blog`, `created_at`, `updated_at`) VALUES
(1, 'xavi', 'neHmnM2GgP9gDTQxLwvSdNEfUu4E0XGc', '$2y$13$UVXoGcnLSeaVfOp4Pia9ZuFT97bKMUEZ5QufP60DgLE1DGauluCLu', '96-eMG--iMBlYXPgHfKUvNcWjp9C7IDL_1542734644', 'xavier.garcia@hispanetwork.com', '08c14ed37316294698839d4be8e54da40e86fdb8.jpg', 1, 1, 1, 1, 1533811310, 1542734644),
(14, 'adam', 'eVSVzTdf-xWnGYeME7k0bbQ7c1izlNyL', '$2y$13$k28S1jRI7BTLFVw6amHIdeaKS4JywI9n9CIaj/QFHTaXJ/VfbLDfa', NULL, 'adam.ramos@hispanetwork.com', 'a7d2579e97ea31c77aa546fa2f6f4fc347fbb2bb.jpg', 1, 0, 1, 1, 1535373556, 1539161679);

--
-- Índices para tablas volcadas
--

--
-- Indices de la tabla `auth_assignment`
--
ALTER TABLE `auth_assignment`
  ADD PRIMARY KEY (`item_name`,`user_id`),
  ADD KEY `auth_assignment_user_id_idx` (`user_id`);

--
-- Indices de la tabla `auth_item`
--
ALTER TABLE `auth_item`
  ADD PRIMARY KEY (`name`),
  ADD KEY `rule_name` (`rule_name`),
  ADD KEY `idx-auth_item-type` (`type`);

--
-- Indices de la tabla `auth_item_child`
--
ALTER TABLE `auth_item_child`
  ADD PRIMARY KEY (`parent`,`child`),
  ADD KEY `child` (`child`);

--
-- Indices de la tabla `auth_rule`
--
ALTER TABLE `auth_rule`
  ADD PRIMARY KEY (`name`);

--
-- Indices de la tabla `changelog`
--
ALTER TABLE `changelog`
  ADD PRIMARY KEY (`id`),
  ADD KEY `index-1` (`table_name`),
  ADD KEY `index-2` (`table_name`,`row_id`),
  ADD KEY `index-3` (`table_name`,`field_name`),
  ADD KEY `index-4` (`event`);

--
-- Indices de la tabla `user`
--
ALTER TABLE `user`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `username` (`username`);

--
-- AUTO_INCREMENT de las tablas volcadas
--

--
-- AUTO_INCREMENT de la tabla `changelog`
--
ALTER TABLE `changelog`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de la tabla `user`
--
ALTER TABLE `user`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;

--
-- Restricciones para tablas volcadas
--

--
-- Filtros para la tabla `auth_assignment`
--
ALTER TABLE `auth_assignment`
  ADD CONSTRAINT `auth_assignment_ibfk_1` FOREIGN KEY (`item_name`) REFERENCES `auth_item` (`name`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Filtros para la tabla `auth_item`
--
ALTER TABLE `auth_item`
  ADD CONSTRAINT `auth_item_ibfk_1` FOREIGN KEY (`rule_name`) REFERENCES `auth_rule` (`name`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Filtros para la tabla `auth_item_child`
--
ALTER TABLE `auth_item_child`
  ADD CONSTRAINT `auth_item_child_ibfk_1` FOREIGN KEY (`parent`) REFERENCES `auth_item` (`name`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `auth_item_child_ibfk_2` FOREIGN KEY (`child`) REFERENCES `auth_item` (`name`) ON DELETE CASCADE ON UPDATE CASCADE;
COMMIT;
CREATE TABLE `session` (
  `id` char(40) NOT NULL,
  `expire` int(11) DEFAULT NULL,
  `data` blob
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


ALTER TABLE `session`
  ADD PRIMARY KEY (`id`);