


CREATE TABLE `page` (
  `id` int(11) NOT NULL,
  `name` varchar(500) NOT NULL,
  `bgImage` varchar(200) NOT NULL,
  `created` datetime NOT NULL,
  `updated` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `post` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `pageId` int(11) NOT NULL,
  `heading` text NOT NULL,
  `image` varchar(500) DEFAULT NULL,
  `text` text,
  `created` datetime NOT NULL,
  `updated` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `user` (
  `id` int(11) NOT NULL,
  `fullName` varchar(400) NOT NULL,
  `email` varchar(400) NOT NULL,
  `msisdn` varchar(200) NOT NULL,
  `password` varchar(500) NOT NULL,
  `status` int(11) NOT NULL DEFAULT '1',
  `permission` int(11) NOT NULL DEFAULT '0',
  `created` datetime NOT NULL,
  `updated` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

INSERT INTO `user` (`id`, `fullName`, `email`, `msisdn`, `password`, `status`, `permission`, `created`, `updated`) VALUES
(7, 'Halo Technology', 'admin@halo-technology.co.ke', '743433270', '7c222fb2927d828af22f592134e8932480637c0d', 1, 1, '2021-08-24 09:25:01', '2021-08-24 11:20:00');


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

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

ALTER TABLE `user`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `email` (`email`),
  ADD UNIQUE KEY `msisdn` (`msisdn`);


ALTER TABLE `page`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
ALTER TABLE `post`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;
ALTER TABLE `user`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
