DROP DATABASE IF EXISTS counter ;
CREATE DATABASE counter ;
USE counter ;
CREATE TABLE counter (
id int(11) NOT NULL auto_increment PRIMARY KEY,
counter int(11) NOT NULL default '0',
host varchar(255) default NULL,
page longtext,
timestamp datetime default NULL
) TYPE=InnoDB ;
CREATE TABLE counterUser (
id int(11) NOT NULL auto_increment PRIMARY KEY,
counterId int(11) default NULL,
remoteAddr varchar(255) default NULL,
timestamp timestamp(14) NOT NULL,
repeat int(11) default '0',
KEY counterId (counterId, remoteAddr),
CONSTRAINT FOREIGN KEY (counterId) REFERENCES counter (id) ON DELETE CASCADE
) TYPE=InnoDB ;
GRANT SELECT, INSERT, UPDATE, DELETE ON counter TO counter@localhost ;
GRANT SELECT, INSERT, UPDATE, DELETE ON counterUser TO counter@localhost ;
|