-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwordproof.install
More file actions
33 lines (30 loc) · 872 Bytes
/
wordproof.install
File metadata and controls
33 lines (30 loc) · 872 Bytes
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
<?php
/**
* Uninstall the default view mode.
*/
function wordproof_uninstall() {
\Drupal::configFactory()->getEditable('core.entity_view_mode.node.wordproof_content')->delete();
}
/**
* Create timestamp created field and fill empty created values in timestamp.
*/
function wordproof_update_8001() {
$field_spec = [
'type' => 'int',
'unsigned' => TRUE,
'size' => 'normal',
'not null' => TRUE,
'default' => 0,
];
$schema = \Drupal::database()->schema();
$schema->addField('wordproof_timestamp', 'created', $field_spec);
$schema->addIndex('wordproof_timestamp', 'wordproof_timestamp_created', ['created'], [
'fields' => [
'created' => $field_spec,
],
'indexes' => [
'created' => ['created'],
],
]);
\Drupal::database()->query('UPDATE wordproof_timestamp SET created = date_created WHERE created = 0');
}