/
schema.go
186 lines (182 loc) · 7.26 KB
/
schema.go
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
// Code generated by entc, DO NOT EDIT.
package migrate
import (
"entgo.io/ent/dialect/sql/schema"
"entgo.io/ent/schema/field"
)
var (
// CloudEventsColumns holds the columns for the "cloud_events" table.
CloudEventsColumns = []*schema.Column{
{Name: "id", Type: field.TypeString, Unique: true},
{Name: "namespace", Type: field.TypeString},
{Name: "event", Type: field.TypeJSON},
{Name: "fire", Type: field.TypeTime},
{Name: "created", Type: field.TypeTime},
{Name: "processed", Type: field.TypeBool},
}
// CloudEventsTable holds the schema information for the "cloud_events" table.
CloudEventsTable = &schema.Table{
Name: "cloud_events",
Columns: CloudEventsColumns,
PrimaryKey: []*schema.Column{CloudEventsColumns[0]},
}
// NamespacesColumns holds the columns for the "namespaces" table.
NamespacesColumns = []*schema.Column{
{Name: "id", Type: field.TypeString, Unique: true, Size: 64},
{Name: "created", Type: field.TypeTime},
}
// NamespacesTable holds the schema information for the "namespaces" table.
NamespacesTable = &schema.Table{
Name: "namespaces",
Columns: NamespacesColumns,
PrimaryKey: []*schema.Column{NamespacesColumns[0]},
}
// ServicesColumns holds the columns for the "services" table.
ServicesColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "name", Type: field.TypeString, Unique: true},
{Name: "data", Type: field.TypeString},
}
// ServicesTable holds the schema information for the "services" table.
ServicesTable = &schema.Table{
Name: "services",
Columns: ServicesColumns,
PrimaryKey: []*schema.Column{ServicesColumns[0]},
}
// WorkflowsColumns holds the columns for the "workflows" table.
WorkflowsColumns = []*schema.Column{
{Name: "id", Type: field.TypeUUID},
{Name: "name", Type: field.TypeString},
{Name: "created", Type: field.TypeTime},
{Name: "description", Type: field.TypeString, Nullable: true, Size: 1024, Default: ""},
{Name: "active", Type: field.TypeBool, Default: true},
{Name: "revision", Type: field.TypeInt, Default: 0},
{Name: "workflow", Type: field.TypeBytes},
{Name: "log_to_events", Type: field.TypeString, Nullable: true},
{Name: "namespace_workflows", Type: field.TypeString, Nullable: true, Size: 64},
}
// WorkflowsTable holds the schema information for the "workflows" table.
WorkflowsTable = &schema.Table{
Name: "workflows",
Columns: WorkflowsColumns,
PrimaryKey: []*schema.Column{WorkflowsColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "workflows_namespaces_workflows",
Columns: []*schema.Column{WorkflowsColumns[8]},
RefColumns: []*schema.Column{NamespacesColumns[0]},
OnDelete: schema.SetNull,
},
},
Indexes: []*schema.Index{
{
Name: "workflow_name_namespace_workflows",
Unique: true,
Columns: []*schema.Column{WorkflowsColumns[1], WorkflowsColumns[8]},
},
},
}
// WorkflowEventsColumns holds the columns for the "workflow_events" table.
WorkflowEventsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "events", Type: field.TypeJSON},
{Name: "correlations", Type: field.TypeJSON},
{Name: "signature", Type: field.TypeBytes, Nullable: true},
{Name: "count", Type: field.TypeInt},
{Name: "workflow_wfevents", Type: field.TypeUUID, Nullable: true},
{Name: "workflow_instance_instance", Type: field.TypeInt, Nullable: true},
}
// WorkflowEventsTable holds the schema information for the "workflow_events" table.
WorkflowEventsTable = &schema.Table{
Name: "workflow_events",
Columns: WorkflowEventsColumns,
PrimaryKey: []*schema.Column{WorkflowEventsColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "workflow_events_workflows_wfevents",
Columns: []*schema.Column{WorkflowEventsColumns[5]},
RefColumns: []*schema.Column{WorkflowsColumns[0]},
OnDelete: schema.SetNull,
},
{
Symbol: "workflow_events_workflow_instances_instance",
Columns: []*schema.Column{WorkflowEventsColumns[6]},
RefColumns: []*schema.Column{WorkflowInstancesColumns[0]},
OnDelete: schema.SetNull,
},
},
}
// WorkflowEventsWaitsColumns holds the columns for the "workflow_events_waits" table.
WorkflowEventsWaitsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "events", Type: field.TypeJSON},
{Name: "workflow_events_wfeventswait", Type: field.TypeInt, Nullable: true},
}
// WorkflowEventsWaitsTable holds the schema information for the "workflow_events_waits" table.
WorkflowEventsWaitsTable = &schema.Table{
Name: "workflow_events_waits",
Columns: WorkflowEventsWaitsColumns,
PrimaryKey: []*schema.Column{WorkflowEventsWaitsColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "workflow_events_waits_workflow_events_wfeventswait",
Columns: []*schema.Column{WorkflowEventsWaitsColumns[2]},
RefColumns: []*schema.Column{WorkflowEventsColumns[0]},
OnDelete: schema.SetNull,
},
},
}
// WorkflowInstancesColumns holds the columns for the "workflow_instances" table.
WorkflowInstancesColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "instance_id", Type: field.TypeString, Unique: true},
{Name: "invoked_by", Type: field.TypeString},
{Name: "status", Type: field.TypeString},
{Name: "revision", Type: field.TypeInt},
{Name: "begin_time", Type: field.TypeTime},
{Name: "end_time", Type: field.TypeTime, Nullable: true},
{Name: "flow", Type: field.TypeJSON, Nullable: true},
{Name: "input", Type: field.TypeString},
{Name: "output", Type: field.TypeString, Nullable: true},
{Name: "state_data", Type: field.TypeString, Nullable: true},
{Name: "memory", Type: field.TypeString, Nullable: true},
{Name: "deadline", Type: field.TypeTime, Nullable: true},
{Name: "attempts", Type: field.TypeInt, Nullable: true},
{Name: "error_code", Type: field.TypeString, Nullable: true},
{Name: "error_message", Type: field.TypeString, Nullable: true},
{Name: "state_begin_time", Type: field.TypeTime, Nullable: true},
{Name: "controller", Type: field.TypeString, Nullable: true},
{Name: "workflow_instances", Type: field.TypeUUID, Nullable: true},
}
// WorkflowInstancesTable holds the schema information for the "workflow_instances" table.
WorkflowInstancesTable = &schema.Table{
Name: "workflow_instances",
Columns: WorkflowInstancesColumns,
PrimaryKey: []*schema.Column{WorkflowInstancesColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "workflow_instances_workflows_instances",
Columns: []*schema.Column{WorkflowInstancesColumns[18]},
RefColumns: []*schema.Column{WorkflowsColumns[0]},
OnDelete: schema.SetNull,
},
},
}
// Tables holds all the tables in the schema.
Tables = []*schema.Table{
CloudEventsTable,
NamespacesTable,
ServicesTable,
WorkflowsTable,
WorkflowEventsTable,
WorkflowEventsWaitsTable,
WorkflowInstancesTable,
}
)
func init() {
WorkflowsTable.ForeignKeys[0].RefTable = NamespacesTable
WorkflowEventsTable.ForeignKeys[0].RefTable = WorkflowsTable
WorkflowEventsTable.ForeignKeys[1].RefTable = WorkflowInstancesTable
WorkflowEventsWaitsTable.ForeignKeys[0].RefTable = WorkflowEventsTable
WorkflowInstancesTable.ForeignKeys[0].RefTable = WorkflowsTable
}