/*
MySQL Data Transfer
Source Host: localhost
Source Database: aaa
Target Host: localhost
Target Database: aaa
Date: 21.5.2009 8:43:18
*/

SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for category
-- ----------------------------
DROP TABLE IF EXISTS `category`;
CREATE TABLE "category" (
  "id" int(11) NOT NULL auto_increment,
  "name" text character set utf8 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 auto_increment,
  "text" text character set utf8 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 character set utf8 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 auto_increment,
  "name" text character set utf8 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 auto_increment,
  "criterium" int(11) default NULL,
  "site" int(11) default 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) character set utf8 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) character set utf8 collate utf8_slovak_ci NOT NULL,
  "password" varchar(127) character set utf8 collate utf8_slovak_ci NOT NULL,
  PRIMARY KEY  ("id")
);

-- ----------------------------
-- Records 
-- ----------------------------
INSERT INTO `criterium` VALUES ('1', 'Google PageRank', '12:00:00');
INSERT INTO `criterium` VALUES ('2', 'Alexa Rank', '18:00:00');
INSERT INTO `criterium` VALUES ('3', 'Validita', '06:00:00');
INSERT INTO `user` VALUES ('1', 'admin', 'c8e95bc7a7998db67c8df3691b41d5769dea2dd0');

