/*
MySQL Data Transfer
Source Host: localhost
Source Database: webval
Target Host: localhost
Target Database: webval
Date: 28.4.2009 6:03:10
*/

SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for category
-- ----------------------------
DROP TABLE IF EXISTS `category`;
CREATE TABLE "category" (
  "id" int(11) NOT NULL,
  "name" text collate utf8_slovak_ci,
  PRIMARY KEY  ("id")
);

-- ----------------------------
-- Table structure for category_site
-- ----------------------------
DROP TABLE IF EXISTS `category_site`;
CREATE TABLE "category_site" (
  "category" int(11) NOT NULL,
  "site" int(11) NOT NULL,
  KEY "FK_Reference_7" ("category"),
  KEY "FK_Reference_8" ("site"),
  CONSTRAINT "FK_Reference_7" FOREIGN KEY ("category") REFERENCES "category" ("id"),
  CONSTRAINT "FK_Reference_8" FOREIGN KEY ("site") REFERENCES "site" ("id")
);

-- ----------------------------
-- Table structure for comment
-- ----------------------------
DROP TABLE IF EXISTS `comment`;
CREATE TABLE "comment" (
  "id" int(11) NOT NULL,
  "text" text collate utf8_slovak_ci NOT NULL,
  "site" int(11) NOT NULL,
  "user" int(11) NOT NULL,
  "parent" int(11) default NULL,
  PRIMARY KEY  ("id"),
  KEY "FK_Reference_15" ("parent"),
  KEY "FK_Reference_5" ("site"),
  KEY "FK_Reference_6" ("user"),
  CONSTRAINT "FK_Reference_15" FOREIGN KEY ("parent") REFERENCES "comment" ("id"),
  CONSTRAINT "FK_Reference_5" FOREIGN KEY ("site") REFERENCES "site" ("id"),
  CONSTRAINT "FK_Reference_6" FOREIGN KEY ("user") REFERENCES "user" ("id")
);

-- ----------------------------
-- Table structure for criterium
-- ----------------------------
DROP TABLE IF EXISTS `criterium`;
CREATE TABLE "criterium" (
  "id" int(11) NOT NULL,
  "name" text collate utf8_slovak_ci NOT NULL,
  "periodicity" time default NULL,
  PRIMARY KEY  ("id")
);

-- ----------------------------
-- Table structure for criterium_value
-- ----------------------------
DROP TABLE IF EXISTS `criterium_value`;
CREATE TABLE "criterium_value" (
  "id" int(11) NOT NULL auto_increment,
  "criterium" int(11) NOT NULL,
  "site" int(11) NOT NULL,
  "value" float NOT NULL,
  "time" datetime default NULL,
  PRIMARY KEY  ("id")
);

-- ----------------------------
-- Table structure for profile
-- ----------------------------
DROP TABLE IF EXISTS `profile`;
CREATE TABLE "profile" (
  "id" int(11) NOT NULL,
  "name" text collate utf8_slovak_ci NOT NULL,
  PRIMARY KEY  ("id")
);

-- ----------------------------
-- Table structure for profile_criterium
-- ----------------------------
DROP TABLE IF EXISTS `profile_criterium`;
CREATE TABLE "profile_criterium" (
  "id" int(11) NOT NULL auto_increment,
  "criterium" int(11) default NULL,
  "profile" int(11) default NULL,
  "value" float NOT NULL,
  PRIMARY KEY  ("id"),
  KEY "FK_Reference_10" ("profile"),
  KEY "FK_Reference_9" ("criterium"),
  CONSTRAINT "FK_Reference_10" FOREIGN KEY ("profile") REFERENCES "profile" ("id"),
  CONSTRAINT "FK_Reference_9" FOREIGN KEY ("criterium") REFERENCES "criterium" ("id")
);

-- ----------------------------
-- Table structure for schedule
-- ----------------------------
DROP TABLE IF EXISTS `schedule`;
CREATE TABLE "schedule" (
  "id" int(11) NOT NULL,
  PRIMARY KEY  ("id")
);

-- ----------------------------
-- Table structure for schedule_log
-- ----------------------------
DROP TABLE IF EXISTS `schedule_log`;
CREATE TABLE "schedule_log" (
  "id" int(11) NOT NULL,
  "time" datetime default NULL,
  PRIMARY KEY  ("id")
);

-- ----------------------------
-- Table structure for site
-- ----------------------------
DROP TABLE IF EXISTS `site`;
CREATE TABLE "site" (
  "id" int(11) NOT NULL auto_increment,
  "title" varchar(255) collate utf8_slovak_ci default NULL,
  "url" varbinary(255) default NULL,
  "created_by" int(11) default NULL,
  PRIMARY KEY  ("id")
);

-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE "user" (
  "id" int(11) NOT NULL,
  "username" varchar(127) collate utf8_slovak_ci NOT NULL,
  "password" varchar(127) collate utf8_slovak_ci NOT NULL,
  PRIMARY KEY  ("id")
);

-- ----------------------------
-- Records 
-- ----------------------------
INSERT INTO `category` VALUES ('1', 'Portály');
INSERT INTO `category` VALUES ('2', 'Banky');
INSERT INTO `criterium` VALUES ('1', 'Google PageRank', null);
INSERT INTO `criterium` VALUES ('2', 'Alexa Rank', null);
INSERT INTO `criterium` VALUES ('3', 'Validita', null);
INSERT INTO `criterium_value` VALUES ('1', '1', '1', '6', null);
INSERT INTO `criterium_value` VALUES ('2', '2', '1', '5', null);
INSERT INTO `criterium_value` VALUES ('3', '1', '2', '5', null);
INSERT INTO `criterium_value` VALUES ('5', '2', '1', '684', '2009-04-28 03:42:40');
INSERT INTO `criterium_value` VALUES ('8', '2', '2', '4076', '2009-04-28 03:49:21');
INSERT INTO `criterium_value` VALUES ('9', '2', '3', '1989', '2009-04-28 03:50:11');
INSERT INTO `profile` VALUES ('1', 'Štandard');
INSERT INTO `profile_criterium` VALUES ('1', '1', '1', '50');
INSERT INTO `profile_criterium` VALUES ('2', '2', '1', '30');
INSERT INTO `profile_criterium` VALUES ('3', '3', '1', '20');
INSERT INTO `site` VALUES ('1', 'Azet', 'http://azet.sk', '1');
INSERT INTO `site` VALUES ('2', 'Centrum', 'http://centrum.sk', '1');
INSERT INTO `site` VALUES ('3', 'Zoznam', 'http://zoznam.sk', '1');
INSERT INTO `site` VALUES ('4', 'VÚB', 'http://vub.sk', '1');
INSERT INTO `site` VALUES ('5', 'Tatra banka', 'http://tatrabanka.sk', '2');
INSERT INTO `user` VALUES ('1', 'admin', 'c8e95bc7a7998db67c8df3691b41d5769dea2dd0');
INSERT INTO `user` VALUES ('2', 'user', 'user');
