]> mj.ucw.cz Git - pciids.git/blob - tables
Help update
[pciids.git] / tables
1 @users
2 #Each row represents a registered user, with privileges or without
3 id INT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE PRIMARY KEY,#Internal ID
4 email VARCHAR(255) <<CHARSET>> UNIQUE NOT NULL,#His email for notifications
5 xmpp TEXT <<CHARSET>>,#His XMPP address for notifications
6 login VARCHAR(50) <<CHARSET>> UNIQUE,#Login name
7 passwd VARCHAR(22) <<CHARSET>> NOT NULL,#Password hash
8 lastlog TEXT <<CHARSET>>,#Where did he logged in last time?
9 logtime TIMESTAMP,#When did he log in last time?
10 mailgather INT UNSIGNED NOT NULL DEFAULT 240,#How long to gather mail notifications before sending?
11 xmppgather INT UNSIGNED NOT NULL DEFAULT 15,#How long to gather xmpp notifications before sending?
12 nextmail TIMESTAMP,#When do we send pending email notifications next time?
13 nextxmpp TIMESTAMP#When do we send pending xmpp notifications?
14
15 @locations
16 #The locations are saved in a tree. ID of the location is created by
17 #appending the local IDs of the nodes on the path together (children of
18 #the root first), separated by '/'. Each node must know, how long are
19 #the local IDs of its children.
20 #
21 #(Note that the local IDs can contain '/', since it can be recognized
22 #by its length.)
23 #
24 #The first part is 2-letter specifier of information type. The first
25 #version has these:
26 #PC: PCI ID
27 #PD: PCI Device Class
28 #
29 id VARCHAR(50) <<CHARSET>> NOT NULL UNIQUE PRIMARY KEY,#The name of the location, must be just node, no / at the end
30 parent VARCHAR(50) <<CHARSET>>,#To allow selecting of all node's children
31 mainhistory INT UNSIGNED,#Reference for the main history
32 name TINYTEXT <<CHARSET>>,#Should match the one of main history, if any (if no main history, name can be set too)
33 note TEXT <<CHARSET>>,#Should match the one of main history (if no main history, can be set too)
34 CONSTRAINT parent_ref FOREIGN KEY (parent) REFERENCES locations(id) ON DELETE CASCADE
35
36 @rights
37 #Which privileges the users have?
38 #It contains only the users with some extra privileges, not the normal ones
39 userId INT UNSIGNED NOT NULL,#Who has the privilege
40 rightId INT UNSIGNED NOT NULL,#What privilege
41 CONSTRAINT right_user FOREIGN KEY (userId) REFERENCES users(id) ON DELETE CASCADE,
42 PRIMARY KEY (userId, rightId)
43
44 @history
45 #Contains the discussion and history of items
46 id INT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE PRIMARY KEY,
47 owner INT UNSIGNED,#Who posted it?
48 location VARCHAR(50) <<CHARSET>> NOT NULL,#Where it belongs
49 discussion TEXT <<CHARSET>>,
50 time TIMESTAMP NOT NULL DEFAULT NOW(),#When this was added
51 nodename TINYTEXT <<CHARSET>>,#Modification of the location name
52 nodenote TEXT <<CHARSET>>,#Modification of the location note
53 seen BOOLEAN NOT NULL DEFAULT '0', #Did some admin see this, or is it still unseen?
54 CONSTRAINT history_location FOREIGN KEY (location) REFERENCES locations(id) ON DELETE CASCADE,
55 CONSTRAINT history_owner FOREIGN KEY (owner) REFERENCES users(id) ON DELETE SET NULL
56
57 @notifications
58 #Contains hooks for notifications
59 user INT UNSIGNED NOT NULL,#Who wants it
60 location VARCHAR(50) <<CHARSET>> NOT NULL,#Where
61 recursive BOOLEAN NOT NULL DEFAULT '0',
62 type SMALLINT NOT NULL,#When to send
63 #0: History -- When a new discussion is posted
64 #1: Description -- Name or note changed
65 #2: MainHistory -- The main history changed
66 #All contains the less common events
67 notification SMALLINT NOT NULL,
68 #0: mail only
69 #1: xmpp only
70 #2: both
71 CONSTRAINT notification_location FOREIGN KEY (location) REFERENCES locations(id) ON DELETE CASCADE,
72 CONSTRAINT notification_user FOREIGN KEY (user) REFERENCES users(id) ON DELETE CASCADE,
73 PRIMARY KEY (user, location)
74
75 @pending
76 #Contains the pending notifications
77 user INT UNSIGNED NOT NULL,
78 history INT UNSIGNED NOT NULL,
79 notification SMALLINT NOT NULL,
80 #0: mail
81 #1: xmpp
82 #If a notification generates both, it splits to 2 of them
83 reason SMALLINT NOT NULL,
84 #0: New item
85 #1: New history
86 #2: Changed main article
87 CONSTRAINT pending_history FOREIGN KEY (history) REFERENCES history(id) ON DELETE CASCADE,
88 CONSTRAINT pending_user FOREIGN KEY (user) REFERENCES users(id) ON DELETE CASCADE