/*
SQLyog Community v13.3.0 (64 bit)
MySQL - 9.2.0 : Database - roundcubemail
*********************************************************************
*/



CREATE DATABASE /*!32312 IF NOT EXISTS*/`roundcubemail` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */;

USE `roundcubemail`;

/*Table structure for table `cache` */


CREATE TABLE `cache` (
  `user_id` int unsigned NOT NULL,
  `cache_key` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
  `expires` datetime DEFAULT NULL,
  `data` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  PRIMARY KEY (`user_id`,`cache_key`),
  KEY `expires_index` (`expires`),
  CONSTRAINT `user_id_fk_cache` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;

/*Data for the table `cache` */

/*Table structure for table `cache_index` */


CREATE TABLE `cache_index` (
  `user_id` int unsigned NOT NULL,
  `mailbox` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
  `expires` datetime DEFAULT NULL,
  `valid` tinyint(1) NOT NULL DEFAULT '0',
  `data` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  PRIMARY KEY (`user_id`,`mailbox`),
  KEY `expires_index` (`expires`),
  CONSTRAINT `user_id_fk_cache_index` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;

/*Data for the table `cache_index` */

/*Table structure for table `cache_messages` */


CREATE TABLE `cache_messages` (
  `user_id` int unsigned NOT NULL,
  `mailbox` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
  `uid` int unsigned NOT NULL DEFAULT '0',
  `expires` datetime DEFAULT NULL,
  `data` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `flags` int NOT NULL DEFAULT '0',
  PRIMARY KEY (`user_id`,`mailbox`,`uid`),
  KEY `expires_index` (`expires`),
  CONSTRAINT `user_id_fk_cache_messages` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;

/*Data for the table `cache_messages` */

/*Table structure for table `cache_shared` */


CREATE TABLE `cache_shared` (
  `cache_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
  `expires` datetime DEFAULT NULL,
  `data` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  PRIMARY KEY (`cache_key`),
  KEY `expires_index` (`expires`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;

/*Data for the table `cache_shared` */

/*Table structure for table `cache_thread` */


CREATE TABLE `cache_thread` (
  `user_id` int unsigned NOT NULL,
  `mailbox` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
  `expires` datetime DEFAULT NULL,
  `data` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  PRIMARY KEY (`user_id`,`mailbox`),
  KEY `expires_index` (`expires`),
  CONSTRAINT `user_id_fk_cache_thread` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;

/*Data for the table `cache_thread` */

/*Table structure for table `collected_addresses` */


CREATE TABLE `collected_addresses` (
  `address_id` int unsigned NOT NULL AUTO_INCREMENT,
  `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `user_id` int unsigned NOT NULL,
  `type` int unsigned NOT NULL,
  PRIMARY KEY (`address_id`),
  UNIQUE KEY `user_email_collected_addresses_index` (`user_id`,`type`,`email`),
  CONSTRAINT `user_id_fk_collected_addresses` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=52 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;

/*Data for the table `collected_addresses` */

insert  into `collected_addresses`(`address_id`,`changed`,`name`,`email`,`user_id`,`type`) values 
(1,'2025-02-18 06:55:55','Ole.hans Fjellvang','ole.hans.fjellvang@altiboxmail.no',1,1),
(2,'2025-02-26 08:44:20','Kine Heian','kineheian@yahoo.com',1,1),
(3,'2025-02-28 15:50:58','Tommy Solberg','tommysolberg@hotmail.com',1,1),
(4,'2025-02-28 15:50:58','Juniorleir','2025@juniorleir.no',1,1),
(5,'2025-02-28 15:50:58','Stian Hagvik','stian.hagvik@gmail.com',1,1),
(6,'2025-02-28 15:52:10','Anders-Gustav Holt','anders@dittkontor.no',1,1),
(7,'2025-02-28 15:52:10','Hilde Braaten','hilde.braaten@gmail.com',1,1),
(8,'2025-02-28 15:52:10','Post Ditt Klubbhus','post@dittklubbhus.no',1,1),
(9,'2025-02-28 15:52:10','Service','service@dittklubbhus.no',1,1),
(10,'2025-02-28 15:52:10','klubb','klubb@dittklubbhus.no',1,1),
(11,'2025-02-28 15:52:10','Marthe Holt','marthe@dittklubbhus.no',1,1),
(12,'2025-03-03 16:03:16','Elisabeth Bergtun','ielisabeth.bergtun@gmail.com',1,1),
(13,'2025-03-05 09:06:27','Natalieskjeggestad','natalieskjeggestad@hotmail.com',1,1),
(14,'2025-03-05 09:09:11','Skogerva','skogerva@gmail.com',1,1),
(15,'2025-03-05 10:51:52','post','post@curty.no',1,1),
(16,'2025-03-10 17:19:43','Oleh','oleh@grettenett.no',2,1),
(17,'2025-03-13 12:07:29','Eli Kjønsberg','eli@juba.org',1,1),
(18,'2025-03-14 08:21:57','Oda Dalhoy','oda.dalhoy@juba.org',1,1),
(19,'2025-03-18 11:03:53','Anders','Anders@skyland.no',1,1),
(20,'2025-03-28 14:34:47','Oddbjorn Myhren','oddbjorn.myhren@tonsberg.kommune.no',1,1),
(21,'2025-03-28 14:34:47','Tor.arne Ueland','tor.arne.ueland@tonsberg.kommune.no',1,1),
(22,'2025-03-28 14:34:47','Anders Nygaard','anders.nygaard@tonsberg.kommune.no',1,1),
(23,'2025-03-31 15:33:35','Lucky Bowl Horten','horten@luckybowl.no',1,1),
(24,'2025-04-08 12:35:28','Norsk Folkehjelp Horten','horten@folkehjelp.no',1,1),
(25,'2025-04-23 12:20:24','Torstein Bjørndal','torstein@egas.no',1,1),
(26,'2025-04-28 16:58:09','Krisslill','krisslill@hotmail.com',1,1),
(27,'2025-04-29 07:53:01','frode cato olsen','fc-olsen@hotmail.com',1,1),
(28,'2025-05-02 12:03:22','Mani Neith','mani_kurd@hotmail.com',1,1),
(29,'2025-05-02 16:15:08','Unni Kristiansen','unni.kristiansen@gmail.com',1,1),
(30,'2025-05-05 12:10:26','Tur','tur@vestfoldbuss.no',1,1),
(31,'2025-05-08 07:59:04','Anne Marte Granshagen','annemarte0310@gmail.com',1,1),
(32,'2025-05-12 12:58:26','Info Kartutleie AS','info@kartutleie.no',1,1),
(33,'2025-05-12 12:59:03','Monica Skoglund','skoglund.monica1974@gmail.com',1,1),
(34,'2025-05-12 18:01:48','Norway','norway@thomann.de',1,1),
(35,'2025-05-16 14:48:13','Veronika Tigern','verokris@hotmail.com',1,1),
(36,'2025-05-26 13:14:41','Linn Celine Solheim','linn.celine92@gmail.com',1,1),
(37,'2025-05-26 13:16:24','Booking','booking@erikmogeno.com',1,1),
(38,'2025-05-26 13:22:00','Roy Hagen','roy.hagen@yahoo.no',1,1),
(39,'2025-05-27 12:50:23','Kundeservice','kundeservice@fortum.com',1,1),
(40,'2025-05-27 12:50:23','Geir Hermansen','geir.hermansen@sig-halvorsen.no',1,1),
(41,'2025-05-28 16:58:57','Carina Runningen','carina_runningen@yahoo.com',1,1),
(42,'2025-06-02 07:55:55','Iren Heggedal Preus','iren.heggedal.preus@tonsberg.kommune.no',1,1),
(43,'2025-06-02 14:48:04','Btb','btb@olsbu.no',1,1),
(44,'2025-06-04 08:23:27','maylee kuremyr','maylee-MK@hotmail.com',1,1),
(45,'2025-06-11 12:12:59','Stine.mathisen Heiberg','stine.mathisen.heiberg@tonsberg.kommune.no',1,1),
(46,'2025-06-11 12:13:00','Solerod Skole','solerod.skole@tonsberg.kommune.no',1,1),
(47,'2025-06-11 12:13:00','Post','post@bjerkelyskole.no',1,1),
(48,'2025-06-18 17:11:23','Elise Haugerud','eh@du-verden.no',1,1),
(49,'2025-06-18 17:14:29','Stian Sørsdal','naits6@yahoo.no',1,1),
(50,'2025-06-18 17:14:29','Ann-kristin Belsby','ann-kristin.belsby@sarpsborg.com',1,1),
(51,'2025-06-22 19:48:42','Sander','sander@grettenett.no',1,1);

/*Table structure for table `contactgroupmembers` */


CREATE TABLE `contactgroupmembers` (
  `contactgroup_id` int unsigned NOT NULL,
  `contact_id` int unsigned NOT NULL,
  `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
  PRIMARY KEY (`contactgroup_id`,`contact_id`),
  KEY `contactgroupmembers_contact_index` (`contact_id`),
  CONSTRAINT `contact_id_fk_contacts` FOREIGN KEY (`contact_id`) REFERENCES `contacts` (`contact_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `contactgroup_id_fk_contactgroups` FOREIGN KEY (`contactgroup_id`) REFERENCES `contactgroups` (`contactgroup_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;

/*Data for the table `contactgroupmembers` */

/*Table structure for table `contactgroups` */


CREATE TABLE `contactgroups` (
  `contactgroup_id` int unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int unsigned NOT NULL,
  `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
  `del` tinyint(1) NOT NULL DEFAULT '0',
  `name` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  PRIMARY KEY (`contactgroup_id`),
  KEY `contactgroups_user_index` (`user_id`,`del`),
  CONSTRAINT `user_id_fk_contactgroups` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;

/*Data for the table `contactgroups` */

/*Table structure for table `contacts` */


CREATE TABLE `contacts` (
  `contact_id` int unsigned NOT NULL AUTO_INCREMENT,
  `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
  `del` tinyint(1) NOT NULL DEFAULT '0',
  `name` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `email` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `firstname` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `surname` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `vcard` longtext COLLATE utf8mb4_unicode_ci,
  `words` text COLLATE utf8mb4_unicode_ci,
  `user_id` int unsigned NOT NULL,
  PRIMARY KEY (`contact_id`),
  KEY `user_contacts_index` (`user_id`,`del`),
  CONSTRAINT `user_id_fk_contacts` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;

/*Data for the table `contacts` */

/*Table structure for table `dictionary` */


CREATE TABLE `dictionary` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int unsigned DEFAULT NULL,
  `language` varchar(16) COLLATE utf8mb4_unicode_ci NOT NULL,
  `data` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uniqueness` (`user_id`,`language`),
  CONSTRAINT `user_id_fk_dictionary` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;

/*Data for the table `dictionary` */

/*Table structure for table `filestore` */


CREATE TABLE `filestore` (
  `file_id` int unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int unsigned NOT NULL,
  `context` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL,
  `filename` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL,
  `mtime` int NOT NULL,
  `data` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  PRIMARY KEY (`file_id`),
  UNIQUE KEY `uniqueness` (`user_id`,`context`,`filename`),
  CONSTRAINT `user_id_fk_filestore` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;

/*Data for the table `filestore` */

/*Table structure for table `identities` */


CREATE TABLE `identities` (
  `identity_id` int unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int unsigned NOT NULL,
  `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
  `del` tinyint(1) NOT NULL DEFAULT '0',
  `standard` tinyint(1) NOT NULL DEFAULT '0',
  `name` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL,
  `organization` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `email` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL,
  `reply-to` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `bcc` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `signature` longtext COLLATE utf8mb4_unicode_ci,
  `html_signature` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`identity_id`),
  KEY `user_identities_index` (`user_id`,`del`),
  KEY `email_identities_index` (`email`,`del`),
  CONSTRAINT `user_id_fk_identities` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;

/*Data for the table `identities` */

insert  into `identities`(`identity_id`,`user_id`,`changed`,`del`,`standard`,`name`,`organization`,`email`,`reply-to`,`bcc`,`signature`,`html_signature`) values 
(1,1,'2025-02-03 21:46:01',0,1,'','','oleh@grettenett.no','','',NULL,0),
(2,2,'2025-02-19 17:15:34',0,1,'','','sander@grettenett.no','','',NULL,0),
(3,3,'2025-02-19 18:16:10',0,1,'','','helene@grettenett.no','','',NULL,0);

/*Table structure for table `responses` */


CREATE TABLE `responses` (
  `response_id` int unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int unsigned NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `data` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `is_html` tinyint(1) NOT NULL DEFAULT '0',
  `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
  `del` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`response_id`),
  KEY `user_responses_index` (`user_id`,`del`),
  CONSTRAINT `user_id_fk_responses` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;

/*Data for the table `responses` */

/*Table structure for table `searches` */


CREATE TABLE `searches` (
  `search_id` int unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int unsigned NOT NULL,
  `type` int NOT NULL DEFAULT '0',
  `name` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL,
  `data` text COLLATE utf8mb4_unicode_ci,
  PRIMARY KEY (`search_id`),
  UNIQUE KEY `uniqueness` (`user_id`,`type`,`name`),
  CONSTRAINT `user_id_fk_searches` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;

/*Table structure for table `system` */


CREATE TABLE `system` (
  `name` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
  `value` mediumtext COLLATE utf8mb4_unicode_ci,
  PRIMARY KEY (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;

/*Data for the table `system` */

insert  into `system`(`name`,`value`) values 
('roundcube-version','2022081200');

/*Table structure for table `users` */


CREATE TABLE `users` (
  `user_id` int unsigned NOT NULL AUTO_INCREMENT,
  `username` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
  `mail_host` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
  `last_login` datetime DEFAULT NULL,
  `failed_login` datetime DEFAULT NULL,
  `failed_login_counter` int unsigned DEFAULT NULL,
  `language` varchar(16) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `preferences` longtext COLLATE utf8mb4_unicode_ci,
  PRIMARY KEY (`user_id`),
  UNIQUE KEY `username` (`username`,`mail_host`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;

/*Data for the table `users` */

insert  into `users`(`user_id`,`username`,`mail_host`,`created`,`last_login`,`failed_login`,`failed_login_counter`,`language`,`preferences`) values 
(1,'oleh@grettenett.no','localhost','2025-02-03 21:46:00','2025-07-11 11:44:50','2025-07-07 10:26:11',1,'nb_NO','a:3:{s:16:\"message_sort_col\";s:7:\"arrival\";s:17:\"collapsed_folders\";s:13:\"&INBOX&&Sent&\";s:11:\"client_hash\";s:16:\"hh3sYn9qYCQ5iCGK\";}'),
(2,'sander@grettenett.no','localhost','2025-02-19 17:15:34','2025-07-20 12:30:21','2025-04-07 05:16:16',1,'en_US','a:1:{s:11:\"client_hash\";s:16:\"ZQz3lzKmxdXYNQGT\";}'),
(3,'helene@grettenett.no','localhost','2025-02-19 18:16:10','2025-02-19 18:22:25','2025-03-03 00:40:32',1,'nb_NO','a:1:{s:11:\"client_hash\";s:16:\"m0EaWcT735gReG4y\";}');

