2016-12-10 13:16:05 +00:00
|
|
|
CREATE TABLE pageviews(
|
2016-12-08 21:20:40 +00:00
|
|
|
`id` INTEGER UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
`page_id` INTEGER UNSIGNED NOT NULL,
|
2016-12-10 13:16:05 +00:00
|
|
|
`visitor_id` INTEGER UNSIGNED NOT NULL,
|
2016-12-08 21:20:40 +00:00
|
|
|
`referrer_keyword` TEXT NULL,
|
|
|
|
`referrer_url` TEXT NULL,
|
2016-12-10 13:16:05 +00:00
|
|
|
`timestamp` TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE visitors(
|
|
|
|
`id` INTEGER UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
`visitor_key` VARCHAR(255) NOT NULL,
|
|
|
|
`ip_address` VARCHAR(100) NOT NULL,
|
|
|
|
`device_os` VARCHAR(31) NULL,
|
2016-12-08 21:20:40 +00:00
|
|
|
`browser_name` VARCHAR(31) NULL,
|
|
|
|
`browser_version` VARCHAR(31) NULL,
|
|
|
|
`browser_language` VARCHAR(31) NULL,
|
|
|
|
`screen_resolution` VARCHAR(9) NULL,
|
2016-12-10 13:16:05 +00:00
|
|
|
`country` CHAR(3) NULL
|
2016-12-08 21:20:40 +00:00
|
|
|
);
|
|
|
|
|
2016-12-10 15:07:03 +00:00
|
|
|
ALTER TABLE visitors ADD UNIQUE(`visitor_key`);
|
|
|
|
|
2016-12-08 21:20:40 +00:00
|
|
|
CREATE TABLE pages(
|
|
|
|
`id` INTEGER UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL,
|
2016-12-10 13:16:05 +00:00
|
|
|
`hostname` VARCHAR(63) NOT NULL,
|
2016-12-08 21:20:40 +00:00
|
|
|
`path` VARCHAR(255) NOT NULL,
|
|
|
|
`title` VARCHAR(255) NULL
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE users (
|
|
|
|
`id` INTEGER UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL,
|
|
|
|
`email` VARCHAR(255) NOT NULL,
|
|
|
|
`password` VARCHAR(255) NOT NULL
|
|
|
|
);
|