directus
1import type { CollectionsOverview, Relation } from '@directus/types';
2
3export const systemSchema = {
4collections: {
5directus_users: {
6collection: 'directus_users',
7primary: 'id',
8singleton: false,
9note: '$t:directus_collection.directus_users',
10sortField: null,
11accountability: null,
12fields: {
13id: {
14field: 'id',
15defaultValue: null,
16nullable: false,
17generated: false,
18type: 'uuid',
19dbType: 'uuid',
20precision: null,
21scale: null,
22special: [],
23note: null,
24alias: false,
25validation: null,
26},
27name: {
28field: 'name',
29defaultValue: "A User's Name",
30nullable: false,
31generated: false,
32type: 'uuid',
33dbType: 'uuid',
34precision: null,
35scale: null,
36special: [],
37note: null,
38alias: false,
39validation: null,
40},
41items: {
42field: 'items',
43defaultValue: null,
44nullable: true,
45generated: false,
46type: 'alias',
47dbType: null,
48precision: null,
49scale: null,
50special: ['o2m'],
51note: null,
52alias: true,
53validation: null,
54},
55},
56},
57directus_files: {
58collection: 'directus_files',
59primary: 'id',
60singleton: false,
61note: '$t:directus_collection.directus_files',
62sortField: null,
63accountability: null,
64fields: {
65id: {
66field: 'id',
67defaultValue: null,
68nullable: false,
69generated: false,
70type: 'uuid',
71dbType: 'uuid',
72precision: null,
73scale: null,
74special: [],
75note: null,
76alias: false,
77validation: null,
78},
79title: {
80field: 'title',
81defaultValue: "A File's Title",
82nullable: false,
83generated: false,
84type: 'string',
85dbType: 'text',
86precision: null,
87scale: null,
88special: [],
89note: null,
90alias: false,
91validation: null,
92},
93uploaded_by: {
94field: 'uploaded_by',
95defaultValue: null,
96nullable: true,
97generated: false,
98type: 'uuid',
99dbType: 'uuid',
100precision: null,
101scale: null,
102special: [],
103note: null,
104alias: false,
105validation: null,
106},
107},
108},
109} as CollectionsOverview,
110relations: [
111{
112collection: 'directus_files',
113field: 'uploaded_by',
114related_collection: 'directus_users',
115schema: {
116table: 'directus_files',
117column: 'uploaded_by',
118foreign_key_table: 'directus_users',
119foreign_key_column: 'id',
120on_update: 'NO ACTION',
121on_delete: 'NO ACTION',
122constraint_name: null,
123},
124meta: {
125system: true,
126many_collection: 'directus_files',
127many_field: 'uploaded_by',
128one_collection: 'directus_users',
129one_field: 'items',
130one_allowed_collections: null,
131one_collection_field: null,
132one_deselect_action: 'nullify',
133junction_field: null,
134sort_field: null,
135},
136},
137] as Relation[],
138};
139
140export const userSchema = {
141collections: {
142authors: {
143collection: 'authors',
144primary: 'id',
145singleton: false,
146note: 'authors',
147sortField: null,
148accountability: null,
149fields: {
150id: {
151field: 'id',
152defaultValue: null,
153nullable: false,
154generated: false,
155type: 'uuid',
156dbType: 'uuid',
157precision: null,
158scale: null,
159special: [],
160note: null,
161alias: false,
162validation: null,
163},
164name: {
165field: 'name',
166defaultValue: "An Author's Name",
167nullable: false,
168generated: false,
169type: 'uuid',
170dbType: 'uuid',
171precision: null,
172scale: null,
173special: [],
174note: null,
175alias: false,
176validation: null,
177},
178items: {
179field: 'items',
180defaultValue: null,
181nullable: true,
182generated: false,
183type: 'alias',
184dbType: null,
185precision: null,
186scale: null,
187special: ['o2m'],
188note: null,
189alias: true,
190validation: null,
191},
192},
193},
194posts: {
195collection: 'posts',
196primary: 'id',
197singleton: false,
198note: 'posts',
199sortField: null,
200accountability: null,
201fields: {
202id: {
203field: 'id',
204defaultValue: null,
205nullable: false,
206generated: false,
207type: 'uuid',
208dbType: 'uuid',
209precision: null,
210scale: null,
211special: [],
212note: null,
213alias: false,
214validation: null,
215},
216title: {
217field: 'title',
218defaultValue: "A Post's Title",
219nullable: false,
220generated: false,
221type: 'string',
222dbType: 'text',
223precision: null,
224scale: null,
225special: [],
226note: null,
227alias: false,
228validation: null,
229},
230uploaded_by: {
231field: 'uploaded_by',
232defaultValue: null,
233nullable: true,
234generated: false,
235type: 'uuid',
236dbType: 'uuid',
237precision: null,
238scale: null,
239special: [],
240note: null,
241alias: false,
242validation: null,
243},
244},
245},
246} as CollectionsOverview,
247relations: [
248{
249collection: 'posts',
250field: 'uploaded_by',
251related_collection: 'authors',
252schema: {
253table: 'posts',
254column: 'uploaded_by',
255foreign_key_table: 'authors',
256foreign_key_column: 'id',
257on_update: 'NO ACTION',
258on_delete: 'SET NULL',
259constraint_name: null,
260},
261meta: {
262id: 11,
263many_collection: 'posts',
264many_field: 'uploaded_by',
265one_collection: 'authors',
266one_field: 'items',
267one_collection_field: null,
268one_allowed_collections: null,
269junction_field: null,
270sort_field: null,
271one_deselect_action: 'nullify',
272},
273},
274] as Relation[],
275};
276
277export const snapshotApplyTestSchema = {
278collections: {
279test_table: {
280collection: 'test_table',
281primary: 'id',
282singleton: false,
283note: 'test_table',
284sortField: null,
285accountability: 'all',
286fields: {
287id: {
288field: 'id',
289defaultValue: null,
290nullable: false,
291generated: false,
292type: 'uuid',
293dbType: 'uuid',
294precision: null,
295scale: null,
296special: [],
297note: null,
298alias: false,
299validation: null,
300},
301},
302},
303} as CollectionsOverview,
304relations: [] as Relation[],
305};
306