-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathexample.surql
138 lines (99 loc) · 4.82 KB
/
example.surql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
-- Export generated by Surrealist on 2023-09-15T11:47:25.689Z
-- ------------------------------
-- OPTION OPTION IMPORT;
-- ------------------------------
-- ------------------------------
-- TABLE: command
-- ------------------------------
DEFINE TABLE command SCHEMAFULL;
DEFINE FIELD createdAt ON command TYPE datetime DEFAULT time::now();
DEFINE FIELD deprecated ON command TYPE bool DEFAULT false;
DEFINE FIELD description ON command TYPE string;
DEFINE FIELD eventName ON command TYPE option<string>;
DEFINE FIELD inputSchema ON command TYPE option<object>;
DEFINE FIELD markdown ON command TYPE option<string>;
DEFINE FIELD name ON command TYPE string;
DEFINE FIELD outputSchema ON command TYPE option<object>;
DEFINE FIELD parameterSchema ON command TYPE option<object>;
DEFINE FIELD updatedAt ON command TYPE datetime DEFAULT time::now() VALUE $value OR time::now();
-- ------------------------------
-- TABLE: commandEndpoints
-- ------------------------------
DEFINE TABLE commandEndpoints SCHEMALESS;
DEFINE FIELD in ON commandEndpoints TYPE record<command>;
DEFINE FIELD out ON commandEndpoints TYPE record<restEndpoint>;
-- ------------------------------
-- TABLE: project
-- ------------------------------
DEFINE TABLE project SCHEMALESS;
DEFINE FIELD createdAt ON project TYPE datetime DEFAULT time::now();
DEFINE FIELD description ON project TYPE string DEFAULT '';
DEFINE FIELD logo ON project TYPE option<string>;
DEFINE FIELD markdown ON project TYPE string DEFAULT '';
DEFINE FIELD name ON project TYPE string;
DEFINE FIELD updatedAt ON project TYPE datetime DEFAULT time::now() VALUE $value OR time::now();
-- ------------------------------
-- TABLE: projectServices
-- ------------------------------
DEFINE TABLE projectServices SCHEMALESS;
DEFINE FIELD in ON projectServices TYPE record<project>;
DEFINE FIELD out ON projectServices TYPE record<service>;
DEFINE INDEX uniqueProjectServicesIndex ON projectServices FIELDS in, out UNIQUE;
-- ------------------------------
-- TABLE: restEndpoint
-- ------------------------------
DEFINE TABLE restEndpoint SCHEMALESS;
DEFINE FIELD method ON restEndpoint TYPE string;
DEFINE FIELD urlPath ON restEndpoint TYPE string;
-- ------------------------------
-- TABLE: service
-- ------------------------------
DEFINE TABLE service SCHEMALESS;
DEFINE FIELD configSchema ON service TYPE option<object>;
DEFINE FIELD createdAt ON service TYPE datetime DEFAULT time::now();
DEFINE FIELD deprecated ON service TYPE bool DEFAULT false;
DEFINE FIELD description ON service TYPE string;
DEFINE FIELD markdown ON service TYPE option<string>;
DEFINE FIELD name ON service TYPE string;
DEFINE FIELD repository ON service TYPE option<string>;
DEFINE FIELD updatedAt ON service TYPE datetime DEFAULT time::now() VALUE $value OR time::now();
DEFINE FIELD version ON service TYPE string;
-- ------------------------------
-- TABLE: serviceCommands
-- ------------------------------
DEFINE TABLE serviceCommands SCHEMALESS;
DEFINE FIELD in ON serviceCommands TYPE record<service>;
DEFINE FIELD out ON serviceCommands TYPE record<command>;
DEFINE INDEX uniqueServiceCommandsIndex ON serviceCommands FIELDS in, out UNIQUE;
-- ------------------------------
-- TABLE: serviceSubscriptions
-- ------------------------------
DEFINE TABLE serviceSubscriptions SCHEMALESS;
DEFINE FIELD in ON serviceSubscriptions TYPE record<service>;
DEFINE FIELD out ON serviceSubscriptions TYPE record<subscription>;
-- ------------------------------
-- TABLE: subscription
-- ------------------------------
DEFINE TABLE subscription SCHEMALESS;
DEFINE FIELD createdAt ON subscription TYPE datetime DEFAULT time::now();
DEFINE FIELD deprecated ON subscription TYPE bool DEFAULT false;
DEFINE FIELD description ON subscription TYPE string;
DEFINE FIELD eventName ON subscription TYPE option<string>;
DEFINE FIELD inputSchema ON subscription TYPE option<object>;
DEFINE FIELD markdown ON subscription TYPE option<string>;
DEFINE FIELD name ON subscription TYPE string;
DEFINE FIELD outputSchema ON subscription TYPE option<object>;
DEFINE FIELD parameterSchema ON subscription TYPE option<object>;
DEFINE FIELD restApi ON subscription TYPE option<object>;
DEFINE FIELD updatedAt ON subscription TYPE datetime DEFAULT time::now() VALUE $value OR time::now();
DEFINE TABLE testcollection SCHEMAFULL;
-- Give the user table an email field. Store it in a string
DEFINE FIELD email ON TABLE testcollection TYPE string
-- Check if the value is a properly formatted email address
ASSERT string::is::email($value);
DEFINE TABLE book SCHEMAFULL;
DEFINE FIELD vendors ON TABLE book TYPE array<object> DEFAULT [];
DEFINE FIELD vendors[*].name ON TABLE book TYPE string;
DEFINE FIELD vendors[*].price ON TABLE book TYPE number;
DEFINE FIELD vendors[*].ratings ON TABLE book TYPE array<object> DEFAULT [];
DEFINE FIELD vendors[*].ratings[*].score ON TABLE book TYPE number DEFAULT 0;