Skip to content

Commit 44ce888

Browse files
authored
Merge pull request #1626 from AmazeeLabs/index-for-object_id
Index for object_id field
2 parents c8d090c + 4e61dbe commit 44ce888

File tree

3 files changed

+94
-1
lines changed

3 files changed

+94
-1
lines changed

.vscode/tasks.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "test:unit:all",
6+
"type": "shell",
7+
"command": "devbox run 'pnpm test:unit:all'"
8+
},
9+
{
10+
"label": "test:static:all",
11+
"type": "shell",
12+
"command": "devbox run 'pnpm test:static:all'"
13+
},
14+
{
15+
"label": "build",
16+
"type": "shell",
17+
"command": "devbox run 'pnpm build'"
18+
},
19+
{
20+
"label": "pnpm install",
21+
"type": "shell",
22+
"command": "devbox run 'pnpm i'"
23+
},
24+
{
25+
"label": "clean",
26+
"type": "shell",
27+
"command": "devbox run clean"
28+
}
29+
]
30+
}

devbox.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"scripts": {
1616
"clean": [
1717
"rm -rf node_modules",
18-
"git clean -dxff -e '/_local' -e '/.idea'",
18+
"git clean -dXff -e '/_local' -e '/.idea'",
1919
"find . -type d -empty -delete",
2020
"direnv reload"
2121
]

packages/composer/amazeelabs/silverback_gatsby/silverback_gatsby.install

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ function silverback_gatsby_schema() {
4949
'primary key' => ['id'],
5050
'indexes' => [
5151
'server' => ['server'],
52+
'object_id' => ['object_id'],
5253
],
5354
];
5455

@@ -115,3 +116,65 @@ function silverback_gatsby_update_8001() {
115116
$schema->addIndex($table, $index, $indexFields, $tableSpec);
116117
}
117118
}
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

Comments
 (0)