directus
1import type { Snapshot, SnapshotField, SnapshotRelation } from '../types/index.js';
2
3export const snapshotBeforeCreateCollection: Snapshot = {
4version: 1,
5directus: '0.0.0',
6collections: [
7{
8collection: 'test_table',
9meta: {
10accountability: 'all',
11collection: 'test_table',
12group: null,
13hidden: true,
14icon: 'import_export',
15item_duplication_fields: null,
16note: null,
17singleton: false,
18versioning: false,
19translations: {},
20},
21schema: {
22comment: null,
23name: 'test_table',
24schema: 'public',
25},
26},
27],
28fields: [
29{
30collection: 'test_table',
31field: 'id',
32meta: {
33collection: 'test_table',
34conditions: null,
35display: null,
36display_options: null,
37field: 'id',
38group: null,
39hidden: true,
40interface: null,
41note: null,
42options: null,
43readonly: false,
44required: false,
45sort: null,
46special: null,
47translations: {},
48validation: null,
49validation_message: null,
50width: 'full',
51},
52schema: {
53comment: null,
54data_type: 'uuid',
55default_value: null,
56foreign_key_column: null,
57foreign_key_schema: null,
58foreign_key_table: null,
59generation_expression: null,
60has_auto_increment: false,
61is_generated: false,
62is_nullable: false,
63is_primary_key: true,
64is_unique: true,
65max_length: null,
66name: 'id',
67numeric_precision: null,
68numeric_scale: null,
69schema: 'public',
70table: 'test_table',
71},
72type: 'uuid',
73} as SnapshotField,
74],
75relations: [],
76};
77
78export const snapshotCreateCollection: Snapshot = {
79version: 1,
80directus: '0.0.0',
81collections: [
82{
83collection: 'test_table',
84meta: {
85accountability: 'all',
86collection: 'test_table',
87group: null,
88hidden: true,
89icon: 'import_export',
90item_duplication_fields: null,
91note: null,
92singleton: false,
93versioning: false,
94translations: {},
95},
96schema: {
97comment: null,
98name: 'test_table',
99schema: 'public',
100},
101},
102{
103collection: 'test_table_2',
104meta: {
105accountability: 'all',
106collection: 'test_table_2',
107group: 'test_table',
108hidden: true,
109icon: 'import_export',
110item_duplication_fields: null,
111note: null,
112singleton: false,
113versioning: false,
114translations: {},
115},
116schema: {
117comment: null,
118name: 'test_table_2',
119schema: 'public',
120},
121},
122{
123collection: 'test_table_3',
124meta: {
125accountability: 'all',
126collection: 'test_table_3',
127group: 'test_table_2',
128hidden: true,
129icon: 'import_export',
130item_duplication_fields: null,
131note: null,
132singleton: false,
133versioning: false,
134translations: {},
135},
136schema: {
137comment: null,
138name: 'test_table_3',
139schema: 'public',
140},
141},
142],
143fields: [
144{
145collection: 'test_table',
146field: 'id',
147meta: {
148collection: 'test_table',
149conditions: null,
150display: null,
151display_options: null,
152field: 'id',
153group: null,
154hidden: true,
155interface: null,
156note: null,
157options: null,
158readonly: false,
159required: false,
160sort: null,
161special: null,
162translations: {},
163validation: null,
164validation_message: null,
165width: 'full',
166},
167schema: {
168comment: null,
169data_type: 'uuid',
170default_value: null,
171foreign_key_column: null,
172foreign_key_schema: null,
173foreign_key_table: null,
174generation_expression: null,
175has_auto_increment: false,
176is_generated: false,
177is_nullable: false,
178is_primary_key: true,
179is_unique: true,
180max_length: null,
181name: 'id',
182numeric_precision: null,
183numeric_scale: null,
184schema: 'public',
185table: 'test_table',
186},
187type: 'uuid',
188} as SnapshotField,
189{
190collection: 'test_table_2',
191field: 'id',
192meta: {
193collection: 'test_table_2',
194conditions: null,
195display: null,
196display_options: null,
197field: 'id',
198group: null,
199hidden: true,
200interface: null,
201note: null,
202options: null,
203readonly: false,
204required: false,
205sort: null,
206special: null,
207translations: {},
208validation: null,
209validation_message: null,
210width: 'full',
211},
212schema: {
213comment: null,
214data_type: 'uuid',
215default_value: null,
216foreign_key_column: null,
217foreign_key_schema: null,
218foreign_key_table: null,
219generation_expression: null,
220has_auto_increment: false,
221is_generated: false,
222is_nullable: false,
223is_primary_key: true,
224is_unique: true,
225max_length: null,
226name: 'id',
227numeric_precision: null,
228numeric_scale: null,
229schema: 'public',
230table: 'test_table_2',
231},
232type: 'uuid',
233} as SnapshotField,
234{
235collection: 'test_table_3',
236field: 'id',
237meta: {
238collection: 'test_table_3',
239conditions: null,
240display: null,
241display_options: null,
242field: 'id',
243group: null,
244hidden: true,
245interface: null,
246note: null,
247options: null,
248readonly: false,
249required: false,
250sort: null,
251special: null,
252translations: {},
253validation: null,
254validation_message: null,
255width: 'full',
256},
257schema: {
258comment: null,
259data_type: 'uuid',
260default_value: null,
261foreign_key_column: null,
262foreign_key_schema: null,
263foreign_key_table: null,
264generation_expression: null,
265has_auto_increment: false,
266is_generated: false,
267is_nullable: false,
268is_primary_key: true,
269is_unique: true,
270max_length: null,
271name: 'id',
272numeric_precision: null,
273numeric_scale: null,
274schema: 'public',
275table: 'test_table_3',
276},
277type: 'uuid',
278} as SnapshotField,
279],
280relations: [],
281};
282
283export const snapshotCreateCollectionNotNested: Snapshot = {
284version: 1,
285directus: '0.0.0',
286collections: [
287{
288collection: 'test_table',
289meta: {
290accountability: 'all',
291collection: 'test_table',
292group: null,
293hidden: true,
294icon: 'import_export',
295item_duplication_fields: null,
296note: null,
297singleton: false,
298versioning: false,
299translations: {},
300},
301schema: {
302comment: null,
303name: 'test_table',
304schema: 'public',
305},
306},
307{
308collection: 'test_table_2',
309meta: {
310accountability: 'all',
311collection: 'test_table_2',
312group: null,
313hidden: true,
314icon: 'import_export',
315item_duplication_fields: null,
316note: null,
317singleton: false,
318versioning: false,
319translations: {},
320},
321schema: {
322comment: null,
323name: 'test_table_2',
324schema: 'public',
325},
326},
327],
328fields: [
329{
330collection: 'test_table',
331field: 'id',
332meta: {
333collection: 'test_table',
334conditions: null,
335display: null,
336display_options: null,
337field: 'id',
338group: null,
339hidden: true,
340interface: null,
341note: null,
342options: null,
343readonly: false,
344required: false,
345sort: null,
346special: null,
347translations: {},
348validation: null,
349validation_message: null,
350width: 'full',
351},
352schema: {
353comment: null,
354data_type: 'uuid',
355default_value: null,
356foreign_key_column: null,
357foreign_key_schema: null,
358foreign_key_table: null,
359generation_expression: null,
360has_auto_increment: false,
361is_generated: false,
362is_nullable: false,
363is_primary_key: true,
364is_unique: true,
365max_length: null,
366name: 'id',
367numeric_precision: null,
368numeric_scale: null,
369schema: 'public',
370table: 'test_table',
371},
372type: 'uuid',
373} as SnapshotField,
374{
375collection: 'test_table_2',
376field: 'id',
377meta: {
378collection: 'test_table_2',
379conditions: null,
380display: null,
381display_options: null,
382field: 'id',
383group: null,
384hidden: true,
385interface: null,
386note: null,
387options: null,
388readonly: false,
389required: false,
390sort: null,
391special: null,
392translations: {},
393validation: null,
394validation_message: null,
395width: 'full',
396},
397schema: {
398comment: null,
399data_type: 'uuid',
400default_value: null,
401foreign_key_column: null,
402foreign_key_schema: null,
403foreign_key_table: null,
404generation_expression: null,
405has_auto_increment: false,
406is_generated: false,
407is_nullable: false,
408is_primary_key: true,
409is_unique: true,
410max_length: null,
411name: 'id',
412numeric_precision: null,
413numeric_scale: null,
414schema: 'public',
415table: 'test_table_2',
416},
417type: 'uuid',
418} as SnapshotField,
419],
420relations: [],
421};
422
423export const snapshotBeforeDeleteCollection: Snapshot = {
424version: 1,
425directus: '0.0.0',
426collections: [
427{
428collection: 'articles',
429meta: {
430accountability: 'all',
431collection: 'articles',
432group: null,
433hidden: false,
434icon: null,
435item_duplication_fields: null,
436note: null,
437singleton: false,
438versioning: false,
439translations: {},
440},
441schema: {
442comment: null,
443name: 'articles',
444schema: 'public',
445},
446},
447{
448collection: 'articles_translations',
449meta: {
450accountability: 'all',
451collection: 'articles_translations',
452group: null,
453hidden: true,
454icon: 'import_export',
455item_duplication_fields: null,
456note: null,
457singleton: false,
458versioning: false,
459translations: {},
460},
461schema: {
462comment: null,
463name: 'articles_translations',
464schema: 'public',
465},
466},
467{
468collection: 'languages',
469meta: {
470accountability: 'all',
471collection: 'languages',
472group: null,
473hidden: false,
474icon: null,
475item_duplication_fields: null,
476note: null,
477singleton: false,
478versioning: false,
479translations: {},
480},
481schema: {
482comment: null,
483name: 'languages',
484schema: 'public',
485},
486},
487],
488fields: [
489{
490collection: 'articles',
491field: 'id',
492meta: {
493collection: 'articles',
494conditions: null,
495display: null,
496display_options: null,
497field: 'id',
498group: null,
499hidden: true,
500interface: 'input',
501note: null,
502options: null,
503readonly: true,
504required: false,
505sort: null,
506special: null,
507translations: [],
508validation: null,
509validation_message: null,
510width: 'full',
511},
512schema: {
513comment: null,
514data_type: 'integer',
515default_value: "nextval('articles_id_seq'::regclass)",
516foreign_key_column: null,
517foreign_key_schema: null,
518foreign_key_table: null,
519generation_expression: null,
520has_auto_increment: true,
521is_generated: false,
522is_nullable: false,
523is_primary_key: true,
524is_unique: true,
525max_length: null,
526name: 'id',
527numeric_precision: 32,
528numeric_scale: 0,
529schema: 'public',
530table: 'articles',
531},
532type: 'integer',
533},
534{
535collection: 'articles',
536field: 'translations',
537meta: {
538collection: 'articles',
539conditions: null,
540display: null,
541display_options: null,
542field: 'translations',
543group: null,
544hidden: false,
545interface: 'translations',
546note: null,
547options: null,
548readonly: false,
549required: false,
550sort: null,
551special: ['translations'],
552translations: [],
553validation: null,
554validation_message: null,
555width: 'full',
556},
557schema: null,
558type: 'alias',
559},
560{
561collection: 'articles_translations',
562field: 'articles_id',
563meta: {
564collection: 'articles_translations',
565conditions: null,
566display: null,
567display_options: null,
568field: 'articles_id',
569group: null,
570hidden: true,
571interface: null,
572note: null,
573options: null,
574readonly: false,
575required: false,
576sort: null,
577special: null,
578translations: [],
579validation: null,
580validation_message: null,
581width: 'full',
582},
583schema: {
584comment: null,
585data_type: 'integer',
586default_value: null,
587foreign_key_column: 'id',
588foreign_key_schema: 'public',
589foreign_key_table: 'articles',
590generation_expression: null,
591has_auto_increment: false,
592is_generated: false,
593is_nullable: true,
594is_primary_key: false,
595is_unique: false,
596max_length: null,
597name: 'articles_id',
598numeric_precision: 32,
599numeric_scale: 0,
600schema: 'public',
601table: 'articles_translations',
602},
603type: 'integer',
604},
605{
606collection: 'articles_translations',
607field: 'id',
608meta: {
609collection: 'articles_translations',
610conditions: null,
611display: null,
612display_options: null,
613field: 'id',
614group: null,
615hidden: true,
616interface: null,
617note: null,
618options: null,
619readonly: false,
620required: false,
621sort: null,
622special: null,
623translations: [],
624validation: null,
625validation_message: null,
626width: 'full',
627},
628schema: {
629comment: null,
630data_type: 'integer',
631default_value: "nextval('articles_translations_id_seq'::regclass)",
632foreign_key_column: null,
633foreign_key_schema: null,
634foreign_key_table: null,
635generation_expression: null,
636has_auto_increment: true,
637is_generated: false,
638is_nullable: false,
639is_primary_key: true,
640is_unique: true,
641max_length: null,
642name: 'id',
643numeric_precision: 32,
644numeric_scale: 0,
645schema: 'public',
646table: 'articles_translations',
647},
648type: 'integer',
649},
650{
651collection: 'articles_translations',
652field: 'languages_id',
653meta: {
654collection: 'articles_translations',
655conditions: null,
656display: null,
657display_options: null,
658field: 'languages_id',
659group: null,
660hidden: true,
661interface: null,
662note: null,
663options: null,
664readonly: false,
665required: false,
666sort: null,
667special: null,
668translations: [],
669validation: null,
670validation_message: null,
671width: 'full',
672},
673schema: {
674comment: null,
675data_type: 'character varying',
676default_value: null,
677foreign_key_column: 'code',
678foreign_key_schema: 'public',
679foreign_key_table: 'languages',
680generation_expression: null,
681has_auto_increment: false,
682is_generated: false,
683is_nullable: true,
684is_primary_key: false,
685is_unique: false,
686max_length: 255,
687name: 'languages_id',
688numeric_precision: null,
689numeric_scale: null,
690schema: 'public',
691table: 'articles_translations',
692},
693type: 'string',
694},
695{
696collection: 'languages',
697field: 'code',
698meta: {
699collection: 'languages',
700conditions: null,
701display: null,
702display_options: null,
703field: 'code',
704group: null,
705hidden: false,
706interface: null,
707note: null,
708options: null,
709readonly: false,
710required: false,
711sort: null,
712special: null,
713translations: [],
714validation: null,
715validation_message: null,
716width: 'full',
717},
718schema: {
719comment: null,
720data_type: 'character varying',
721default_value: null,
722foreign_key_column: null,
723foreign_key_schema: null,
724foreign_key_table: null,
725generation_expression: null,
726has_auto_increment: false,
727is_generated: false,
728is_nullable: false,
729is_primary_key: true,
730is_unique: true,
731max_length: 255,
732name: 'code',
733numeric_precision: null,
734numeric_scale: null,
735schema: 'public',
736table: 'languages',
737},
738type: 'string',
739},
740{
741collection: 'languages',
742field: 'direction',
743meta: {
744collection: 'languages',
745conditions: null,
746display: 'labels',
747display_options: {
748choices: [
749{
750text: '$t:left_to_right',
751value: 'ltr',
752},
753{
754text: '$t:right_to_left',
755value: 'rtl',
756},
757],
758format: false,
759},
760field: 'direction',
761group: null,
762hidden: false,
763interface: 'select-dropdown',
764note: null,
765options: {
766choices: [
767{
768text: '$t:left_to_right',
769value: 'ltr',
770},
771{
772text: '$t:right_to_left',
773value: 'rtl',
774},
775],
776},
777readonly: false,
778required: false,
779sort: null,
780special: null,
781translations: [],
782validation: null,
783validation_message: null,
784width: 'full',
785},
786schema: {
787comment: null,
788data_type: 'character varying',
789default_value: 'ltr',
790foreign_key_column: null,
791foreign_key_schema: null,
792foreign_key_table: null,
793generation_expression: null,
794has_auto_increment: false,
795is_generated: false,
796is_nullable: true,
797is_primary_key: false,
798is_unique: false,
799max_length: 255,
800name: 'direction',
801numeric_precision: null,
802numeric_scale: null,
803schema: 'public',
804table: 'languages',
805},
806type: 'string',
807},
808{
809collection: 'languages',
810field: 'name',
811meta: {
812collection: 'languages',
813conditions: null,
814display: null,
815display_options: null,
816field: 'name',
817group: null,
818hidden: false,
819interface: null,
820note: null,
821options: null,
822readonly: false,
823required: false,
824sort: null,
825special: null,
826translations: [],
827validation: null,
828validation_message: null,
829width: 'full',
830},
831schema: {
832comment: null,
833data_type: 'character varying',
834default_value: null,
835foreign_key_column: null,
836foreign_key_schema: null,
837foreign_key_table: null,
838generation_expression: null,
839has_auto_increment: false,
840is_generated: false,
841is_nullable: true,
842is_primary_key: false,
843is_unique: false,
844max_length: 255,
845name: 'name',
846numeric_precision: null,
847numeric_scale: null,
848schema: 'public',
849table: 'languages',
850},
851type: 'string',
852},
853] as unknown as SnapshotField[],
854relations: [
855{
856collection: 'articles_translations',
857field: 'articles_id',
858meta: {
859junction_field: 'languages_id',
860many_collection: 'articles_translations',
861many_field: 'articles_id',
862one_allowed_collections: null,
863one_collection: 'articles',
864one_collection_field: null,
865one_deselect_action: 'nullify',
866one_field: 'translations',
867sort_field: null,
868},
869related_collection: 'articles',
870schema: {
871column: 'articles_id',
872constraint_name: 'articles_translations_articles_id_foreign',
873foreign_key_column: 'id',
874foreign_key_schema: 'public',
875foreign_key_table: 'articles',
876on_delete: 'SET NULL',
877on_update: 'NO ACTION',
878table: 'articles_translations',
879},
880},
881{
882collection: 'articles_translations',
883field: 'languages_id',
884meta: {
885junction_field: 'articles_id',
886many_collection: 'articles_translations',
887many_field: 'languages_id',
888one_allowed_collections: null,
889one_collection: 'languages',
890one_collection_field: null,
891one_deselect_action: 'nullify',
892one_field: null,
893sort_field: null,
894},
895related_collection: 'languages',
896schema: {
897column: 'languages_id',
898constraint_name: 'articles_translations_languages_id_foreign',
899foreign_key_column: 'code',
900foreign_key_schema: 'public',
901foreign_key_table: 'languages',
902on_delete: 'SET NULL',
903on_update: 'NO ACTION',
904table: 'articles_translations',
905},
906},
907] as SnapshotRelation[],
908};
909