@@ -49,6 +49,7 @@ function silverback_gatsby_schema() {
49
49
'primary key' => ['id'],
50
50
'indexes' => [
51
51
'server' => ['server'],
52
+ 'object_id' => ['object_id'],
52
53
],
53
54
];
54
55
@@ -115,3 +116,65 @@ function silverback_gatsby_update_8001() {
115
116
$schema->addIndex($table, $index, $indexFields, $tableSpec);
116
117
}
117
118
}
119
+
120
+ /**
121
+ * Add index to "object_id" field on the "gatsby_update_log" database table.
122
+ */
123
+ function silverback_gatsby_update_8002() {
124
+ $table = 'gatsby_update_log';
125
+ $tableSpec = [
126
+ 'description' => 'Table that contains logs of all system events.',
127
+ 'fields' => [
128
+ 'id' => [
129
+ 'type' => 'serial',
130
+ 'not null' => TRUE,
131
+ 'description' => 'Primary Key: Unique update id.',
132
+ ],
133
+ 'server' => [
134
+ 'type' => 'varchar_ascii',
135
+ 'length' => 64,
136
+ 'not null' => TRUE,
137
+ 'default' => '',
138
+ 'description' => 'The id of the related GraphQL server.',
139
+ ],
140
+ 'type' => [
141
+ 'type' => 'varchar_ascii',
142
+ 'length' => 64,
143
+ 'not null' => TRUE,
144
+ 'default' => '',
145
+ 'description' => 'The GraphQL type that changed.',
146
+ ],
147
+ 'object_id' => [
148
+ 'type' => 'varchar_ascii',
149
+ 'length' => 64,
150
+ 'not null' => TRUE,
151
+ 'default' => '',
152
+ 'description' => 'The id of the Graph object that changed.',
153
+ ],
154
+ 'uid' => [
155
+ 'type' => 'int',
156
+ 'unsigned' => TRUE,
157
+ 'not null' => TRUE,
158
+ 'default' => 0,
159
+ 'description' => 'The {users}.uid of the user who triggered the update.',
160
+ ],
161
+ 'timestamp' => [
162
+ 'type' => 'int',
163
+ 'not null' => TRUE,
164
+ 'default' => 0,
165
+ 'description' => 'Unix timestamp when the update happened.',
166
+ ],
167
+ ],
168
+ 'primary key' => ['id'],
169
+ 'indexes' => [
170
+ 'server' => ['server'],
171
+ 'object_id' => ['object_id'],
172
+ ],
173
+ ];
174
+ $index = 'object_id';
175
+ $indexFields = ['object_id'];
176
+ $schema = \Drupal::database()->schema();
177
+ if (!$schema->indexExists($table, $index)) {
178
+ $schema->addIndex($table, $index, $indexFields, $tableSpec);
179
+ }
180
+ }
0 commit comments