db_structure.xml 23.2 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

Andreas Fischer's avatar
Andreas Fischer committed
567
568
569
		<!--
		Locks held by WebDAV clients via OC_Connector_Sabre_Locks.
		-->
Robin Appelman's avatar
Robin Appelman committed
570
571
572
573
574
575
576
577
578
579
580
581
582
583
		<name>*dbprefix*locks</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>

Andreas Fischer's avatar
Andreas Fischer committed
584
			<!-- Foreign Key users::uid -->
Robin Appelman's avatar
Robin Appelman committed
585
586
587
588
589
			<field>
				<name>userid</name>
				<type>text</type>
				<default></default>
				<notnull>false</notnull>
590
				<length>64</length>
Robin Appelman's avatar
Robin Appelman committed
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
			</field>

			<field>
				<name>owner</name>
				<type>text</type>
				<default></default>
				<notnull>false</notnull>
				<length>100</length>
			</field>

			<field>
				<name>timeout</name>
				<type>integer</type>
				<notnull>false</notnull>
				<unsigned>true</unsigned>
				<length>4</length>
			</field>

			<field>
				<name>created</name>
				<type>integer</type>
				<notnull>false</notnull>
				<length>8</length>
			</field>

			<field>
				<name>token</name>
				<type>text</type>
				<default></default>
				<notnull>false</notnull>
				<length>100</length>
			</field>

			<field>
				<name>scope</name>
				<type>integer</type>
				<notnull>false</notnull>
				<length>1</length>
			</field>

			<field>
				<name>depth</name>
				<type>integer</type>
				<notnull>false</notnull>
				<length>1</length>
			</field>

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

		</declaration>

	</table>

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

650
651
652
653
654
		<!--
		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
655
656
657
658
		<name>*dbprefix*preferences</name>

		<declaration>

659
			<!-- Foreign Key users::uid -->
Robin Appelman's avatar
Robin Appelman committed
660
661
662
663
664
			<field>
				<name>userid</name>
				<type>text</type>
				<default></default>
				<notnull>true</notnull>
665
				<length>64</length>
Robin Appelman's avatar
Robin Appelman committed
666
667
668
669
670
671
672
			</field>

			<field>
				<name>appid</name>
				<type>text</type>
				<default></default>
				<notnull>true</notnull>
673
				<length>32</length>
Robin Appelman's avatar
Robin Appelman committed
674
675
676
677
678
679
680
			</field>

			<field>
				<name>configkey</name>
				<type>text</type>
				<default></default>
				<notnull>true</notnull>
681
				<length>64</length>
Robin Appelman's avatar
Robin Appelman committed
682
683
684
685
686
687
688
689
			</field>

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

690
			<index>
691
				<name>pref_userid_appid_key_index</name>
Thomas Tanghus's avatar
Thomas Tanghus committed
692
693
				<primary>true</primary>
				<unique>true</unique>
694
695
696
697
698
699
700
701
702
703
704
705
706
707
				<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
708
709
710
711
712
		</declaration>

	</table>

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

714
715
716
		<!--
		WebDAV properties.
		-->
Robin Appelman's avatar
Robin Appelman committed
717
718
719
720
		<name>*dbprefix*properties</name>

		<declaration>

Thomas Tanghus's avatar
Thomas Tanghus committed
721
722
723
724
725
726
727
728
729
			<field>
				<name>id</name>
				<autoincrement>1</autoincrement>
				<type>integer</type>
				<default>0</default>
				<notnull>true</notnull>
				<length>4</length>
			</field>

730
			<!-- Foreign Key users::uid -->
Robin Appelman's avatar
Robin Appelman committed
731
732
733
734
735
			<field>
				<name>userid</name>
				<type>text</type>
				<default></default>
				<notnull>true</notnull>
736
				<length>64</length>
Robin Appelman's avatar
Robin Appelman committed
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
			</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
762
			<index>
Arthur Schiwon's avatar
Arthur Schiwon committed
763
764
765
766
767
				<name>property_index</name>
				<field>
					<name>userid</name>
					<sorting>ascending</sorting>
				</field>
Thomas Tanghus's avatar
Thomas Tanghus committed
768
			</index>
Arthur Schiwon's avatar
Arthur Schiwon committed
769

Robin Appelman's avatar
Robin Appelman committed
770
771
772
773
774
		</declaration>

	</table>

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

Andreas Fischer's avatar
Andreas Fischer committed
776
777
778
		<!--
		Shares of all types (user-to-user, external-via-link, etc.)
		-->
Robin Appelman's avatar
Robin Appelman committed
779
780
781
782
783
784
785
786
787
788
789
790
791
		<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
792
			<!-- Constant OCP\Share::SHARE_TYPE_* -->
Robin Appelman's avatar
Robin Appelman committed
793
794
795
796
797
798
799
800
			<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
801
			<!-- Foreign Key users::uid or NULL -->
Robin Appelman's avatar
Robin Appelman committed
802
803
804
805
806
807
808
809
			<field>
				<name>share_with</name>
				<type>text</type>
				<default></default>
				<notnull>false</notnull>
				<length>255</length>
			</field>

Andreas Fischer's avatar
Andreas Fischer committed
810
			<!-- Foreign Key users::uid -->
Robin Appelman's avatar
Robin Appelman committed
811
812
813
814
815
			<field>
				<name>uid_owner</name>
				<type>text</type>
				<default></default>
				<notnull>true</notnull>
816
				<length>64</length>
Robin Appelman's avatar
Robin Appelman committed
817
818
			</field>

Andreas Fischer's avatar
Andreas Fischer committed
819
			<!-- Foreign Key share::id or NULL -->
Robin Appelman's avatar
Robin Appelman committed
820
821
822
823
824
825
826
			<field>
				<name>parent</name>
				<type>integer</type>
				<notnull>false</notnull>
				<length>4</length>
			</field>

Andreas Fischer's avatar
Andreas Fischer committed
827
			<!-- E.g. file or folder -->
Robin Appelman's avatar
Robin Appelman committed
828
829
830
831
832
833
834
835
			<field>
				<name>item_type</name>
				<type>text</type>
				<default></default>
				<notnull>true</notnull>
				<length>64</length>
			</field>

Andreas Fischer's avatar
Andreas Fischer committed
836
			<!-- Foreign Key filecache::fileid -->
Robin Appelman's avatar
Robin Appelman committed
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
			<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
853
			<!-- Foreign Key filecache::fileid -->
Robin Appelman's avatar
Robin Appelman committed
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
			<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
869
			<!-- Permission bitfield -->
Robin Appelman's avatar
Robin Appelman committed
870
871
872
873
874
875
876
877
			<field>
				<name>permissions</name>
				<type>integer</type>
				<default>0</default>
				<notnull>true</notnull>
				<length>1</length>
			</field>

Andreas Fischer's avatar
Andreas Fischer committed
878
			<!-- Time of share creation -->
Robin Appelman's avatar
Robin Appelman committed
879
880
881
882
883
884
885
886
			<field>
				<name>stime</name>
				<type>integer</type>
				<default>0</default>
				<notnull>true</notnull>
				<length>8</length>
			</field>

Andreas Fischer's avatar
Andreas Fischer committed
887
			<!-- Whether the receiver accepted the share, if share_with is set. -->
Robin Appelman's avatar
Robin Appelman committed
888
889
890
891
892
893
894
895
			<field>
				<name>accepted</name>
				<type>integer</type>
				<default>0</default>
				<notnull>true</notnull>
				<length>1</length>
			</field>

Andreas Fischer's avatar
Andreas Fischer committed
896
			<!-- Time of share expiration -->
Robin Appelman's avatar
Robin Appelman committed
897
898
899
900
901
902
903
			<field>
				<name>expiration</name>
				<type>timestamp</type>
				<default></default>
				<notnull>false</notnull>
			</field>

904
905
906
907
908
909
910
911
			<field>
				<name>token</name>
				<type>text</type>
				<default></default>
				<notnull>false</notnull>
				<length>32</length>
			</field>

912
913
914
915
916
917
918
919
			<field>
				<name>mail_send</name>
				<type>integer</type>
				<default>0</default>
				<notnull>true</notnull>
				<length>1</length>
			</field>

920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
			<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>
938
939
940
941
942
943
944
			<index>
				<name>token_index</name>
				<field>
					<name>token</name>
					<sorting>ascending</sorting>
				</field>
			</index>
Robin Appelman's avatar
Robin Appelman committed
945
946
947
948
949
		</declaration>

	</table>

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

Andreas Fischer's avatar
Andreas Fischer committed
951
952
953
954
		<!--
		Scheduled background jobs.
		See OC\BackgroundJob\JobList.
		-->
955
		<name>*dbprefix*jobs</name>
Robin Appelman's avatar
Robin Appelman committed
956
957
958
959
960
961
962
963
964
965
966
967
968
969

		<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>
970
				<name>class</name>
Robin Appelman's avatar
Robin Appelman committed
971
972
973
				<type>text</type>
				<default></default>
				<notnull>true</notnull>
974
				<length>255</length>
Robin Appelman's avatar
Robin Appelman committed
975
976
977
			</field>

			<field>
978
				<name>argument</name>
Robin Appelman's avatar
Robin Appelman committed
979
980
981
				<type>text</type>
				<default></default>
				<notnull>true</notnull>
982
				<length>4000</length>
Robin Appelman's avatar
Robin Appelman committed
983
984
985
			</field>

			<field>
986
				<name>last_run</name>
Robin Appelman's avatar
Robin Appelman committed
987
				<type>integer</type>
Robin Appelman's avatar
Robin Appelman committed
988
				<default></default>
989
				<notnull>false</notnull>
Robin Appelman's avatar
Robin Appelman committed
990
991
			</field>

992
993
994
995
996
997
998
			<index>
				<name>job_class_index</name>
				<field>
					<name>class</name>
					<sorting>ascending</sorting>
				</field>
			</index>
Robin Appelman's avatar
Robin Appelman committed
999
1000

		</declaration>