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

Last change on this file since 10027 was 6678, checked in by bird, 24 years ago

reverse prev rev.

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