db_structure.xml 21.8 KB
Newer Older
1
<?xml version="1.0" encoding="utf-8" ?>
2
3
<database>

Robin Appelman's avatar
Robin Appelman committed
4
5
6
7
8
9
10
11
	<name>*dbname*</name>
	<create>true</create>
	<overwrite>false</overwrite>

	<charset>utf8</charset>

	<table>

12
13
		<!--
		Namespaced Key-Value Store for Application Configuration.
Andreas Fischer's avatar
Andreas Fischer committed
14
15
		 - Keys are namespaced per appid.
		 - E.g. (core, global_cache_gc_lastrun) -> 1385463286
16
		-->
Robin Appelman's avatar
Robin Appelman committed
17
18
19
20
21
22
23
24
25
		<name>*dbprefix*appconfig</name>

		<declaration>

			<field>
				<name>appid</name>
				<type>text</type>
				<default></default>
				<notnull>true</notnull>
26
				<length>32</length>
Robin Appelman's avatar
Robin Appelman committed
27
28
29
30
31
32
33
			</field>

			<field>
				<name>configkey</name>
				<type>text</type>
				<default></default>
				<notnull>true</notnull>
34
				<length>64</length>
Robin Appelman's avatar
Robin Appelman committed
35
36
37
38
39
			</field>

			<field>
				<name>configvalue</name>
				<type>clob</type>
40
				<notnull>false</notnull>
Robin Appelman's avatar
Robin Appelman committed
41
42
			</field>

43
44
			<index>
				<name>appconfig_appid_key_index</name>
Thomas Tanghus's avatar
Thomas Tanghus committed
45
46
				<primary>true</primary>
				<unique>true</unique>
47
48
49
50
51
52
53
54
55
				<field>
					<name>appid</name>
					<sorting>ascending</sorting>
				</field>
				<field>
					<name>configkey</name>
					<sorting>ascending</sorting>
				</field>
			</index>
56
57
58
59
60
61
62
			<index>
				<name>appconfig_config_key_index</name>
				<field>
					<name>configkey</name>
					<sorting>ascending</sorting>
				</field>
			</index>
63
64
65
66
67
68
69
			<index>
				<name>appconfig_appid_key</name>
				<field>
					<name>appid</name>
					<sorting>ascending</sorting>
				</field>
			</index>
70

Robin Appelman's avatar
Robin Appelman committed
71
72
73
74
		</declaration>

	</table>

75
	<table>
Andreas Fischer's avatar
Andreas Fischer committed
76

Andreas Fischer's avatar
Andreas Fischer committed
77
78
		<!--
		Bidirectional Map for Storage Names and Storage Ids.
Andreas Fischer's avatar
Andreas Fischer committed
79
80
81
82
		 - Assigns each storage name a unique storage id integer.
		 - Long storage names are hashed.
		 - E.g.                     local::/tmp/ <-> 2
		 - E.g. b5db994aa8c6625100e418406c798269 <-> 27
Andreas Fischer's avatar
Andreas Fischer committed
83
		-->
84
85
86
87
88
89
90
91
		<name>*dbprefix*storages</name>

		<declaration>

			<field>
				<name>id</name>
				<type>text</type>
				<default></default>
92
				<notnull>false</notnull>
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
				<length>64</length>
			</field>

			<field>
				<name>numeric_id</name>
				<type>integer</type>
				<default>0</default>
				<notnull>true</notnull>
				<autoincrement>1</autoincrement>
				<length>4</length>
			</field>

			<index>
				<name>storages_id_index</name>
				<unique>true</unique>
				<field>
					<name>id</name>
					<sorting>ascending</sorting>
				</field>
			</index>

		</declaration>

	</table>

118
119
120
121
122
123
124
125
126
127
128
129
130
131
	<table>

		<name>*dbprefix*file_map</name>

		<declaration>

			<field>
				<name>logic_path</name>
				<type>text</type>
				<default></default>
				<notnull>true</notnull>
				<length>512</length>
			</field>

132
133
134
135
136
137
138
139
			<field>
				<name>logic_path_hash</name>
				<type>text</type>
				<default></default>
				<notnull>true</notnull>
				<length>32</length>
			</field>

140
141
142
143
144
145
146
147
			<field>
				<name>physic_path</name>
				<type>text</type>
				<default></default>
				<notnull>true</notnull>
				<length>512</length>
			</field>

148
149
150
151
152
153
154
155
			<field>
				<name>physic_path_hash</name>
				<type>text</type>
				<default></default>
				<notnull>true</notnull>
				<length>32</length>
			</field>

156
157
			<index>
				<name>file_map_lp_index</name>
Thomas Tanghus's avatar
Thomas Tanghus committed
158
				<primary>true</primary>
159
160
				<unique>true</unique>
				<field>
161
					<name>logic_path_hash</name>
162
163
164
165
166
167
168
169
					<sorting>ascending</sorting>
				</field>
			</index>

			<index>
				<name>file_map_pp_index</name>
				<unique>true</unique>
				<field>
170
					<name>physic_path_hash</name>
171
172
173
174
175
176
177
178
					<sorting>ascending</sorting>
				</field>
			</index>

		</declaration>

	</table>

Robin Appelman's avatar
Robin Appelman committed
179
	<table>
Andreas Fischer's avatar
Andreas Fischer committed
180

181
182
		<!--
		Bidirectional Map for Mimetypes and Mimetype Id
Andreas Fischer's avatar
Andreas Fischer committed
183
184
185
		 - Assigns each mimetype (and supertype) a unique mimetype id integer.
		 - E.g.     application <-> 5
		 - E.g. application/pdf <-> 6
186
		-->
Robin Appelman's avatar
Robin Appelman committed
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
		<name>*dbprefix*mimetypes</name>

		<declaration>

			<field>
				<name>id</name>
				<type>integer</type>
				<default>0</default>
				<notnull>true</notnull>
				<autoincrement>1</autoincrement>
				<length>4</length>
			</field>

			<field>
				<name>mimetype</name>
				<type>text</type>
				<default></default>
				<notnull>true</notnull>
205
				<length>255</length>
Robin Appelman's avatar
Robin Appelman committed
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
			</field>

			<index>
				<name>mimetype_id_index</name>
				<unique>true</unique>
				<field>
					<name>mimetype</name>
					<sorting>ascending</sorting>
				</field>
			</index>

		</declaration>

	</table>

Robin Appelman's avatar
Robin Appelman committed
221
	<table>
Andreas Fischer's avatar
Andreas Fischer committed
222

223
224
225
226
227
228
229
230
231
232
		<!--
		Main file table containing one row for each directory and file.
		 - Assigns a unique integer fileid to each file (and directory)
		 - Assigns an etag to each file (and directory)
		 - Caches various file/dir properties such as:
		  - path (filename, e.g. files/combinatoricslib-2.0_doc.zip)
		  - path_hash = md5(path)
		  - name (basename, e.g. combinatoricslib-2.0_doc.zip)
		  - size (for directories this is the sum of all contained file sizes)
		-->
Robin Appelman's avatar
Robin Appelman committed
233
		<name>*dbprefix*filecache</name>
Robin Appelman's avatar
Robin Appelman committed
234
235
236
237

		<declaration>

			<field>
Robin Appelman's avatar
Robin Appelman committed
238
				<name>fileid</name>
Robin Appelman's avatar
Robin Appelman committed
239
240
241
				<type>integer</type>
				<default>0</default>
				<notnull>true</notnull>
Robin Appelman's avatar
Robin Appelman committed
242
				<autoincrement>1</autoincrement>
Robin Appelman's avatar
Robin Appelman committed
243
244
245
				<length>4</length>
			</field>

246
			<!-- Foreign Key storages::numeric_id -->
Robin Appelman's avatar
Robin Appelman committed
247
248
			<field>
				<name>storage</name>
249
				<type>integer</type>
Robin Appelman's avatar
Robin Appelman committed
250
251
				<default></default>
				<notnull>true</notnull>
252
				<length>4</length>
Robin Appelman's avatar
Robin Appelman committed
253
254
			</field>

Robin Appelman's avatar
Robin Appelman committed
255
256
257
258
			<field>
				<name>path</name>
				<type>text</type>
				<default></default>
259
				<notnull>false</notnull>
260
				<length>4000</length>
Robin Appelman's avatar
Robin Appelman committed
261
262
263
264
265
266
267
268
269
270
			</field>

			<field>
				<name>path_hash</name>
				<type>text</type>
				<default></default>
				<notnull>true</notnull>
				<length>32</length>
			</field>

271
			<!-- Foreign Key filecache::fileid -->
Robin Appelman's avatar
Robin Appelman committed
272
273
274
275
276
			<field>
				<name>parent</name>
				<type>integer</type>
				<default></default>
				<notnull>true</notnull>
Robin Appelman's avatar
Robin Appelman committed
277
				<length>4</length>
Robin Appelman's avatar
Robin Appelman committed
278
279
280
			</field>

			<field>
Robin Appelman's avatar
Robin Appelman committed
281
				<name>name</name>
Robin Appelman's avatar
Robin Appelman committed
282
283
				<type>text</type>
				<default></default>
284
				<notnull>false</notnull>
Robin Appelman's avatar
Robin Appelman committed
285
				<length>250</length>
Robin Appelman's avatar
Robin Appelman committed
286
287
			</field>

288
			<!-- Foreign Key mimetypes::id -->
Robin Appelman's avatar
Robin Appelman committed
289
290
			<field>
				<name>mimetype</name>
Robin Appelman's avatar
Robin Appelman committed
291
				<type>integer</type>
Robin Appelman's avatar
Robin Appelman committed
292
293
				<default></default>
				<notnull>true</notnull>
Robin Appelman's avatar
Robin Appelman committed
294
				<length>4</length>
Robin Appelman's avatar
Robin Appelman committed
295
296
			</field>

297
			<!-- Foreign Key mimetypes::id -->
Robin Appelman's avatar
Robin Appelman committed
298
299
			<field>
				<name>mimepart</name>
Robin Appelman's avatar
Robin Appelman committed
300
				<type>integer</type>
Robin Appelman's avatar
Robin Appelman committed
301
302
				<default></default>
				<notnull>true</notnull>
Robin Appelman's avatar
Robin Appelman committed
303
				<length>4</length>
Robin Appelman's avatar
Robin Appelman committed
304
305
306
			</field>

			<field>
Robin Appelman's avatar
Robin Appelman committed
307
				<name>size</name>
Robin Appelman's avatar
Robin Appelman committed
308
				<type>integer</type>
Robin Appelman's avatar
Robin Appelman committed
309
				<default></default>
Robin Appelman's avatar
Robin Appelman committed
310
				<notnull>true</notnull>
Robin Appelman's avatar
Robin Appelman committed
311
				<length>8</length>
Robin Appelman's avatar
Robin Appelman committed
312
313
314
			</field>

			<field>
Robin Appelman's avatar
Robin Appelman committed
315
				<name>mtime</name>
Robin Appelman's avatar
Robin Appelman committed
316
				<type>integer</type>
Robin Appelman's avatar
Robin Appelman committed
317
				<default></default>
Robin Appelman's avatar
Robin Appelman committed
318
				<notnull>true</notnull>
Robin Appelman's avatar
Robin Appelman committed
319
				<length>4</length>
Robin Appelman's avatar
Robin Appelman committed
320
321
			</field>

322
323
324
325
326
327
328
329
			<field>
				<name>storage_mtime</name>
				<type>integer</type>
				<default></default>
				<notnull>true</notnull>
				<length>4</length>
			</field>

Robin Appelman's avatar
Robin Appelman committed
330
			<field>
Robin Appelman's avatar
Robin Appelman committed
331
				<name>encrypted</name>
Robin Appelman's avatar
Robin Appelman committed
332
333
334
				<type>integer</type>
				<default>0</default>
				<notnull>true</notnull>
Robin Appelman's avatar
Robin Appelman committed
335
				<length>4</length>
Robin Appelman's avatar
Robin Appelman committed
336
337
			</field>

338
339
340
            <field>
                <name>unencrypted_size</name>
                <type>integer</type>
341
                <default>0</default>
342
343
344
345
                <notnull>true</notnull>
                <length>8</length>
            </field>

346
347
348
349
			<field>
				<name>etag</name>
				<type>text</type>
				<default></default>
350
				<notnull>false</notnull>
351
				<length>40</length>
352
353
			</field>

354
355
356
357
358
359
360
361
362
363
            <field>
                <name>permissions</name>
                <type>integer</type>
                <default>0</default>
                <notnull>false</notnull>
                <length>4</length>
            </field>


            <index>
364
				<name>fs_storage_path_hash</name>
Robin Appelman's avatar
Robin Appelman committed
365
				<unique>true</unique>
Robin Appelman's avatar
Robin Appelman committed
366
				<field>
Robin Appelman's avatar
Robin Appelman committed
367
					<name>storage</name>
Robin Appelman's avatar
Robin Appelman committed
368
369
370
					<sorting>ascending</sorting>
				</field>
				<field>
Robin Appelman's avatar
Robin Appelman committed
371
					<name>path_hash</name>
Robin Appelman's avatar
Robin Appelman committed
372
373
374
375
376
					<sorting>ascending</sorting>
				</field>
			</index>

			<index>
377
				<name>fs_parent_name_hash</name>
Robin Appelman's avatar
Robin Appelman committed
378
379
380
381
382
383
384
385
386
387
				<field>
					<name>parent</name>
					<sorting>ascending</sorting>
				</field>
				<field>
					<name>name</name>
					<sorting>ascending</sorting>
				</field>
			</index>

388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
			<index>
				<name>fs_storage_mimetype</name>
				<field>
					<name>storage</name>
					<sorting>ascending</sorting>
				</field>
				<field>
					<name>mimetype</name>
					<sorting>ascending</sorting>
				</field>
			</index>

			<index>
				<name>fs_storage_mimepart</name>
				<field>
					<name>storage</name>
					<sorting>ascending</sorting>
				</field>
				<field>
					<name>mimepart</name>
					<sorting>ascending</sorting>
				</field>
			</index>

412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
			<index>
				<name>fs_storage_size</name>
				<field>
					<name>storage</name>
					<sorting>ascending</sorting>
				</field>
				<field>
					<name>size</name>
					<sorting>ascending</sorting>
				</field>
				<field>
					<name>fileid</name>
				</field>
			</index>

Robin Appelman's avatar
Robin Appelman committed
427
428
429
430
431
		</declaration>

	</table>

	<table>
Andreas Fischer's avatar
Andreas Fischer committed
432

433
434
435
436
437
		<!--
		Stores which groups have which users as members in an n:m relationship.
		 - Maps group id (gid) to a set of users (uid)
		 - Maps user id (uid) to a set of groups (gid) (but without index)
		-->
Robin Appelman's avatar
Robin Appelman committed
438
439
440
441
		<name>*dbprefix*group_user</name>

		<declaration>

442
			<!-- Foreign Key groups::gid -->
Robin Appelman's avatar
Robin Appelman committed
443
444
445
446
447
448
449
450
			<field>
				<name>gid</name>
				<type>text</type>
				<default></default>
				<notnull>true</notnull>
				<length>64</length>
			</field>

451
			<!-- Foreign Key users::uid -->
Robin Appelman's avatar
Robin Appelman committed
452
453
454
455
456
457
458
459
			<field>
				<name>uid</name>
				<type>text</type>
				<default></default>
				<notnull>true</notnull>
				<length>64</length>
			</field>

Thomas Tanghus's avatar
Thomas Tanghus committed
460
461
462
463
464
465
466
467
468
469
470
471
472
473
			<index>
				<name>gu_gid_uid_index</name>
				<primary>true</primary>
				<unique>true</unique>
				<field>
					<name>gid</name>
					<sorting>ascending</sorting>
				</field>
				<field>
					<name>uid</name>
					<sorting>ascending</sorting>
				</field>
			</index>

Robin Appelman's avatar
Robin Appelman committed
474
475
476
477
478
		</declaration>

	</table>

	<table>
Andreas Fischer's avatar
Andreas Fischer committed
479

480
481
482
483
		<!--
		Stores which groups have which users as admins in an n:m relationship.
		 - Maps group id (gid) to a set of users (uid)
		 - Maps user id (uid) to a set of groups (gid)
484
485
486

		NOTE: This could (very likely) be reduced to a single bit in group_user
		      instead of repeating varchars gid and uid here
487
		-->
Robin Appelman's avatar
Robin Appelman committed
488
489
490
491
		<name>*dbprefix*group_admin</name>

		<declaration>

492
			<!-- Foreign Key groups::gid -->
Robin Appelman's avatar
Robin Appelman committed
493
494
495
496
497
498
499
500
			<field>
				<name>gid</name>
				<type>text</type>
				<default></default>
				<notnull>true</notnull>
				<length>64</length>
			</field>

501
			<!-- Foreign Key users::uid -->
Robin Appelman's avatar
Robin Appelman committed
502
503
504
505
506
507
508
			<field>
				<name>uid</name>
				<type>text</type>
				<default></default>
				<notnull>true</notnull>
				<length>64</length>
			</field>
509
510
511
512
513
514
515
			<index>
				<name>group_admin_uid</name>
				<field>
					<name>uid</name>
					<sorting>ascending</sorting>
				</field>
			</index>
Robin Appelman's avatar
Robin Appelman committed
516

Thomas Tanghus's avatar
Thomas Tanghus committed
517
518
519
520
521
522
523
524
525
526
527
528
529
530
			<index>
				<name>ga_gid_uid_index</name>
				<primary>true</primary>
				<unique>true</unique>
				<field>
					<name>gid</name>
					<sorting>ascending</sorting>
				</field>
				<field>
					<name>uid</name>
					<sorting>ascending</sorting>
				</field>
			</index>

Robin Appelman's avatar
Robin Appelman committed
531
532
533
534
535
		</declaration>

	</table>

	<table>
Andreas Fischer's avatar
Andreas Fischer committed
536

Andreas Fischer's avatar
Andreas Fischer committed
537
538
539
		<!--
		A simple list of groups.
		-->
Robin Appelman's avatar
Robin Appelman committed
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
		<name>*dbprefix*groups</name>

		<declaration>

			<field>
				<name>gid</name>
				<type>text</type>
				<default></default>
				<notnull>true</notnull>
				<length>64</length>
			</field>

			<index>
				<name>groups_pKey</name>
				<primary>true</primary>
				<field>
					<name>gid</name>
					<sorting>ascending</sorting>
				</field>
			</index>

		</declaration>

	</table>

	<table>
Andreas Fischer's avatar
Andreas Fischer committed
566

567
568
569
570
571
		<!--
		Namespaced Key-Value Store for User Preferences
		 - Keys are namespaced per userid and appid.
		 - E.g. (admin, files, cache_version) -> 5
		-->
Robin Appelman's avatar
Robin Appelman committed
572
573
574
575
		<name>*dbprefix*preferences</name>

		<declaration>

576
			<!-- Foreign Key users::uid -->
Robin Appelman's avatar
Robin Appelman committed
577
578
579
580
581
			<field>
				<name>userid</name>
				<type>text</type>
				<default></default>
				<notnull>true</notnull>
582
				<length>64</length>
Robin Appelman's avatar
Robin Appelman committed
583
584
585
586
587
588
589
			</field>

			<field>
				<name>appid</name>
				<type>text</type>
				<default></default>
				<notnull>true</notnull>
590
				<length>32</length>
Robin Appelman's avatar
Robin Appelman committed
591
592
593
594
595
596
597
			</field>

			<field>
				<name>configkey</name>
				<type>text</type>
				<default></default>
				<notnull>true</notnull>
598
				<length>64</length>
Robin Appelman's avatar
Robin Appelman committed
599
600
601
602
603
604
605
606
			</field>

			<field>
				<name>configvalue</name>
				<type>clob</type>
				<notnull>false</notnull>
			</field>

607
			<index>
608
				<name>pref_userid_appid_key_index</name>
Thomas Tanghus's avatar
Thomas Tanghus committed
609
610
				<primary>true</primary>
				<unique>true</unique>
611
612
613
614
615
616
617
618
619
620
621
622
623
624
				<field>
					<name>userid</name>
					<sorting>ascending</sorting>
				</field>
				<field>
					<name>appid</name>
					<sorting>ascending</sorting>
				</field>
				<field>
					<name>configkey</name>
					<sorting>ascending</sorting>
				</field>
			</index>

Robin Appelman's avatar
Robin Appelman committed
625
626
627
628
629
		</declaration>

	</table>

	<table>
Andreas Fischer's avatar
Andreas Fischer committed
630

631
632
633
		<!--
		WebDAV properties.
		-->
Robin Appelman's avatar
Robin Appelman committed
634
635
636
637
		<name>*dbprefix*properties</name>

		<declaration>

Thomas Tanghus's avatar
Thomas Tanghus committed
638
639
640
641
642
643
644
645
646
			<field>
				<name>id</name>
				<autoincrement>1</autoincrement>
				<type>integer</type>
				<default>0</default>
				<notnull>true</notnull>
				<length>4</length>
			</field>

647
			<!-- Foreign Key users::uid -->
Robin Appelman's avatar
Robin Appelman committed
648
649
650
651
652
			<field>
				<name>userid</name>
				<type>text</type>
				<default></default>
				<notnull>true</notnull>
653
				<length>64</length>
Robin Appelman's avatar
Robin Appelman committed
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
			</field>

			<field>
				<name>propertypath</name>
				<type>text</type>
				<default></default>
				<notnull>true</notnull>
				<length>255</length>
			</field>

			<field>
				<name>propertyname</name>
				<type>text</type>
				<default></default>
				<notnull>true</notnull>
				<length>255</length>
			</field>

			<field>
				<name>propertyvalue</name>
				<type>text</type>
				<notnull>true</notnull>
				<length>255</length>
			</field>

Thomas Tanghus's avatar
Thomas Tanghus committed
679
			<index>
Arthur Schiwon's avatar
Arthur Schiwon committed
680
681
682
683
684
				<name>property_index</name>
				<field>
					<name>userid</name>
					<sorting>ascending</sorting>
				</field>
Thomas Tanghus's avatar
Thomas Tanghus committed
685
			</index>
Arthur Schiwon's avatar
Arthur Schiwon committed
686

Robin Appelman's avatar
Robin Appelman committed
687
688
689
690
691
		</declaration>

	</table>

	<table>
Andreas Fischer's avatar
Andreas Fischer committed
692

Andreas Fischer's avatar
Andreas Fischer committed
693
694
695
		<!--
		Shares of all types (user-to-user, external-via-link, etc.)
		-->
Robin Appelman's avatar
Robin Appelman committed
696
697
698
699
700
701
702
703
704
705
706
707
708
		<name>*dbprefix*share</name>

		<declaration>

			<field>
				<name>id</name>
				<autoincrement>1</autoincrement>
				<type>integer</type>
				<default>0</default>
				<notnull>true</notnull>
				<length>4</length>
			</field>

Andreas Fischer's avatar
Andreas Fischer committed
709
			<!-- Constant OCP\Share::SHARE_TYPE_* -->
Robin Appelman's avatar
Robin Appelman committed
710
711
712
713
714
715
716
717
			<field>
				<name>share_type</name>
				<type>integer</type>
				<default>0</default>
				<notnull>true</notnull>
				<length>1</length>
			</field>

Andreas Fischer's avatar
Andreas Fischer committed
718
			<!-- Foreign Key users::uid or NULL -->
Robin Appelman's avatar
Robin Appelman committed
719
720
721
722
723
724
725
726
			<field>
				<name>share_with</name>
				<type>text</type>
				<default></default>
				<notnull>false</notnull>
				<length>255</length>
			</field>

Andreas Fischer's avatar
Andreas Fischer committed
727
			<!-- Foreign Key users::uid -->
Robin Appelman's avatar
Robin Appelman committed
728
729
730
731
732
			<field>
				<name>uid_owner</name>
				<type>text</type>
				<default></default>
				<notnull>true</notnull>
733
				<length>64</length>
Robin Appelman's avatar
Robin Appelman committed
734
735
			</field>

Andreas Fischer's avatar
Andreas Fischer committed
736
			<!-- Foreign Key share::id or NULL -->
Robin Appelman's avatar
Robin Appelman committed
737
738
739
740
741
742
743
			<field>
				<name>parent</name>
				<type>integer</type>
				<notnull>false</notnull>
				<length>4</length>
			</field>

Andreas Fischer's avatar
Andreas Fischer committed
744
			<!-- E.g. file or folder -->
Robin Appelman's avatar
Robin Appelman committed
745
746
747
748
749
750
751
752
			<field>
				<name>item_type</name>
				<type>text</type>
				<default></default>
				<notnull>true</notnull>
				<length>64</length>
			</field>

Andreas Fischer's avatar
Andreas Fischer committed
753
			<!-- Foreign Key filecache::fileid -->
Robin Appelman's avatar
Robin Appelman committed
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
			<field>
				<name>item_source</name>
				<type>text</type>
				<default></default>
				<notnull>false</notnull>
				<length>255</length>
			</field>

			<field>
				<name>item_target</name>
				<type>text</type>
				<default></default>
				<notnull>false</notnull>
				<length>255</length>
			</field>

Andreas Fischer's avatar
Andreas Fischer committed
770
			<!-- Foreign Key filecache::fileid -->
Robin Appelman's avatar
Robin Appelman committed
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
			<field>
				<name>file_source</name>
				<type>integer</type>
				<notnull>false</notnull>
				<length>4</length>
			</field>

			<field>
				<name>file_target</name>
				<type>text</type>
				<default></default>
				<notnull>false</notnull>
				<length>512</length>
			</field>

Andreas Fischer's avatar
Andreas Fischer committed
786
			<!-- Permission bitfield -->
Robin Appelman's avatar
Robin Appelman committed
787
788
789
790
791
792
793
794
			<field>
				<name>permissions</name>
				<type>integer</type>
				<default>0</default>
				<notnull>true</notnull>
				<length>1</length>
			</field>

Andreas Fischer's avatar
Andreas Fischer committed
795
			<!-- Time of share creation -->
Robin Appelman's avatar
Robin Appelman committed
796
797
798
799
800
801
802
803
			<field>
				<name>stime</name>
				<type>integer</type>
				<default>0</default>
				<notnull>true</notnull>
				<length>8</length>
			</field>

Andreas Fischer's avatar
Andreas Fischer committed
804
			<!-- Whether the receiver accepted the share, if share_with is set. -->
Robin Appelman's avatar
Robin Appelman committed
805
806
807
808
809
810
811
812
			<field>
				<name>accepted</name>
				<type>integer</type>
				<default>0</default>
				<notnull>true</notnull>
				<length>1</length>
			</field>

Andreas Fischer's avatar
Andreas Fischer committed
813
			<!-- Time of share expiration -->
Robin Appelman's avatar
Robin Appelman committed
814
815
816
817
818
819
820
			<field>
				<name>expiration</name>
				<type>timestamp</type>
				<default></default>
				<notnull>false</notnull>
			</field>

821
822
823
824
825
826
827
828
			<field>
				<name>token</name>
				<type>text</type>
				<default></default>
				<notnull>false</notnull>
				<length>32</length>
			</field>

829
830
831
832
833
834
835
836
			<field>
				<name>mail_send</name>
				<type>integer</type>
				<default>0</default>
				<notnull>true</notnull>
				<length>1</length>
			</field>

837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
			<index>
				<name>item_share_type_index</name>
				<field>
					<name>item_type</name>
					<sorting>ascending</sorting>
				</field>
				<field>
					<name>share_type</name>
					<sorting>ascending</sorting>
				</field>
			</index>
			<index>
				<name>file_source_index</name>
				<field>
					<name>file_source</name>
					<sorting>ascending</sorting>
				</field>
			</index>
855
856
857
858
859
860
861
			<index>
				<name>token_index</name>
				<field>
					<name>token</name>
					<sorting>ascending</sorting>
				</field>
			</index>
Robin Appelman's avatar
Robin Appelman committed
862
863
864
865
866
		</declaration>

	</table>

	<table>
Andreas Fischer's avatar
Andreas Fischer committed
867

Andreas Fischer's avatar
Andreas Fischer committed
868
869
870
871
		<!--
		Scheduled background jobs.
		See OC\BackgroundJob\JobList.
		-->
872
		<name>*dbprefix*jobs</name>
Robin Appelman's avatar
Robin Appelman committed
873
874
875
876
877
878
879
880
881
882
883
884
885
886

		<declaration>

			<field>
				<name>id</name>
				<type>integer</type>
				<default>0</default>
				<notnull>true</notnull>
				<autoincrement>1</autoincrement>
				<unsigned>true</unsigned>
				<length>4</length>
			</field>

			<field>
887
				<name>class</name>
Robin Appelman's avatar
Robin Appelman committed
888
889
890
				<type>text</type>
				<default></default>
				<notnull>true</notnull>
891
				<length>255</length>
Robin Appelman's avatar
Robin Appelman committed
892
893
894
			</field>

			<field>
895
				<name>argument</name>
Robin Appelman's avatar
Robin Appelman committed
896
897
898
				<type>text</type>
				<default></default>
				<notnull>true</notnull>
899
				<length>4000</length>
Robin Appelman's avatar
Robin Appelman committed
900
901
902
			</field>

			<field>
903
				<name>last_run</name>
Robin Appelman's avatar
Robin Appelman committed
904
				<type>integer</type>
Robin Appelman's avatar
Robin Appelman committed
905
				<default></default>
906
				<notnull>false</notnull>
Robin Appelman's avatar
Robin Appelman committed
907
908
			</field>

909
910
911
912
913
914
915
			<index>
				<name>job_class_index</name>
				<field>
					<name>class</name>
					<sorting>ascending</sorting>
				</field>
			</index>
Robin Appelman's avatar
Robin Appelman committed
916
917
918
919
920
921

		</declaration>

	</table>

	<table>
Andreas Fischer's avatar
Andreas Fischer committed
922

Andreas Fischer's avatar
Andreas Fischer committed
923
924
925
		<!--
		List of usernames, their display name and login password.
		-->
Robin Appelman's avatar
Robin Appelman committed
926
927
928
929
930
931
932
933
934
935
936
937
		<name>*dbprefix*users</name>

		<declaration>

			<field>
				<name>uid</name>
				<type>text</type>
				<default></default>
				<notnull>true</notnull>
				<length>64</length>
			</field>

938
939
940
941
942
943
944
			<field>
				<name>displayname</name>
				<type>text</type>
				<default></default>
				<length>64</length>
			</field>

Robin Appelman's avatar
Robin Appelman committed
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
			<field>
				<name>password</name>
				<type>text</type>
				<default></default>
				<notnull>true</notnull>
				<length>255</length>
			</field>

			<index>
				<name>users_pKey</name>
				<primary>true</primary>
				<field>
					<name>uid</name>
					<sorting>ascending</sorting>
				</field>
			</index>

		</declaration>

	</table>
965

Thomas Tanghus's avatar
Thomas Tanghus committed
966
	<table>
Andreas Fischer's avatar
Andreas Fischer committed
967

968
969
970
		<!--
		List of tags (category) + a unique tag id (id) per user (uid) and type.
		-->
Thomas Tanghus's avatar
Thomas Tanghus committed
971
972
973
974
975
976
977
978
979
980
981
982
983
984
		<name>*dbprefix*vcategory</name>

		<declaration>

			<field>
				<name>id</name>
				<type>integer</type>
				<default>0</default>
				<notnull>true</notnull>
				<autoincrement>1</autoincrement>
				<unsigned>true</unsigned>
				<length>4</length>
			</field>

985
			<!-- Foreign Key users::uid -->
Thomas Tanghus's avatar
Thomas Tanghus committed
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
			<field>
				<name>uid</name>
				<type>text</type>
				<default></default>
				<notnull>true</notnull>
				<length>64</length>
			</field>

			<field>
				<name>type</name>
				<type>text</type>
				<default></default>
				<notnull>true</notnull>
				<length>64</length>
			</field>

			<field>
				<name>category</name>
				<type>text</type>
				<default></default>
				<notnull>true</notnull>
				<length>255</length>
			</field>

			<index>
				<name>uid_index</name>
				<field>
					<name>uid</name>
					<sorting>ascending</sorting>
				</field>
			</index>

			<index>
				<name>type_index</name>
				<field>
					<name>type</name>
					<sorting>ascending</sorting>
				</field>
			</index>

			<index>
				<name>category_index</name>
				<field>
					<name>category</name>
					<sorting>ascending</sorting>
				</field>
			</index>

		</declaration>
	</table>

	<table>
Andreas Fischer's avatar
Andreas Fischer committed
1038

1039
1040
1041
		<!--
		Object-Tag associations per tag type.
		-->
Thomas Tanghus's avatar
Thomas Tanghus committed
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
		<name>*dbprefix*vcategory_to_object</name>

		<declaration>

		<field>
			<name>objid</name>
			<type>integer</type>
			<default>0</default>
			<notnull>true</notnull>
			<unsigned>true</unsigned>
			<length>4</length>
		</field>

1055
		<!-- Foreign Key vcategory::id -->
Thomas Tanghus's avatar
Thomas Tanghus committed
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
		<field>
			<name>categoryid</name>
			<type>integer</type>
			<default>0</default>
			<notnull>true</notnull>
			<unsigned>true</unsigned>
			<length>4</length>
		</field>

		<field>
			<name>type</name>
			<type>text</type>
			<default></default>
			<notnull>true</notnull>
			<length>64</length>
		</field>

		<index>
			<primary>true</primary>
			<unique>true</unique>
			<name>category_object_index</name>
			<field>
				<name>categoryid</name>
				<sorting>ascending</sorting>
			</field>
			<field>
				<name>objid</name>
				<sorting>ascending</sorting>
			</field>
			<field>
				<name>type</name>
				<sorting>ascending</sorting>
			</field>
		</index>

1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
		<index>
			<name>vcategory_objectd_index</name>
			<field>
				<name>objid</name>
				<sorting>ascending</sorting>
			</field>
			<field>
				<name>type</name>
				<sorting>ascending</sorting>
			</field>
		</index>

Thomas Tanghus's avatar
Thomas Tanghus committed
1103
1104
1105
		</declaration>

	</table>
1106

1107
	<table>
Andreas Fischer's avatar
Andreas Fischer committed
1108

1109
1110
1111
1112
1113
		<!--
		Namespaced Key-Value Store for arbitrary data.
		 - Keys are namespaced per userid and appid.
		 - E.g. (admin, files, foo) -> bar
		-->
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
		<name>*dbprefix*privatedata</name>

		<declaration>

		<field>
			<name>keyid</name>
			<type>integer</type>
			<default>0</default>
			<notnull>true</notnull>
			<unsigned>true</unsigned>
			<length>4</length>
			<autoincrement>1</autoincrement>
		</field>

1128
		<!-- Foreign Key users::uid -->
1129
1130
1131
1132
1133
		<field>
			<name>user</name>
			<type>text</type>
			<default></default>
			<notnull>true</notnull>
1134
			<length>64</length>
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
		</field>

		<field>
			<name>app</name>
			<type>text</type>
			<default></default>
			<notnull>true</notnull>
			<length>255</length>
		</field>

		<field>
			<name>key</name>
			<type>text</type>
			<default></default>
			<notnull>true</notnull>
			<length>255</length>
		</field>

		<field>
			<name>value</name>
			<type>text</type>
			<default></default>
			<notnull>true</notnull>
			<length>255</length>
		</field>

		<index>
			<primary>true</primary>
			<unique>true</unique>
			<name>keyid_index</name>
			<field>
				<name>keyid</name>
				<sorting>ascending</sorting>
			</field>
		</index>

		</declaration>

	</table>


1176
</database>