directus

Форк
0
/
snapshots.ts 
908 строк · 18.7 Кб
1
import type { Snapshot, SnapshotField, SnapshotRelation } from '../types/index.js';
2

3
export const snapshotBeforeCreateCollection: Snapshot = {
4
	version: 1,
5
	directus: '0.0.0',
6
	collections: [
7
		{
8
			collection: 'test_table',
9
			meta: {
10
				accountability: 'all',
11
				collection: 'test_table',
12
				group: null,
13
				hidden: true,
14
				icon: 'import_export',
15
				item_duplication_fields: null,
16
				note: null,
17
				singleton: false,
18
				versioning: false,
19
				translations: {},
20
			},
21
			schema: {
22
				comment: null,
23
				name: 'test_table',
24
				schema: 'public',
25
			},
26
		},
27
	],
28
	fields: [
29
		{
30
			collection: 'test_table',
31
			field: 'id',
32
			meta: {
33
				collection: 'test_table',
34
				conditions: null,
35
				display: null,
36
				display_options: null,
37
				field: 'id',
38
				group: null,
39
				hidden: true,
40
				interface: null,
41
				note: null,
42
				options: null,
43
				readonly: false,
44
				required: false,
45
				sort: null,
46
				special: null,
47
				translations: {},
48
				validation: null,
49
				validation_message: null,
50
				width: 'full',
51
			},
52
			schema: {
53
				comment: null,
54
				data_type: 'uuid',
55
				default_value: null,
56
				foreign_key_column: null,
57
				foreign_key_schema: null,
58
				foreign_key_table: null,
59
				generation_expression: null,
60
				has_auto_increment: false,
61
				is_generated: false,
62
				is_nullable: false,
63
				is_primary_key: true,
64
				is_unique: true,
65
				max_length: null,
66
				name: 'id',
67
				numeric_precision: null,
68
				numeric_scale: null,
69
				schema: 'public',
70
				table: 'test_table',
71
			},
72
			type: 'uuid',
73
		} as SnapshotField,
74
	],
75
	relations: [],
76
};
77

78
export const snapshotCreateCollection: Snapshot = {
79
	version: 1,
80
	directus: '0.0.0',
81
	collections: [
82
		{
83
			collection: 'test_table',
84
			meta: {
85
				accountability: 'all',
86
				collection: 'test_table',
87
				group: null,
88
				hidden: true,
89
				icon: 'import_export',
90
				item_duplication_fields: null,
91
				note: null,
92
				singleton: false,
93
				versioning: false,
94
				translations: {},
95
			},
96
			schema: {
97
				comment: null,
98
				name: 'test_table',
99
				schema: 'public',
100
			},
101
		},
102
		{
103
			collection: 'test_table_2',
104
			meta: {
105
				accountability: 'all',
106
				collection: 'test_table_2',
107
				group: 'test_table',
108
				hidden: true,
109
				icon: 'import_export',
110
				item_duplication_fields: null,
111
				note: null,
112
				singleton: false,
113
				versioning: false,
114
				translations: {},
115
			},
116
			schema: {
117
				comment: null,
118
				name: 'test_table_2',
119
				schema: 'public',
120
			},
121
		},
122
		{
123
			collection: 'test_table_3',
124
			meta: {
125
				accountability: 'all',
126
				collection: 'test_table_3',
127
				group: 'test_table_2',
128
				hidden: true,
129
				icon: 'import_export',
130
				item_duplication_fields: null,
131
				note: null,
132
				singleton: false,
133
				versioning: false,
134
				translations: {},
135
			},
136
			schema: {
137
				comment: null,
138
				name: 'test_table_3',
139
				schema: 'public',
140
			},
141
		},
142
	],
143
	fields: [
144
		{
145
			collection: 'test_table',
146
			field: 'id',
147
			meta: {
148
				collection: 'test_table',
149
				conditions: null,
150
				display: null,
151
				display_options: null,
152
				field: 'id',
153
				group: null,
154
				hidden: true,
155
				interface: null,
156
				note: null,
157
				options: null,
158
				readonly: false,
159
				required: false,
160
				sort: null,
161
				special: null,
162
				translations: {},
163
				validation: null,
164
				validation_message: null,
165
				width: 'full',
166
			},
167
			schema: {
168
				comment: null,
169
				data_type: 'uuid',
170
				default_value: null,
171
				foreign_key_column: null,
172
				foreign_key_schema: null,
173
				foreign_key_table: null,
174
				generation_expression: null,
175
				has_auto_increment: false,
176
				is_generated: false,
177
				is_nullable: false,
178
				is_primary_key: true,
179
				is_unique: true,
180
				max_length: null,
181
				name: 'id',
182
				numeric_precision: null,
183
				numeric_scale: null,
184
				schema: 'public',
185
				table: 'test_table',
186
			},
187
			type: 'uuid',
188
		} as SnapshotField,
189
		{
190
			collection: 'test_table_2',
191
			field: 'id',
192
			meta: {
193
				collection: 'test_table_2',
194
				conditions: null,
195
				display: null,
196
				display_options: null,
197
				field: 'id',
198
				group: null,
199
				hidden: true,
200
				interface: null,
201
				note: null,
202
				options: null,
203
				readonly: false,
204
				required: false,
205
				sort: null,
206
				special: null,
207
				translations: {},
208
				validation: null,
209
				validation_message: null,
210
				width: 'full',
211
			},
212
			schema: {
213
				comment: null,
214
				data_type: 'uuid',
215
				default_value: null,
216
				foreign_key_column: null,
217
				foreign_key_schema: null,
218
				foreign_key_table: null,
219
				generation_expression: null,
220
				has_auto_increment: false,
221
				is_generated: false,
222
				is_nullable: false,
223
				is_primary_key: true,
224
				is_unique: true,
225
				max_length: null,
226
				name: 'id',
227
				numeric_precision: null,
228
				numeric_scale: null,
229
				schema: 'public',
230
				table: 'test_table_2',
231
			},
232
			type: 'uuid',
233
		} as SnapshotField,
234
		{
235
			collection: 'test_table_3',
236
			field: 'id',
237
			meta: {
238
				collection: 'test_table_3',
239
				conditions: null,
240
				display: null,
241
				display_options: null,
242
				field: 'id',
243
				group: null,
244
				hidden: true,
245
				interface: null,
246
				note: null,
247
				options: null,
248
				readonly: false,
249
				required: false,
250
				sort: null,
251
				special: null,
252
				translations: {},
253
				validation: null,
254
				validation_message: null,
255
				width: 'full',
256
			},
257
			schema: {
258
				comment: null,
259
				data_type: 'uuid',
260
				default_value: null,
261
				foreign_key_column: null,
262
				foreign_key_schema: null,
263
				foreign_key_table: null,
264
				generation_expression: null,
265
				has_auto_increment: false,
266
				is_generated: false,
267
				is_nullable: false,
268
				is_primary_key: true,
269
				is_unique: true,
270
				max_length: null,
271
				name: 'id',
272
				numeric_precision: null,
273
				numeric_scale: null,
274
				schema: 'public',
275
				table: 'test_table_3',
276
			},
277
			type: 'uuid',
278
		} as SnapshotField,
279
	],
280
	relations: [],
281
};
282

283
export const snapshotCreateCollectionNotNested: Snapshot = {
284
	version: 1,
285
	directus: '0.0.0',
286
	collections: [
287
		{
288
			collection: 'test_table',
289
			meta: {
290
				accountability: 'all',
291
				collection: 'test_table',
292
				group: null,
293
				hidden: true,
294
				icon: 'import_export',
295
				item_duplication_fields: null,
296
				note: null,
297
				singleton: false,
298
				versioning: false,
299
				translations: {},
300
			},
301
			schema: {
302
				comment: null,
303
				name: 'test_table',
304
				schema: 'public',
305
			},
306
		},
307
		{
308
			collection: 'test_table_2',
309
			meta: {
310
				accountability: 'all',
311
				collection: 'test_table_2',
312
				group: null,
313
				hidden: true,
314
				icon: 'import_export',
315
				item_duplication_fields: null,
316
				note: null,
317
				singleton: false,
318
				versioning: false,
319
				translations: {},
320
			},
321
			schema: {
322
				comment: null,
323
				name: 'test_table_2',
324
				schema: 'public',
325
			},
326
		},
327
	],
328
	fields: [
329
		{
330
			collection: 'test_table',
331
			field: 'id',
332
			meta: {
333
				collection: 'test_table',
334
				conditions: null,
335
				display: null,
336
				display_options: null,
337
				field: 'id',
338
				group: null,
339
				hidden: true,
340
				interface: null,
341
				note: null,
342
				options: null,
343
				readonly: false,
344
				required: false,
345
				sort: null,
346
				special: null,
347
				translations: {},
348
				validation: null,
349
				validation_message: null,
350
				width: 'full',
351
			},
352
			schema: {
353
				comment: null,
354
				data_type: 'uuid',
355
				default_value: null,
356
				foreign_key_column: null,
357
				foreign_key_schema: null,
358
				foreign_key_table: null,
359
				generation_expression: null,
360
				has_auto_increment: false,
361
				is_generated: false,
362
				is_nullable: false,
363
				is_primary_key: true,
364
				is_unique: true,
365
				max_length: null,
366
				name: 'id',
367
				numeric_precision: null,
368
				numeric_scale: null,
369
				schema: 'public',
370
				table: 'test_table',
371
			},
372
			type: 'uuid',
373
		} as SnapshotField,
374
		{
375
			collection: 'test_table_2',
376
			field: 'id',
377
			meta: {
378
				collection: 'test_table_2',
379
				conditions: null,
380
				display: null,
381
				display_options: null,
382
				field: 'id',
383
				group: null,
384
				hidden: true,
385
				interface: null,
386
				note: null,
387
				options: null,
388
				readonly: false,
389
				required: false,
390
				sort: null,
391
				special: null,
392
				translations: {},
393
				validation: null,
394
				validation_message: null,
395
				width: 'full',
396
			},
397
			schema: {
398
				comment: null,
399
				data_type: 'uuid',
400
				default_value: null,
401
				foreign_key_column: null,
402
				foreign_key_schema: null,
403
				foreign_key_table: null,
404
				generation_expression: null,
405
				has_auto_increment: false,
406
				is_generated: false,
407
				is_nullable: false,
408
				is_primary_key: true,
409
				is_unique: true,
410
				max_length: null,
411
				name: 'id',
412
				numeric_precision: null,
413
				numeric_scale: null,
414
				schema: 'public',
415
				table: 'test_table_2',
416
			},
417
			type: 'uuid',
418
		} as SnapshotField,
419
	],
420
	relations: [],
421
};
422

423
export const snapshotBeforeDeleteCollection: Snapshot = {
424
	version: 1,
425
	directus: '0.0.0',
426
	collections: [
427
		{
428
			collection: 'articles',
429
			meta: {
430
				accountability: 'all',
431
				collection: 'articles',
432
				group: null,
433
				hidden: false,
434
				icon: null,
435
				item_duplication_fields: null,
436
				note: null,
437
				singleton: false,
438
				versioning: false,
439
				translations: {},
440
			},
441
			schema: {
442
				comment: null,
443
				name: 'articles',
444
				schema: 'public',
445
			},
446
		},
447
		{
448
			collection: 'articles_translations',
449
			meta: {
450
				accountability: 'all',
451
				collection: 'articles_translations',
452
				group: null,
453
				hidden: true,
454
				icon: 'import_export',
455
				item_duplication_fields: null,
456
				note: null,
457
				singleton: false,
458
				versioning: false,
459
				translations: {},
460
			},
461
			schema: {
462
				comment: null,
463
				name: 'articles_translations',
464
				schema: 'public',
465
			},
466
		},
467
		{
468
			collection: 'languages',
469
			meta: {
470
				accountability: 'all',
471
				collection: 'languages',
472
				group: null,
473
				hidden: false,
474
				icon: null,
475
				item_duplication_fields: null,
476
				note: null,
477
				singleton: false,
478
				versioning: false,
479
				translations: {},
480
			},
481
			schema: {
482
				comment: null,
483
				name: 'languages',
484
				schema: 'public',
485
			},
486
		},
487
	],
488
	fields: [
489
		{
490
			collection: 'articles',
491
			field: 'id',
492
			meta: {
493
				collection: 'articles',
494
				conditions: null,
495
				display: null,
496
				display_options: null,
497
				field: 'id',
498
				group: null,
499
				hidden: true,
500
				interface: 'input',
501
				note: null,
502
				options: null,
503
				readonly: true,
504
				required: false,
505
				sort: null,
506
				special: null,
507
				translations: [],
508
				validation: null,
509
				validation_message: null,
510
				width: 'full',
511
			},
512
			schema: {
513
				comment: null,
514
				data_type: 'integer',
515
				default_value: "nextval('articles_id_seq'::regclass)",
516
				foreign_key_column: null,
517
				foreign_key_schema: null,
518
				foreign_key_table: null,
519
				generation_expression: null,
520
				has_auto_increment: true,
521
				is_generated: false,
522
				is_nullable: false,
523
				is_primary_key: true,
524
				is_unique: true,
525
				max_length: null,
526
				name: 'id',
527
				numeric_precision: 32,
528
				numeric_scale: 0,
529
				schema: 'public',
530
				table: 'articles',
531
			},
532
			type: 'integer',
533
		},
534
		{
535
			collection: 'articles',
536
			field: 'translations',
537
			meta: {
538
				collection: 'articles',
539
				conditions: null,
540
				display: null,
541
				display_options: null,
542
				field: 'translations',
543
				group: null,
544
				hidden: false,
545
				interface: 'translations',
546
				note: null,
547
				options: null,
548
				readonly: false,
549
				required: false,
550
				sort: null,
551
				special: ['translations'],
552
				translations: [],
553
				validation: null,
554
				validation_message: null,
555
				width: 'full',
556
			},
557
			schema: null,
558
			type: 'alias',
559
		},
560
		{
561
			collection: 'articles_translations',
562
			field: 'articles_id',
563
			meta: {
564
				collection: 'articles_translations',
565
				conditions: null,
566
				display: null,
567
				display_options: null,
568
				field: 'articles_id',
569
				group: null,
570
				hidden: true,
571
				interface: null,
572
				note: null,
573
				options: null,
574
				readonly: false,
575
				required: false,
576
				sort: null,
577
				special: null,
578
				translations: [],
579
				validation: null,
580
				validation_message: null,
581
				width: 'full',
582
			},
583
			schema: {
584
				comment: null,
585
				data_type: 'integer',
586
				default_value: null,
587
				foreign_key_column: 'id',
588
				foreign_key_schema: 'public',
589
				foreign_key_table: 'articles',
590
				generation_expression: null,
591
				has_auto_increment: false,
592
				is_generated: false,
593
				is_nullable: true,
594
				is_primary_key: false,
595
				is_unique: false,
596
				max_length: null,
597
				name: 'articles_id',
598
				numeric_precision: 32,
599
				numeric_scale: 0,
600
				schema: 'public',
601
				table: 'articles_translations',
602
			},
603
			type: 'integer',
604
		},
605
		{
606
			collection: 'articles_translations',
607
			field: 'id',
608
			meta: {
609
				collection: 'articles_translations',
610
				conditions: null,
611
				display: null,
612
				display_options: null,
613
				field: 'id',
614
				group: null,
615
				hidden: true,
616
				interface: null,
617
				note: null,
618
				options: null,
619
				readonly: false,
620
				required: false,
621
				sort: null,
622
				special: null,
623
				translations: [],
624
				validation: null,
625
				validation_message: null,
626
				width: 'full',
627
			},
628
			schema: {
629
				comment: null,
630
				data_type: 'integer',
631
				default_value: "nextval('articles_translations_id_seq'::regclass)",
632
				foreign_key_column: null,
633
				foreign_key_schema: null,
634
				foreign_key_table: null,
635
				generation_expression: null,
636
				has_auto_increment: true,
637
				is_generated: false,
638
				is_nullable: false,
639
				is_primary_key: true,
640
				is_unique: true,
641
				max_length: null,
642
				name: 'id',
643
				numeric_precision: 32,
644
				numeric_scale: 0,
645
				schema: 'public',
646
				table: 'articles_translations',
647
			},
648
			type: 'integer',
649
		},
650
		{
651
			collection: 'articles_translations',
652
			field: 'languages_id',
653
			meta: {
654
				collection: 'articles_translations',
655
				conditions: null,
656
				display: null,
657
				display_options: null,
658
				field: 'languages_id',
659
				group: null,
660
				hidden: true,
661
				interface: null,
662
				note: null,
663
				options: null,
664
				readonly: false,
665
				required: false,
666
				sort: null,
667
				special: null,
668
				translations: [],
669
				validation: null,
670
				validation_message: null,
671
				width: 'full',
672
			},
673
			schema: {
674
				comment: null,
675
				data_type: 'character varying',
676
				default_value: null,
677
				foreign_key_column: 'code',
678
				foreign_key_schema: 'public',
679
				foreign_key_table: 'languages',
680
				generation_expression: null,
681
				has_auto_increment: false,
682
				is_generated: false,
683
				is_nullable: true,
684
				is_primary_key: false,
685
				is_unique: false,
686
				max_length: 255,
687
				name: 'languages_id',
688
				numeric_precision: null,
689
				numeric_scale: null,
690
				schema: 'public',
691
				table: 'articles_translations',
692
			},
693
			type: 'string',
694
		},
695
		{
696
			collection: 'languages',
697
			field: 'code',
698
			meta: {
699
				collection: 'languages',
700
				conditions: null,
701
				display: null,
702
				display_options: null,
703
				field: 'code',
704
				group: null,
705
				hidden: false,
706
				interface: null,
707
				note: null,
708
				options: null,
709
				readonly: false,
710
				required: false,
711
				sort: null,
712
				special: null,
713
				translations: [],
714
				validation: null,
715
				validation_message: null,
716
				width: 'full',
717
			},
718
			schema: {
719
				comment: null,
720
				data_type: 'character varying',
721
				default_value: null,
722
				foreign_key_column: null,
723
				foreign_key_schema: null,
724
				foreign_key_table: null,
725
				generation_expression: null,
726
				has_auto_increment: false,
727
				is_generated: false,
728
				is_nullable: false,
729
				is_primary_key: true,
730
				is_unique: true,
731
				max_length: 255,
732
				name: 'code',
733
				numeric_precision: null,
734
				numeric_scale: null,
735
				schema: 'public',
736
				table: 'languages',
737
			},
738
			type: 'string',
739
		},
740
		{
741
			collection: 'languages',
742
			field: 'direction',
743
			meta: {
744
				collection: 'languages',
745
				conditions: null,
746
				display: 'labels',
747
				display_options: {
748
					choices: [
749
						{
750
							text: '$t:left_to_right',
751
							value: 'ltr',
752
						},
753
						{
754
							text: '$t:right_to_left',
755
							value: 'rtl',
756
						},
757
					],
758
					format: false,
759
				},
760
				field: 'direction',
761
				group: null,
762
				hidden: false,
763
				interface: 'select-dropdown',
764
				note: null,
765
				options: {
766
					choices: [
767
						{
768
							text: '$t:left_to_right',
769
							value: 'ltr',
770
						},
771
						{
772
							text: '$t:right_to_left',
773
							value: 'rtl',
774
						},
775
					],
776
				},
777
				readonly: false,
778
				required: false,
779
				sort: null,
780
				special: null,
781
				translations: [],
782
				validation: null,
783
				validation_message: null,
784
				width: 'full',
785
			},
786
			schema: {
787
				comment: null,
788
				data_type: 'character varying',
789
				default_value: 'ltr',
790
				foreign_key_column: null,
791
				foreign_key_schema: null,
792
				foreign_key_table: null,
793
				generation_expression: null,
794
				has_auto_increment: false,
795
				is_generated: false,
796
				is_nullable: true,
797
				is_primary_key: false,
798
				is_unique: false,
799
				max_length: 255,
800
				name: 'direction',
801
				numeric_precision: null,
802
				numeric_scale: null,
803
				schema: 'public',
804
				table: 'languages',
805
			},
806
			type: 'string',
807
		},
808
		{
809
			collection: 'languages',
810
			field: 'name',
811
			meta: {
812
				collection: 'languages',
813
				conditions: null,
814
				display: null,
815
				display_options: null,
816
				field: 'name',
817
				group: null,
818
				hidden: false,
819
				interface: null,
820
				note: null,
821
				options: null,
822
				readonly: false,
823
				required: false,
824
				sort: null,
825
				special: null,
826
				translations: [],
827
				validation: null,
828
				validation_message: null,
829
				width: 'full',
830
			},
831
			schema: {
832
				comment: null,
833
				data_type: 'character varying',
834
				default_value: null,
835
				foreign_key_column: null,
836
				foreign_key_schema: null,
837
				foreign_key_table: null,
838
				generation_expression: null,
839
				has_auto_increment: false,
840
				is_generated: false,
841
				is_nullable: true,
842
				is_primary_key: false,
843
				is_unique: false,
844
				max_length: 255,
845
				name: 'name',
846
				numeric_precision: null,
847
				numeric_scale: null,
848
				schema: 'public',
849
				table: 'languages',
850
			},
851
			type: 'string',
852
		},
853
	] as unknown as SnapshotField[],
854
	relations: [
855
		{
856
			collection: 'articles_translations',
857
			field: 'articles_id',
858
			meta: {
859
				junction_field: 'languages_id',
860
				many_collection: 'articles_translations',
861
				many_field: 'articles_id',
862
				one_allowed_collections: null,
863
				one_collection: 'articles',
864
				one_collection_field: null,
865
				one_deselect_action: 'nullify',
866
				one_field: 'translations',
867
				sort_field: null,
868
			},
869
			related_collection: 'articles',
870
			schema: {
871
				column: 'articles_id',
872
				constraint_name: 'articles_translations_articles_id_foreign',
873
				foreign_key_column: 'id',
874
				foreign_key_schema: 'public',
875
				foreign_key_table: 'articles',
876
				on_delete: 'SET NULL',
877
				on_update: 'NO ACTION',
878
				table: 'articles_translations',
879
			},
880
		},
881
		{
882
			collection: 'articles_translations',
883
			field: 'languages_id',
884
			meta: {
885
				junction_field: 'articles_id',
886
				many_collection: 'articles_translations',
887
				many_field: 'languages_id',
888
				one_allowed_collections: null,
889
				one_collection: 'languages',
890
				one_collection_field: null,
891
				one_deselect_action: 'nullify',
892
				one_field: null,
893
				sort_field: null,
894
			},
895
			related_collection: 'languages',
896
			schema: {
897
				column: 'languages_id',
898
				constraint_name: 'articles_translations_languages_id_foreign',
899
				foreign_key_column: 'code',
900
				foreign_key_schema: 'public',
901
				foreign_key_table: 'languages',
902
				on_delete: 'SET NULL',
903
				on_update: 'NO ACTION',
904
				table: 'articles_translations',
905
			},
906
		},
907
	] as SnapshotRelation[],
908
};
909

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.