-
Notifications
You must be signed in to change notification settings - Fork 2
/
ninuxuu0.sql
32 lines (25 loc) · 1.05 KB
/
ninuxuu0.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
-- MySQL DB Schema
-- drop database ninuxuu;
CREATE database ninuxuu;
USE ninuxuu;
CREATE TABLE IF NOT EXISTS `resources` (
`uri` varchar(700) NOT NULL,
`server` varchar(50) NOT NULL,
`share` varchar(50) NOT NULL,
`path` varchar(650),
`protocol` varchar(10),
`filetype` varchar(20),
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`firstseen` timestamp NOT NULL DEFAULT 0,
PRIMARY KEY (`uri`)
) ENGINE=InnoDB DEFAULT CHARSET=ascii;
CREATE TABLE IF NOT EXISTS `tags` (
`uri` varchar(700) NOT NULL,
`tag` varchar(50) NOT NULL,
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`uri`,`tag`)
) ENGINE=InnoDB DEFAULT CHARSET=ascii;
-- CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW `tagstats` AS SELECT SQL_CACHE tag, count(tag) AS tagcount FROM tags WHERE tags.timestamp+0 >= (NOW()+0 - 31536000) GROUP BY tag;
CREATE INDEX tagnameindex ON tags (tag);
CREATE USER 'ninuu'@'localhost' IDENTIFIED BY 'ciaociao';
GRANT ALL PRIVILEGES ON ninuxuu.* TO 'ninuu'@'localhost';