--
-- Host: localhost    Database: trusted-contacts
-- ------------------------------------------------------


--
-- Table structure for table `categories`
--

CREATE TABLE `categories` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  `slug` varchar(100) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `slug` (`slug`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `categories`
--

INSERT INTO `categories` VALUES (1,'Business','business'),(2,'Law','law');

--
-- Table structure for table `category_groups`
--

CREATE TABLE `category_groups` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `id_group` int(10) unsigned DEFAULT NULL,
  `id_category` int(10) unsigned DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_category_groups_company_idx` (`id_category`),
  KEY `fk_group_companies_group_idx` (`id_group`),
  CONSTRAINT `fk_categoru_groups_group` FOREIGN KEY (`id_group`) REFERENCES `groups` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_category_groups_category` FOREIGN KEY (`id_category`) REFERENCES `categories` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `category_groups`
--

INSERT INTO `category_groups` VALUES (1,1,1),(2,1,2),(3,2,2);

--
-- Table structure for table `cities`
--

CREATE TABLE `cities` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `slug` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `cities`
--

INSERT INTO `cities` VALUES (1,'Kraków','krakow'),(2,'Warszawa','warszawa'),(3,'Wrocóaw','wroclaw'),(4,'Poznaó','poznan'),(5,'Kraków','krakow'),(6,'Gdaósk','gdansk'),(7,'Szczecin','szczecin'),(8,'ó','lodz'),(9,'Lublin','lublin'),(10,'Katowice','katowice');

--
-- Table structure for table `companies`
--

CREATE TABLE `companies` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `slug` varchar(255) NOT NULL,
  `tooltip_text` varchar(255) DEFAULT NULL,
  `description` text NOT NULL,
  `address` varchar(255) DEFAULT NULL,
  `phone` varchar(13) DEFAULT NULL,
  `website` varchar(255) DEFAULT NULL,
  `status` tinyint(4) NOT NULL DEFAULT '0',
  `imageFolder` int(10) unsigned DEFAULT NULL,
  `city` varchar(100) NOT NULL DEFAULT 'Krak├│w',
  `zip_code` varchar(7) DEFAULT NULL,
  `street` varchar(255) DEFAULT NULL,
  `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `slug` (`slug`)
) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `companies`
--

INSERT INTO `companies` VALUES (1,'FlexAspect','flexaspect','IT company','web sites development, PHP, .NET\r\napplication development, Android, iOs, Windows','Berlin, Main street, 123','1234567890123',NULL,1,1,'Kraków',NULL,NULL,'2016-05-25 15:02:26'),(2,'Google','google','IT company','web sites development, PHP, .NET\r\napplication development, Android, iOs, Windows','Russia, Main street, 123','456456 456 45',NULL,1,2,'Kraków',NULL,NULL,'2016-05-25 15:02:26'),(5,'My Computer Works','my-computer-works','Computer service at your home','Filter options: ','Filter options: ','Filter option',NULL,2,5,'Kraków',NULL,NULL,'2016-05-25 15:02:26'),(6,'Techs In A Sec','techs-in-a-sec','Techs In A Sec','Welcome to Trusted Contacts!','Welcome to Trusted Contacts!',NULL,NULL,2,6,'Kraków',NULL,NULL,'2016-05-25 15:02:26'),(7,'Neus Networks','neus-networks','Zeus Networks','opis','adres','122545256',NULL,2,7,'Kraków',NULL,NULL,'2016-05-27 07:25:29'),(16,'Central Telephone','central-telephone','Central Telephone','',NULL,NULL,NULL,1,16,'Kraków',NULL,NULL,'2016-05-25 15:02:26'),(17,'Airwide Solutions','airwide-solutions','Airwide Solutions','Lorem Ipsum is simply dummy ','Lorem Ipsum is simply dummy ','+ 43 (214) 74',NULL,1,17,'Kraków','30-349','Test','2016-05-27 07:58:47'),(18,'Comcast Business','comcast-business','Comcast Business','',NULL,NULL,NULL,1,18,'Kraków',NULL,NULL,'2016-05-25 15:02:26'),(19,'Comcast Cable','comcast-cable','Comcast Cable','',NULL,NULL,NULL,1,19,'Kraków',NULL,NULL,'2016-05-25 15:02:26');

--
-- Table structure for table `company_services`
--

CREATE TABLE `company_services` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `id_company` int(10) unsigned NOT NULL,
  `service` varchar(45) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `id_company` (`id_company`),
  CONSTRAINT `company_services_ibfk_1` FOREIGN KEY (`id_company`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=496 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `company_services`
--

INSERT INTO `company_services` VALUES (417,6,'NewCompany'),(422,2,'NewCompany'),(466,5,'Filter options: '),(478,1,'mechanics'),(479,1,'NewOne'),(480,1,'NewTwo2'),(482,7,'1'),(483,7,'2'),(490,17,'Lorem Ipsum is simply dummy ');

--
-- Table structure for table `company_tags`
--

CREATE TABLE `company_tags` (
  `id` bigint(19) unsigned NOT NULL AUTO_INCREMENT,
  `id_company` int(10) unsigned NOT NULL,
  `id_tag` int(10) unsigned NOT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_company_tags_company_idx` (`id_company`),
  KEY `fk_company_tags_tag_idx` (`id_tag`),
  CONSTRAINT `fk_company_tags_company` FOREIGN KEY (`id_company`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_company_tags_tag` FOREIGN KEY (`id_tag`) REFERENCES `tags` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=680 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `company_tags`
--

INSERT INTO `company_tags` VALUES (53,16,20),(77,18,12),(78,18,20),(83,19,15),(84,19,12),(85,19,18),(86,19,20),(569,6,8),(570,6,15),(571,6,7),(572,6,18),(573,6,20),(580,2,3),(582,2,33),(634,5,8),(635,5,15),(636,5,11),(660,1,8),(661,1,9),(662,1,36),(663,1,15),(664,1,33),(665,1,37),(667,7,8),(668,7,15),(669,7,7),(676,17,16);

--
-- Table structure for table `group_companies`
--

CREATE TABLE `group_companies` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `id_group` int(10) unsigned NOT NULL,
  `id_company` int(10) unsigned NOT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_group_companies_group_idx` (`id_group`),
  KEY `fk_group_companies_company_idx` (`id_company`),
  CONSTRAINT `fk_group_companies_company` FOREIGN KEY (`id_company`) REFERENCES `companies` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_group_companies_group` FOREIGN KEY (`id_group`) REFERENCES `groups` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=231 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `group_companies`
--

INSERT INTO `group_companies` VALUES (33,1,18),(35,1,19),(182,1,2),(213,1,1),(225,2,17),(226,2,16),(227,2,5),(228,2,6),(229,2,7);

--
-- Table structure for table `groups`
--

CREATE TABLE `groups` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  `slug` varchar(100) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `slug` (`slug`)
) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `groups`
--

INSERT INTO `groups` VALUES (1,'Agricultural wholesale','agricultural-wholesale'),(2,'General chemical wholesale','general-chemical-wholesale');

--
-- Table structure for table `tags`
--

CREATE TABLE `tags` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `name_UNIQUE` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=43 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `tags`
--

INSERT INTO `tags` VALUES (16,'agriculture'),(8,'computer2'),(9,'development'),(36,'EnterTag'),(15,'hardware'),(3,'Industrial'),(7,'laptop'),(12,'mobile'),(33,'MondayTest'),(37,'Phenomena'),(18,'repairing'),(20,'service'),(11,'software');

--
-- Table structure for table `user_comments`
--

CREATE TABLE `user_comments` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `id_company` int(10) unsigned NOT NULL,
  `id_user` int(10) unsigned NOT NULL,
  `comments` varchar(255) NOT NULL,
  `status` tinyint(1) unsigned DEFAULT '0' COMMENT '0 - new\n1 - approved\n2 - declined',
  `date_added` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `fk_user_comments_companies_idx` (`id_company`),
  KEY `fk_user_comments_users_idx` (`id_user`),
  CONSTRAINT `fk_user_comments_companies` FOREIGN KEY (`id_company`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_user_comments_users` FOREIGN KEY (`id_user`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=185 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `user_comments`
--

INSERT INTO `user_comments` VALUES (3,5,2,'Hello!',1,'2016-05-16 12:20:23'),(25,1,2,'asafasdasdas',1,'2016-05-17 12:20:25'),(26,1,2,'asdasd',1,'2016-05-17 12:20:27'),(27,1,2,'asdasd',1,'2016-05-17 12:20:28'),(28,1,2,'wrwerweeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee',1,'2016-05-17 12:25:00'),(30,5,2,'╨╣╤Ж╤Г╨╣╤Ж╤Г╨╣╤Ж╤Г╨╣╤Ж╤Г╨╣╤Ж╤Г╨╣╤Ж',1,'2016-05-17 13:23:20'),(31,5,2,'╨╣╤Ж╤Г╨╣╤Ж╨╣╤Г╤Ж╤Ж╤Ж╤Ж╤Ж╤Ж╤Ж╤Ж╤Ж╤Ж╤Ж╤Ж╤Ж╤Ж╤Ж╤Ж╤Ж╤Ж╤Ж╤Ж╤Ж╤Ж╤Ж╤Ж╤Ж╤Ж╤Ж╤Ж╤Ж╤Ж╤Ж╤Ж╤Ж╤Ж╤Ж╤Ж╤Ж╤Ж',1,'2016-05-17 13:23:24'),(32,5,2,'╤Г╨║╨╡╨╡╤Г╨╡╤Г╨║╨╡╤Г╨║╨╡',1,'2016-05-17 13:23:32'),(33,5,2,'╤Г╨║╨╡╤Г╨║╨╡╤Г╨║╨╡',1,'2016-05-17 13:23:33'),(34,5,2,'╨║╤Г╨╡╤Г╨║╨╡╤Г╨║╨╡',1,'2016-05-17 13:23:35'),(35,5,2,'╤Г╨║╨╡╤Г╨║╨╡╤Г╨║',1,'2016-05-17 13:23:36'),(36,6,2,'<script>alert()</script>',1,'2016-05-17 13:25:06'),(37,5,2,'',2,'2016-05-17 13:26:25'),(38,5,2,'',1,'2016-05-17 13:26:49'),(39,5,2,'',1,'2016-05-17 13:26:50'),(40,5,2,'',1,'2016-05-17 13:26:51'),(41,5,2,'',1,'2016-05-17 13:26:51'),(42,5,2,'',1,'2016-05-17 13:26:51'),(43,5,2,'',1,'2016-05-17 13:26:51'),(44,5,2,'',1,'2016-05-17 13:26:51'),(45,5,2,'',1,'2016-05-17 13:26:51'),(46,5,2,'',1,'2016-05-17 13:26:51'),(47,5,2,'',1,'2016-05-17 13:26:52'),(48,5,2,'',1,'2016-05-17 13:26:52'),(49,5,2,'',1,'2016-05-17 13:26:52'),(50,5,2,'',1,'2016-05-17 13:26:52'),(51,5,2,'',1,'2016-05-17 13:26:52'),(52,5,2,'',1,'2016-05-17 13:26:52'),(53,5,2,'',1,'2016-05-17 13:26:53'),(54,5,2,'',1,'2016-05-17 13:26:53'),(55,5,2,'',1,'2016-05-17 13:26:53'),(56,5,2,'',1,'2016-05-17 13:26:53'),(57,5,2,'',1,'2016-05-17 13:26:58'),(58,5,2,'',1,'2016-05-17 13:26:58'),(59,5,2,'',1,'2016-05-17 13:26:58'),(60,5,2,'',1,'2016-05-17 13:26:58'),(61,5,2,'',1,'2016-05-17 13:26:58'),(62,5,2,'',1,'2016-05-17 13:26:58'),(63,5,2,'',1,'2016-05-17 13:26:59'),(64,5,2,'',1,'2016-05-17 13:26:59'),(65,5,2,'',1,'2016-05-17 13:26:59'),(66,5,2,'',1,'2016-05-17 13:26:59'),(67,5,2,'',1,'2016-05-17 13:26:59'),(68,5,2,'',1,'2016-05-17 13:26:59'),(69,5,2,'',1,'2016-05-17 13:26:59'),(70,5,2,'',1,'2016-05-17 13:27:00'),(71,5,2,'',1,'2016-05-17 13:27:04'),(72,5,2,'',1,'2016-05-17 13:27:04'),(73,5,2,'',1,'2016-05-17 13:27:04'),(74,5,2,'',1,'2016-05-17 13:27:04'),(75,5,2,'',1,'2016-05-17 13:27:05'),(76,5,2,'',1,'2016-05-17 13:27:05'),(77,5,2,'',1,'2016-05-17 13:27:05'),(78,5,2,'',1,'2016-05-17 13:27:05'),(79,5,2,'',1,'2016-05-17 13:27:05'),(80,5,2,'',1,'2016-05-17 13:27:05'),(81,5,2,'',1,'2016-05-17 13:27:06'),(82,5,2,'',1,'2016-05-17 13:27:06'),(83,5,2,'',1,'2016-05-17 13:27:06'),(84,5,2,'',1,'2016-05-17 13:27:06'),(85,5,2,'',1,'2016-05-17 13:27:06'),(86,5,2,'',1,'2016-05-17 13:27:06'),(87,5,2,'',1,'2016-05-17 13:27:07'),(88,5,2,'',1,'2016-05-17 13:27:07'),(89,5,2,'',1,'2016-05-17 13:27:07'),(90,5,2,'',1,'2016-05-17 13:27:07'),(91,5,2,'',1,'2016-05-17 13:27:07'),(92,5,2,'',1,'2016-05-17 13:27:07'),(93,5,2,'',1,'2016-05-17 13:27:08'),(94,5,2,'',1,'2016-05-17 13:27:08'),(95,5,2,'',1,'2016-05-17 13:27:08'),(96,5,2,'',1,'2016-05-17 13:27:08'),(97,5,2,'',1,'2016-05-17 13:27:08'),(98,5,2,'',1,'2016-05-17 13:27:08'),(99,5,2,'',1,'2016-05-17 13:27:09'),(100,5,2,'',1,'2016-05-17 13:27:09'),(101,5,2,'',1,'2016-05-17 13:27:09'),(102,5,2,'',1,'2016-05-17 13:27:09'),(103,5,2,'',1,'2016-05-17 13:27:09'),(104,5,2,'',1,'2016-05-17 13:27:09'),(105,5,2,'',1,'2016-05-17 13:27:10'),(106,5,2,'',1,'2016-05-17 13:27:10'),(107,5,2,'',1,'2016-05-17 13:27:10'),(108,5,2,'',1,'2016-05-17 13:27:10'),(109,5,2,'',1,'2016-05-17 13:27:10'),(110,5,2,'',1,'2016-05-17 13:27:10'),(111,5,2,'',1,'2016-05-17 13:27:11'),(112,5,2,'',1,'2016-05-17 13:27:11'),(113,5,2,'',1,'2016-05-17 13:27:11'),(114,5,2,'',1,'2016-05-17 13:27:13'),(115,5,2,'',1,'2016-05-17 13:27:13'),(116,5,2,'',1,'2016-05-17 13:27:13'),(117,5,2,'',1,'2016-05-17 13:27:14'),(118,5,2,'',1,'2016-05-17 13:27:14'),(119,5,2,'',1,'2016-05-17 13:27:14'),(120,5,2,'',1,'2016-05-17 13:27:14'),(121,5,2,'',1,'2016-05-17 13:27:14'),(122,5,2,'',1,'2016-05-17 13:27:15'),(123,5,2,'',1,'2016-05-17 13:27:15'),(124,5,2,'',1,'2016-05-17 13:27:15'),(125,5,2,'',1,'2016-05-17 13:27:15'),(126,5,2,'',1,'2016-05-17 13:27:15'),(127,5,2,'',1,'2016-05-17 13:27:15'),(128,5,2,'',1,'2016-05-17 13:27:16'),(129,5,2,'',1,'2016-05-17 13:27:16'),(130,5,2,'',1,'2016-05-17 13:27:16'),(131,5,2,'',1,'2016-05-17 13:27:16'),(132,5,2,'',1,'2016-05-17 13:27:16'),(133,5,2,'',1,'2016-05-17 13:27:16'),(134,5,2,'',1,'2016-05-17 13:27:17'),(135,5,2,'',1,'2016-05-17 13:27:17'),(136,5,2,'',1,'2016-05-17 13:27:17'),(137,5,2,'',1,'2016-05-17 13:27:17'),(138,5,2,'',1,'2016-05-17 13:27:17'),(139,5,2,'',1,'2016-05-17 13:27:17'),(140,5,2,'',1,'2016-05-17 13:27:18'),(141,5,2,'',1,'2016-05-17 13:27:18'),(142,5,2,'',1,'2016-05-17 13:27:18'),(143,5,2,'',1,'2016-05-17 13:27:18'),(144,5,2,'',1,'2016-05-17 13:27:18'),(145,5,2,'',1,'2016-05-17 13:27:18'),(146,5,2,'',1,'2016-05-17 13:27:19'),(147,16,2,'╨╜╨║╨╡╨╜╨║╨╡╨╜╨║╨╡╨╜╨║╨╡╨╜╨║╨╡╨╜╨║╨╡╨╜╨╡╨║',1,'2016-05-17 13:31:47'),(153,1,2,'werwerwerwerwerweweeeeeeeeeeeeee',1,'2016-05-18 10:50:19'),(154,1,2,'werweeeeeeeeeeee',1,'2016-05-18 10:50:28'),(155,1,2,'test',1,'2016-05-18 11:01:04'),(181,17,12,'╤Й╨┤╤Й╨┤╤Й╨┤╨┤╤Л╨▓╨┤╨╛╨░╨╗╨╛╤Л╨▓╤А╨░╨╛ ╤Л╨┐╨▓╨╛╨░╨╕ ╤Л╨▓╨╛╨░╤Л╨▓╨╗╨╛╤А╨░ ╨╗╨╛╤Л╨▓╤А╨╕╨░╨╛ ╤Л╨▓╨┐╨░',1,'2016-05-27 12:51:23');

--
-- Table structure for table `user_likes`
--

CREATE TABLE `user_likes` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `id_user` int(10) unsigned NOT NULL,
  `id_company` int(10) unsigned NOT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_user_likes_user` (`id_user`),
  KEY `idx_user_likes_company` (`id_company`),
  CONSTRAINT `fk_user_likes_company` FOREIGN KEY (`id_company`) REFERENCES `companies` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_user_likes_user` FOREIGN KEY (`id_user`) REFERENCES `users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=54 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `user_likes`
--

INSERT INTO `user_likes` VALUES (2,2,18),(8,2,1),(9,2,16),(12,2,6),(14,2,5),(36,2,7),(42,2,17);


