source: trunk/tools/database/CreateTables.sql@ 3904

Last change on this file since 3904 was 3900, checked in by bird, 25 years ago

Added code tabel for function and dll type codes.

File size: 6.6 KB
Line 
1-- $Id: CreateTables.sql,v 1.13 2000-07-29 21:19:34 bird Exp $
2--
3-- Create all tables.
4--
5
6CREATE DATABASE Odin32;
7
8USE Odin32;
9
10
11--
12-- Manually create author table.
13--
14CREATE TABLE author (
15 refcode SMALLINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
16 name VARCHAR(64) NOT NULL,
17 initials CHAR(4) NOT NULL,
18 alias VARCHAR(32),
19 email VARCHAR(64),
20 country VARCHAR(64),
21 location VARCHAR(64),
22 description TEXT,
23 UNIQUE u1(refcode),
24 UNIQUE u2(name),
25 UNIQUE u3(initials)
26-- ,UNIQUE i4(alias), UNIQUE columns have to be defined NOT NULL in mySql.
27-- UNIQUE i5(email) UNIQUE columns have to be defined NOT NULL in mySql.
28);
29
30
31
32--
33-- Support table for Codes
34--
35CREATE TABLE code (
36 codegroup CHAR(4) NOT NULL,
37 code CHAR(4) NOT NULL,
38 description VARCHAR(128) NOT NULL,
39 UNIQUE u1(codegroup, code)
40);
41
42
43--
44--
45-- Documentation
46--
47--
48
49--
50-- This table holds the known states.
51--
52CREATE TABLE state (
53 refcode TINYINT NOT NULL PRIMARY KEY,
54 color CHAR(7) NOT NULL,
55 weight TINYINT NOT NULL,
56 name VARCHAR(32) NOT NULL,
57 description VARCHAR(128) NOT NULL,
58 UNIQUE u1(refcode),
59 UNIQUE u2(name),
60 UNIQUE u3(color)
61);
62
63
64--
65-- This table holds the dll names.
66-- Type has these known types:
67-- 'A' for Odin32 API dll
68-- 'I' for Internal Odin32 (API) dll
69-- 'S' for support stuff (ie. pe.exe and win32k.sys).
70-- 'T' for tools (executables and dlls)
71--
72CREATE TABLE dll (
73 refcode TINYINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
74 name VARCHAR(32) NOT NULL,
75 type CHAR NOT NULL DEFAULT 'A',
76 description VARCHAR(255),
77 UNIQUE u1(refcode),
78 UNIQUE u2(name)
79);
80
81
82--
83-- This table holds fileinformation (per dll).
84--
85CREATE TABLE file (
86 refcode INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
87 dll TINYINT NOT NULL,
88 name VARCHAR(128) NOT NULL,
89 lastdatetime DATETIME NOT NULL,
90 lastauthor SMALLINT NOT NULL,
91 revision CHAR(10) NOT NULL,
92 updated TINYINT NOT NULL DEFAULT 0,
93 description TEXT,
94 UNIQUE u1(refcode),
95 UNIQUE u2(dll, name),
96 INDEX i1(name)
97);
98
99
100--
101-- This table holds design notes (per dll).
102--
103CREATE TABLE designnote (
104 refcode INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
105 dll TINYINT NOT NULL,
106 file INTEGER NOT NULL,
107 seqnbrfile SMALLINT NOT NULL,
108 seqnbr INTEGER NOT NULL,
109 title TEXT,
110 note TEXT NOT NULL,
111 UNIQUE u1(refcode),
112 INDEX u2(file, seqnbrfile, seqnbr, dll)
113);
114
115
116--
117-- This table holds API information (per dll / file).
118--
119-- Type has these known values:
120-- 'A' for API
121-- 'I' for Internal Odin32 API
122--
123CREATE TABLE function (
124 refcode INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
125 dll TINYINT NOT NULL,
126 aliasfn INTEGER NOT NULL DEFAULT -1,
127 file INTEGER NOT NULL DEFAULT -1,
128 name VARCHAR(100) NOT NULL,
129 intname VARCHAR(100) NOT NULL,
130 state TINYINT NOT NULL DEFAULT 0,
131 ordinal INTEGER NOT NULL,
132 apigroup SMALLINT,
133 return VARCHAR(64),
134 type CHAR NOT NULL DEFAULT 'A',
135 updated TINYINT NOT NULL DEFAULT 0,
136 description TEXT,
137 remark TEXT,
138 returndesc TEXT,
139 sketch TEXT,
140 equiv TEXT,
141 time TEXT,
142 UNIQUE i1(refcode, aliasfn),
143 UNIQUE i1a(dll, aliasfn, refcode),
144 UNIQUE i1b(aliasfn, name, dll),
145 UNIQUE i1c(aliasfn, intname, dll, refcode),
146 UNIQUE i2(name, dll, refcode),
147 UNIQUE i3(intname, dll, refcode),
148 INDEX i4(dll, file),
149 INDEX i5(file),
150 INDEX i6(state),
151 UNIQUE u1(refcode),
152 UNIQUE u2(name, dll),
153 UNIQUE u3(type, refcode)
154);
155
156
157--
158-- This table holds parameters for APIs.
159--
160CREATE TABLE parameter (
161 function INTEGER NOT NULL,
162 sequencenbr TINYINT NOT NULL,
163 name VARCHAR(64) NOT NULL,
164 type VARCHAR(64) NOT NULL,
165 description TEXT,
166 INDEX i1(function, name),
167 UNIQUE u1(function, name)
168);
169
170
171--
172-- Many to many relation between functions and authors.
173--
174CREATE TABLE fnauthor (
175 author SMALLINT NOT NULL,
176 function INTEGER NOT NULL,
177 UNIQUE u1(function, author)
178);
179
180
181--
182-- Manually created Groups of APIs
183--
184CREATE TABLE apigroup (
185 refcode SMALLINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
186 dll TINYINT NOT NULL,
187 name VARCHAR(64) NOT NULL,
188 description VARCHAR(128),
189 UNIQUE u1(refcode),
190 UNIQUE u2(name)
191);
192
193
194
195--
196--
197-- History information
198--
199--
200
201--
202-- Status history for dlls.
203--
204CREATE TABLE historydll (
205 dll TINYINT NOT NULL,
206 state SMALLINT NOT NULL,
207 date DATE NOT NULL,
208 count SMALLINT NOT NULL,
209 UNIQUE u1(dll, state, date)
210);
211
212
213--
214-- Status history for API groups.
215--
216CREATE TABLE historyapigroup (
217 apigroup SMALLINT NOT NULL,
218 state SMALLINT NOT NULL,
219 date DATE NOT NULL,
220 count SMALLINT NOT NULL,
221 UNIQUE u1(apigroup, state, date)
222);
223
224
225--
226-- Dll API count history.
227--
228CREATE TABLE historydlltotal (
229 dll SMALLINT NOT NULL,
230 date DATE NOT NULL,
231 totalcount SMALLINT NOT NULL,
232 UNIQUE u1(dll, DATE)
233);
234
235
236--
237-- API Group API count history.
238--
239CREATE TABLE historyapigrouptotal (
240 apigroup SMALLINT NOT NULL,
241 date DATE NOT NULL,
242 totalcount SMALLINT NOT NULL,
243 UNIQUE u1(apigroup, date)
244);
245
246
247
248--
249--
250-- Administration
251--
252--
253
254--
255-- This table holds the teams (like MAD, WAI,...).
256--
257CREATE TABLE team (
258 refcode SMALLINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
259 name VARCHAR(30) NOT NULL,
260 longname VARCHAR(128) NOT NULL,
261 description TEXT NOT NULL,
262 tasks TEXT,
263 notes TEXT,
264 UNIQUE u1(refcode),
265 UNIQUE u2(name)
266);
267
268
269--
270-- This table holds the groups under each team.
271-- Currently only the WAI team is grouped.
272--
273CREATE TABLE tgroup (
274 refcode SMALLINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
275 team SMALLINT NOT NULL,
276 name VARCHAR(80) NOT NULL,
277 description TEXT NOT NULL,
278 notes TEXT,
279 UNIQUE u1(refcode),
280 UNIQUE u2(team, refcode)
281);
282
283
284--
285-- This table relates a tgroup with authors
286-- ( do a distinct select to get all members of a team )
287--
288CREATE TABLE tgroupmember (
289 tgroup SMALLINT NOT NULL,
290 author SMALLINT NOT NULL,
291 codemaintainer CHAR(1) DEFAULT 'N',
292 UNIQUE u1(tgroup, author)
293);
294
295
296--
297-- This table relates a tgroup with a dll.
298--
299CREATE TABLE tgroupdll (
300 tgroup SMALLINT NOT NULL,
301 dll TINYINT NOT NULL,
302 UNIQUE u1(tgroup, dll)
303);
304
305
306--
307-- This table relates a tgroup with an apigroup.
308--
309CREATE TABLE tgroupapigroup (
310 tgroup SMALLINT NOT NULL,
311 apigroup SMALLINT NOT NULL,
312 UNIQUE u1(tgroup, apigroup)
313);
314
315
316
Note: See TracBrowser for help on using the repository browser.