


-- Upgrade From 2.3.x


CREATE TABLE `users` (
  `user_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_name` varchar(255) NOT NULL,
  `user_email` varchar(255) NOT NULL,
  `user_password` varchar(255) NOT NULL,
  `user_status` enum('active','inactive') NOT NULL,
  `user_role` enum('admin','user') NOT NULL,
  `user_tasks` text NOT NULL,
  PRIMARY KEY (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

insert  into `users`(`user_id`,`user_name`,`user_email`,`user_password`,`user_status`,`user_role`,`user_tasks`) values (1,'admin','admin@example.com','1a1dc91c907325c69271ddf0c944bc72','active','admin','');

-- Upgrade From 2.4.x

ALTER TABLE `epaper_pages`   
  ADD COLUMN `pg_pdf` VARCHAR(255) NOT NULL  DEFAULT '' AFTER `pg_cdata`;

ALTER TABLE `epaper_maps`   
  ADD COLUMN `mp_next_link` VARCHAR(255) NOT NULL  DEFAULT '' AFTER `mp_ratio`;

  
CREATE TABLE `media`( 
`md_id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, 
`md_title` VARCHAR(255) NOT NULL  DEFAULT '', 
`md_file` VARCHAR(255) NOT NULL, PRIMARY KEY (`md_id`) ) 
ENGINE=INNODB CHARSET=utf8;

 
-- Upgrade From 2.5.x

CREATE TABLE `epaper_supps`(  
  `sp_id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
  `sp_name` VARCHAR(255) NOT NULL,
  `sp_alias` VARCHAR(255) NOT NULL,
  `sp_order` INT(11) UNSIGNED NOT NULL,  
  `cat_id` INT(11) UNSIGNED NOT NULL,
  PRIMARY KEY (`sp_id`),
  CONSTRAINT `FK_cat_supp` FOREIGN KEY (`cat_id`) REFERENCES `epaper_categories`(`cat_id`) ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=INNODB CHARSET=utf8;

ALTER TABLE `epaper_pages`   
  ADD COLUMN `sp_id` INT(11) UNSIGNED NOT NULL AFTER `pg_pdf`;

CREATE TABLE `epaper_bookmarks`(  
  `bkm_id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
  `bkm_title` VARCHAR(255) NOT NULL,
  `bkm_order` INT(11) UNSIGNED NOT NULL,
  `pg_id` INT(11) UNSIGNED NOT NULL,
  `ed_id` INT(11) UNSIGNED NOT NULL,
  PRIMARY KEY (`bkm_id`),
  CONSTRAINT `FK_Bkm_Pg` FOREIGN KEY (`pg_id`) REFERENCES `epaper_pages`(`pg_id`) ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=INNODB CHARSET=utf8;
 
-- Upgrade from 2.6

ALTER TABLE `epaper_maps`   
  CHANGE `mp_title` `mp_title` VARCHAR(1000) CHARSET utf8 NOT NULL,
  CHANGE `mp_alias` `mp_alias` VARCHAR(1000) CHARSET utf8 NOT NULL,
  CHANGE `mp_desc` `mp_desc` TEXT CHARSET utf8 NOT NULL,
  CHANGE `mp_metakeys` `mp_metakeys` VARCHAR(1000) CHARSET utf8 NOT NULL,
  CHANGE `mp_metadesc` `mp_metadesc` VARCHAR(1000) CHARSET utf8 NOT NULL,
  CHANGE `mp_image` `mp_image` VARCHAR(255) CHARSET utf8 NOT NULL,
  CHANGE `mp_next_link` `mp_next_link` VARCHAR(255) CHARSET utf8 DEFAULT ''  NOT NULL;

ALTER TABLE `epaper_bookmarks`   
  CHANGE `bkm_title` `bkm_title` VARCHAR(255) CHARSET utf8 NOT NULL;
 

