File: postgresql-tables.sql

package info (click to toggle)
owl-dms 0.90-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 17,292 kB
  • ctags: 10,919
  • sloc: php: 48,457; sql: 3,603; sh: 363; perl: 204; makefile: 73
file content (611 lines) | stat: -rwxr-xr-x 24,978 bytes parent folder | download
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
CREATE TABLE active_sessions (
        sessid character varying(32),
        usid character varying(25),
        lastused bigint,
        ip character varying(16),
        currentdb integer,
        primary key (sessid)
);

CREATE TABLE membergroup (
        userid integer not null,
        groupid integer not null,
        groupadmin integer default NULL

);

CREATE TABLE favorites (
  userid integer NOT NULL default '0',
  folder_id integer NOT NULL default '1'
);

CREATE TABLE folders (
        id serial,
        name character varying(255) not null,
        parent integer not null,
        description text,
        security character varying(5) not null,
        groupid integer not null,
        creatorid integer not null,
 	password character varying(50) NOT NULL default '',
 	smodified timestamp without time zone ,
        primary key (id)
);

create UNIQUE INDEX folderid_index ON folders (id);

CREATE TABLE files (
        id serial,
        name character varying(80) not null,
        filename character varying(255) not null,
        f_size bigint not null,
        creatorid integer not null,
        parent integer not null,
        created timestamp not null,
        description text not null,
        metadata text not null,
        security integer not null,
        groupid integer not null,
        smodified timestamp not null,
        checked_out integer not null default 0,
        major_revision integer not null default 0,
        minor_revision integer not null default 1,
        url integer not null default 0,
        password character varying(50) NOT NULL default '',
  	doctype integer default 0,
  	updatorid integer default 1,
  	linkedto integer default 0,
  	approved integer default 0,
        primary key (id)

);
create UNIQUE INDEX fileid_index ON files (id);


CREATE TABLE comments (
        id serial,
        fid integer not null,
        userid integer,
        comment_date timestamp not null,
        comments text not null,
        primary key (id)
);

CREATE TABLE news (
        id serial,
        gid integer not null,
        news_title character varying(255) not null,
        news_date timestamp not null,
        news text not null,
        news_end_date timestamp not null,
        primary key (id)
);

CREATE TABLE users (
        id serial,
        groupid character varying(10) not null,
        username character varying(20) not null,
        name character varying(50) not null,
        password character varying(50) not null,
	quota_max bigint not null,
	quota_current bigint not null,
        email character varying(255),
        notify int,
	attachfile int,
	disabled int, 
	noprefaccess int,
	language character varying(15),
        maxsessions integer not null,	
        lastlogin timestamp not null,
        curlogin timestamp not null,
	lastnews integer ,
        newsadmin int not null,
	comment_notify integer,
        buttonstyle character varying(255),
	homedir integer,
	firstdir integer,
        email_tool integer,
        change_paswd_at_login integer,
        login_failed integer,
        passwd_last_changed timestamp without time zone,
        expire_account character varying(80),
        user_auth character(2),
        logintonewrec integer,
        groupadmin integer,
        user_offset character varying(4) default NULL,
        useradmin integer,
        viewlogs integer,
        viewreports integer,
        primary key (id)
);

INSERT INTO users VALUES (1,'0','admin','Administrator','21232f297a57a5a743894a0e4a801fc3',0,230648,'bozz',0,0,0,0,'English',0,'2005-11-14 06:18:50','2005-11-15 18:56:06',8,0,1,'rsdx_blue1',1,1,1,0,0,'2005-04-10 22:28:40','','',0,0,'',0, 0, 0);
INSERT INTO users VALUES (2,'1','guest','Anonymous','823f67f159b22b4c9a6a96999d1dea57',0,0,'',0,0,0,1,'English',19,'2004-11-10 05:02:42','2005-10-23 08:22:16',0,0,0,'rsdx_blue1',1,1,0,0,0,'2005-10-23 08:22:16','','0',0,0,'',0, 0, 0);

SELECT pg_catalog.setval ('users_id_seq', 3, true);

CREATE TABLE html (
        id serial,
        table_expand_width    character varying(15),
        table_collapse_width  character varying(15),
	body_background      character varying(255),
	owl_logo      character varying(255),
        body_textcolor        character varying(15),
        body_link             character varying(15),
        body_vlink            character varying(15)
);

INSERT INTO html VALUES (1,'90%','50%','','owl_logo1.gif','#000000','#000000','#000000');



CREATE TABLE prefs (
  id serial NOT NULL,
  email_from character varying(80) default NULL,
  email_fromname character varying(80) default NULL,
  email_replyto character varying(80) default NULL,
  email_server character varying(30) default NULL,
  email_subject character varying(60) default NULL,
  lookathd character varying(15) default NULL,
  lookathddel integer default NULL,
  def_file_security integer default NULL,
  def_file_group_owner integer default NULL,
  def_file_owner integer default NULL,
  def_file_title character varying(40) default NULL,
  def_file_meta character varying(40) default NULL,
  def_fold_security integer default NULL,
  def_fold_group_owner integer default NULL,
  def_fold_owner integer default NULL,
  max_filesize integer default NULL,
  tmpdir character varying(255) default NULL,
  timeout integer default NULL,
  expand integer default NULL,
  version_control integer default NULL,
  restrict_view integer default NULL,
  hide_backup integer default NULL,
  dbdump_path character varying(80) default NULL,
  gzip_path character varying(80) default NULL,
  tar_path character varying(80) default NULL,
  unzip_path character varying(80) default NULL,
  pod2html_path character varying(80) default NULL,
  pdftotext_path character varying(80) default NULL,
  wordtotext_path character varying(80) default NULL,
  file_perm integer default NULL,
  folder_perm integer default NULL,
  logging integer default NULL,
  log_file integer default NULL,
  log_login integer default NULL,
  log_rec_per_page integer default NULL,
  rec_per_page integer default NULL,
  self_reg integer default NULL,
  self_reg_quota integer default NULL,
  self_reg_notify integer default NULL,
  self_reg_attachfile integer default NULL,
  self_reg_disabled integer default NULL,
  self_reg_noprefacces integer default NULL,
  self_reg_maxsessions integer default NULL,
  self_reg_group integer default NULL,
  anon_ro integer default NULL,
  anon_user integer default NULL,
  file_admin_group integer default NULL,
  forgot_pass integer default NULL,
  collect_trash integer default NULL,
  trash_can_location character varying(80) default NULL,
  allow_popup integer default NULL,
  allow_custpopup integer default NULL,
  status_bar_location integer default NULL,
  remember_me integer default NULL,
  cookie_timeout integer default NULL,
  use_smtp integer default NULL,
  use_smtp_auth integer default NULL,
  smtp_passwd character varying(40) default NULL,
  search_bar integer default NULL,
  bulk_buttons integer default NULL,
  action_buttons integer default NULL,
  folder_tools integer default NULL,
pref_bar integer default NULL,
  smtp_auth_login character varying(50) default NULL,
  expand_disp_status integer default NULL,
  expand_disp_doc_num integer default NULL,
  expand_disp_doc_type integer default NULL,
  expand_disp_title integer default NULL,
  expand_disp_version integer default NULL,
  expand_disp_file integer default NULL,
  expand_disp_size integer default NULL,
  expand_disp_posted integer default NULL,
  expand_disp_updated integer default NULL,
  expand_disp_modified integer default NULL,
  expand_disp_action integer default NULL,
  expand_disp_held integer default NULL,
  collapse_disp_status integer default NULL,
  collapse_disp_doc_num integer default NULL,
  collapse_disp_doc_type integer default NULL,
  collapse_disp_title integer default NULL,
  collapse_disp_version integer default NULL,
  collapse_disp_file integer default NULL,
  collapse_disp_size integer default NULL,
  collapse_disp_posted integer default NULL,
  collapse_disp_updated integer default NULL,
  collapse_disp_modified integer default NULL,
  collapse_disp_action integer default NULL,
  collapse_disp_held integer default NULL,
  expand_search_disp_score integer default NULL,
  expand_search_disp_folder_path integer default NULL,
  expand_search_disp_doc_type integer default NULL,
  expand_search_disp_file integer default NULL,
  expand_search_disp_size integer default NULL,
  expand_search_disp_posted integer default NULL,
  expand_search_disp_updated integer default NULL,
  expand_search_disp_modified integer default NULL,
  expand_search_disp_action integer default NULL,
  collapse_search_disp_score integer default NULL,
  colps_search_disp_fld_path integer default NULL,
  collapse_search_disp_doc_type integer default NULL,
  collapse_search_disp_file integer default NULL,
  collapse_search_disp_size integer default NULL,
  collapse_search_disp_updated integer default NULL,
  collapse_search_disp_modified integer default NULL,
  collapse_search_disp_action integer default NULL,
  hide_folder_doc_count integer default NULL,
  old_action_icons integer default NULL,
  search_result_folders integer default NULL,
  restore_file_prefix character varying(50) default NULL,
  major_revision integer default NULL,
  minor_revision integer default NULL,
  doc_id_prefix character varying(10) default NULL,
  doc_id_num_digits integer default NULL,
  view_doc_in_new_window integer default NULL,
  admin_login_to_browse_page integer default NULL,
  save_keywords_to_db integer default NULL,
  self_reg_homedir integer default NULL,
  self_reg_firstdir integer default NULL,
  virus_path character varying(80) default NULL,
  peer_review integer default NULL,
  peer_opt integer default NULL,
  folder_size integer default NULL,
  download_folder_zip integer default NULL,
  display_password_override integer default NULL,
  thumb_disp_status integer default NULL,
  thumb_disp_doc_num integer default NULL,
  thumb_disp_image_info integer default NULL,
  thumb_disp_version integer default NULL,
  thumb_disp_size integer default NULL,
  thumb_disp_posted integer default NULL,
  thumb_disp_updated integer default NULL,
  thumb_disp_modified integer default NULL,
  thumb_disp_action integer default NULL,
  thumb_disp_held integer default NULL,
  thumbnails_tool_path character varying(255) default NULL,
  thumbnails_video_tool_path character varying(255) default NULL,
  thumbnails_video_tool_opt character varying(255) default NULL,
  thumbnails integer default NULL,
  thumbnails_small_width integer default NULL,
  thumbnails_med_width integer default NULL,
  thumbnails_large_width integer default NULL,
  thumbnail_view_columns integer default NULL,
  rtftotext_path character varying(250) default NULL,
  min_pass_length integer default NULL,
  min_username_length integer default NULL,
  min_pass_numeric integer default NULL,
  min_pass_special integer default NULL,
  enable_lock_account integer default NULL,
  lock_account_bad_password integer default NULL,
  track_user_passwords integer default NULL,
  change_password_every integer default NULL,
  folderdescreq integer default NULL,
  show_user_info integer default NULL,
  filedescreq integer default NULL,
  collapse_search_disp_doc_num integer default NULL,
  expand_search_disp_doc_num integer default NULL,
  colps_search_disp_doc_fields integer default NULL,
  expand_search_disp_doc_fields integer default NULL,
  collapse_disp_doc_fields integer default NULL,
  expand_disp_doc_fields integer default NULL,
  self_create_homedir  integer default NULL,
  self_captcha  integer default NULL,
  info_panel_wide integer default NULL,
  track_favorites  integer default NULL,
    primary key (id)
);

INSERT INTO prefs VALUES (1,'owl@yourdomain.com','OWL','owl@yourdomain.com','localhost','[OWL] : AUTOMATED MAIL','false',1,0,0,1,'<font color=red>No Info</font>','not in',0,0,1,151200000,'/tmp',9000,1,1,0,1,'/usr/bin/mysqldump','/usr/bin/gzip','//bin/tar','/usr/bin/unzip','','/usr/bin/pdftotext','/usr/local/bin/antiword',0,0,0,1,1,25,0,0,0,0,0,0,0,0,1,0,2,2,0,0,'',1,1,1,0,30,0,0,'',1,1,1,1,1,'',1,0,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,0,1,'',1,0,'ABC',3,0,1,1,1,1,'',1,1,1,1,0,1,1,1,1,1,1,1,1,1,'/usr/bin/convert','/usr/local/bin/mplayer',' -vo png -ss 0:05 -frames 2 -nosound -really-quiet',1,25,50,100,4,'/usr/local/bin/unrtf',8,2,0,0,0,4,10,100,0,0,0,1,0,0,1,0,0,0,0,1,1,0,0,0,0,0);


CREATE TABLE monitored_file (
        id serial,
        userid integer not null,
        fid integer not null,
        primary key (id)
);

CREATE TABLE monitored_folder (
        id serial,
        userid integer not null,
        fid integer not null,
        primary key (id)
);




CREATE TABLE groups (
        id serial,
        name character varying(30) not null,
        primary key (id)
);

CREATE TABLE filedata (
        id serial,
        compressed integer not null default 0,
        data bytea ,
        primary key (id)
);

CREATE TABLE owl_log (
        id serial,
        userid integer,
        filename character varying(255),
        parent integer,
        action character varying(40), 
        details text,
        ip character varying(16),
        agent character varying(255),
        logdate timestamp not null,
        type character varying(20),
        primary key (id)
);

create table wordidx (
        wordid integer,
        word character varying(128) not null
);

create UNIQUE INDEX word_index ON wordidx (word);

create table searchidx (
        wordid integer,
        owlfileid integer
);

create INDEX search_fileid ON searchidx (owlfileid);

CREATE TABLE mimes (
        filetype character varying(10) not null primary key,
        mimetype character varying(50) not null
);

INSERT INTO folders (name,parent,security,groupid,creatorid,description, smodified, password) VALUES ('Documents', 0, 51, 0, 0, '', '2004-10-17 08:11:50', '');

INSERT INTO groups (name) VALUES ('Administrators');
INSERT INTO groups (name) VALUES ('Anonymous');
INSERT INTO groups (name) VALUES ('File Admin');


UPDATE GROUPS SET id = 0 WHERE name = 'Administrators';
UPDATE GROUPS SET id = 1 WHERE name = 'Anonymous';
UPDATE GROUPS SET id = 2 WHERE name = 'File Admin';


INSERT INTO mimes VALUES ('ai', 'application/postscript');
INSERT INTO mimes VALUES ('aif', 'audio/x-aiff');
INSERT INTO mimes VALUES ('aifc', 'audio/x-aiff');
INSERT INTO mimes VALUES ('aiff', 'audio/x-aiff');
INSERT INTO mimes VALUES ('asc', 'text/plain');
INSERT INTO mimes VALUES ('au', 'audio/basic');
INSERT INTO mimes VALUES ('avi', 'video/x-msvideo');
INSERT INTO mimes VALUES ('bcpio', 'application/x-bcpio');
INSERT INTO mimes VALUES ('bin', 'application/octet-stream');
INSERT INTO mimes VALUES ('bmp', 'image/bmp');
INSERT INTO mimes VALUES ('cdf', 'application/x-netcdf');
INSERT INTO mimes VALUES ('class', 'application/octet-stream');
INSERT INTO mimes VALUES ('cpio', 'application/x-cpio');
INSERT INTO mimes VALUES ('cpt', 'application/mac-compactpro');
INSERT INTO mimes VALUES ('csh', 'application/x-csh');
INSERT INTO mimes VALUES ('css', 'text/css');
INSERT INTO mimes VALUES ('dcr', 'application/x-director');
INSERT INTO mimes VALUES ('dir', 'application/x-director');
INSERT INTO mimes VALUES ('dms', 'application/octet-stream');
INSERT INTO mimes VALUES ('doc', 'application/msword');
INSERT INTO mimes VALUES ('dvi', 'application/x-dvi');
INSERT INTO mimes VALUES ('dxr', 'application/x-director');
INSERT INTO mimes VALUES ('eps', 'application/postscript');
INSERT INTO mimes VALUES ('etx', 'text/x-setext');
INSERT INTO mimes VALUES ('exe', 'application/octet-stream');
INSERT INTO mimes VALUES ('ez', 'application/andrew-inset');
INSERT INTO mimes VALUES ('gif', 'image/gif');
INSERT INTO mimes VALUES ('gtar', 'application/x-gtar');
INSERT INTO mimes VALUES ('hdf', 'application/x-hdf');
INSERT INTO mimes VALUES ('hqx', 'application/mac-binhex40');
INSERT INTO mimes VALUES ('htm', 'text/html');
INSERT INTO mimes VALUES ('html', 'text/html');
INSERT INTO mimes VALUES ('ice', 'x-conference/x-cooltalk');
INSERT INTO mimes VALUES ('ief', 'image/ief');
INSERT INTO mimes VALUES ('iges', 'model/iges');
INSERT INTO mimes VALUES ('igs', 'model/iges');
INSERT INTO mimes VALUES ('jpe', 'image/jpeg');
INSERT INTO mimes VALUES ('jpeg', 'image/jpeg');
INSERT INTO mimes VALUES ('jpg', 'image/jpeg');
INSERT INTO mimes VALUES ('js', 'application/x-javascript');
INSERT INTO mimes VALUES ('kar', 'audio/midi');
INSERT INTO mimes VALUES ('latex', 'application/x-latex');
INSERT INTO mimes VALUES ('lha', 'application/octet-stream');
INSERT INTO mimes VALUES ('lzh', 'application/octet-stream');
INSERT INTO mimes VALUES ('man', 'application/x-troff-man');
INSERT INTO mimes VALUES ('me', 'application/x-troff-me');
INSERT INTO mimes VALUES ('mesh', 'model/mesh');
INSERT INTO mimes VALUES ('mid', 'audio/midi');
INSERT INTO mimes VALUES ('midi', 'audio/midi');
INSERT INTO mimes VALUES ('mif', 'application/vnd.mif');
INSERT INTO mimes VALUES ('mov', 'video/quicktime');
INSERT INTO mimes VALUES ('movie', 'video/x-sgi-movie');
INSERT INTO mimes VALUES ('mp2', 'audio/mpeg');
INSERT INTO mimes VALUES ('mp3', 'audio/mpeg');
INSERT INTO mimes VALUES ('mpe', 'video/mpeg');
INSERT INTO mimes VALUES ('mpeg', 'video/mpeg');
INSERT INTO mimes VALUES ('mpg', 'video/mpeg');
INSERT INTO mimes VALUES ('mpga', 'audio/mpeg');
INSERT INTO mimes VALUES ('ms', 'application/x-troff-ms');
INSERT INTO mimes VALUES ('msh', 'model/mesh');
INSERT INTO mimes VALUES ('nc', 'application/x-netcdf');
INSERT INTO mimes VALUES ('oda', 'application/oda');
INSERT INTO mimes VALUES ('pbm', 'image/x-portable-bitmap');
INSERT INTO mimes VALUES ('pdb', 'chemical/x-pdb');
INSERT INTO mimes VALUES ('pdf', 'application/pdf');
INSERT INTO mimes VALUES ('pgm', 'image/x-portable-graymap');
INSERT INTO mimes VALUES ('pgn', 'application/x-chess-pgn');
INSERT INTO mimes VALUES ('png', 'image/png');
INSERT INTO mimes VALUES ('pnm', 'image/x-portable-anymap');
INSERT INTO mimes VALUES ('ppm', 'image/x-portable-pixmap');
INSERT INTO mimes VALUES ('ppt', 'application/vnd.ms-powerpoint');
INSERT INTO mimes VALUES ('ps', 'application/postscript');
INSERT INTO mimes VALUES ('qt', 'video/quicktime');
INSERT INTO mimes VALUES ('ra', 'audio/x-realaudio');
INSERT INTO mimes VALUES ('ram', 'audio/x-pn-realaudio');
INSERT INTO mimes VALUES ('ras', 'image/x-cmu-raster');
INSERT INTO mimes VALUES ('rgb', 'image/x-rgb');
INSERT INTO mimes VALUES ('rm', 'audio/x-pn-realaudio');
INSERT INTO mimes VALUES ('roff', 'application/x-troff');
INSERT INTO mimes VALUES ('rpm', 'audio/x-pn-realaudio-plugin');
INSERT INTO mimes VALUES ('rtf', 'text/rtf');
INSERT INTO mimes VALUES ('rtx', 'text/richtext');
INSERT INTO mimes VALUES ('sgm', 'text/sgml');
INSERT INTO mimes VALUES ('sgml', 'text/sgml');
INSERT INTO mimes VALUES ('sh', 'application/x-sh');
INSERT INTO mimes VALUES ('shar', 'application/x-shar');
INSERT INTO mimes VALUES ('silo', 'model/mesh');
INSERT INTO mimes VALUES ('sit', 'application/x-stuffit');
INSERT INTO mimes VALUES ('skd', 'application/x-koan');
INSERT INTO mimes VALUES ('skm', 'application/x-koan');
INSERT INTO mimes VALUES ('skp', 'application/x-koan');
INSERT INTO mimes VALUES ('skt', 'application/x-koan');
INSERT INTO mimes VALUES ('smi', 'application/smil');
INSERT INTO mimes VALUES ('smil', 'application/smil');
INSERT INTO mimes VALUES ('snd', 'audio/basic');
INSERT INTO mimes VALUES ('spl', 'application/x-futuresplash');
INSERT INTO mimes VALUES ('src', 'application/x-wais-source');
INSERT INTO mimes VALUES ('sv4cpio', 'application/x-sv4cpio');
INSERT INTO mimes VALUES ('sv4crc', 'application/x-sv4crc');
INSERT INTO mimes VALUES ('swf', 'application/x-shockwave-flash');
INSERT INTO mimes VALUES ('t', 'application/x-troff');
INSERT INTO mimes VALUES ('tar', 'application/x-tar');
INSERT INTO mimes VALUES ('tcl', 'application/x-tcl');
INSERT INTO mimes VALUES ('tex', 'application/x-tex');
INSERT INTO mimes VALUES ('texi', 'application/x-texinfo');
INSERT INTO mimes VALUES ('texinfo', 'application/x-texinfo');
INSERT INTO mimes VALUES ('tif', 'image/tiff');
INSERT INTO mimes VALUES ('tiff', 'image/tiff');
INSERT INTO mimes VALUES ('tr', 'application/x-troff');
INSERT INTO mimes VALUES ('tsv', 'text/tab-separated-values');
INSERT INTO mimes VALUES ('txt', 'text/plain');
INSERT INTO mimes VALUES ('ustar', 'application/x-ustar');
INSERT INTO mimes VALUES ('vcd', 'application/x-cdlink');
INSERT INTO mimes VALUES ('vrml', 'model/vrml');
INSERT INTO mimes VALUES ('wav', 'audio/x-wav');
INSERT INTO mimes VALUES ('wrl', 'model/vrml');
INSERT INTO mimes VALUES ('xbm', 'image/x-xbitmap');
INSERT INTO mimes VALUES ('xls', 'application/vnd.ms-excel');
INSERT INTO mimes VALUES ('xml', 'text/xml');
INSERT INTO mimes VALUES ('xpm', 'image/x-xpixmap');
INSERT INTO mimes VALUES ('xwd', 'image/x-xwindowdump');
INSERT INTO mimes VALUES ('xyz', 'chemical/x-pdb');
INSERT INTO mimes VALUES ('zip', 'application/zip');
INSERT INTO mimes VALUES ('gz', 'application/x-gzip');
INSERT INTO mimes VALUES ('tgz', 'application/x-gzip');
INSERT INTO mimes VALUES ('sxw','application/vnd.sun.xml.writer');
INSERT INTO mimes VALUES ('stw','application/vnd.sun.xml.writer.template');
INSERT INTO mimes VALUES ('sxg','application/vnd.sun.xml.writer.global');
INSERT INTO mimes VALUES ('sxc','application/vnd.sun.xml.calc');
INSERT INTO mimes VALUES ('stc','application/vnd.sun.xml.calc.template');
INSERT INTO mimes VALUES ('sxi','application/vnd.sun.xml.impress');
INSERT INTO mimes VALUES ('sti','application/vnd.sun.xml.impress.template');
INSERT INTO mimes VALUES ('sxd','application/vnd.sun.xml.draw');
INSERT INTO mimes VALUES ('std','application/vnd.sun.xml.draw.template');
INSERT INTO mimes VALUES ('sxm','application/vnd.sun.xml.math');
INSERT INTO mimes VALUES ('wpd','application/wordperfect');



create INDEX parentid_index ON files (parent);
                                                                                                                                                                     
CREATE TABLE docfieldslabel (
  doc_field_id integer NOT NULL default '0',
  field_label character varying(80) NOT NULL default '',
  locale character varying(80) NOT NULL default ''
);

CREATE TABLE doctype (
        doc_type_id serial,
        doc_type_name character varying(255) not null,
        primary key (doc_type_id)
);
                                                                                                                                                                     
INSERT INTO doctype (doc_type_name) values ('Default');
                                                                                                                                                                     
CREATE TABLE docfields (
        id serial,
        doc_type_id integer not null ,
        field_name character varying(80) not null,
        field_position integer not null,
        field_type character varying(80) not null,
        field_values character varying(80) not null,
        field_size integer not null,
        searchable integer not null,
        show_desc integer not null,
        required integer not null,
  	show_in_list integer default NULL,
        primary key (id)
);

CREATE TABLE docfieldvalues (
        id serial,
        file_id integer not null ,
        field_name character varying(80) not null,
        field_value character varying(80) not null,
        primary key (id)
);
                                                                                                                                                                     
CREATE TABLE peerreview (
        reviewer_id integer,
        file_id integer,
        status integer
);

CREATE TABLE metakeywords (
        keyword_id serial,
        keyword_text char(255) not null,
        primary key (keyword_id)
);

CREATE TABLE trackoldpasswd (
    id serial NOT NULL,
    userid integer,
    "password" character varying(50) DEFAULT '' NOT NULL,
        primary key (id)
);

CREATE TABLE advanced_acl (
    group_id integer,
    user_id integer,
    file_id integer,
    folder_id integer,
    owlread integer DEFAULT '0',
    owlwrite integer DEFAULT '0',
    owlviewlog integer DEFAULT '0',
    owldelete integer DEFAULT '0',
    owlcopy integer DEFAULT '0',
    owlmove integer DEFAULT '0',
    owlproperties integer DEFAULT '0',
    owlupdate integer DEFAULT '0',
    owlcomment integer DEFAULT '0',
    owlcheckin integer DEFAULT '0',
    owlemail integer DEFAULT '0',
    owlrelsearch integer DEFAULT '0',
    owlsetacl integer DEFAULT '0',
    owlmonitor integer DEFAULT '0'
);

create index acl_groupid_index on advanced_acl (group_id);
create index acl_userid_index on advanced_acl (user_id);
create index acl_fileid_index on advanced_acl (file_id);
create index acl_folderid_index on advanced_acl (folder_id);