forked from SeeWatson/views_redirect_relationship
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathviews_redirect_relationship.install
51 lines (45 loc) · 1.17 KB
/
views_redirect_relationship.install
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
<?php
/**
* @file
* Contains install and update functions for views_redirect_relationship.
*
* Creates/deletes redirect database field for nid & updates db schema.
*/
/**
* Implements hook_enable().
*
* Create a database field `nid` in the redirects table and
* updates the database schema.
*/
function views_redirect_relationship_enable() {
$schema = drupal_get_schema('redirect');
if ($schema) {
db_add_field('redirect', 'nid', $schema['fields']['nid']);
}
views_redirect_relationship_generate_all();
}
/**
* Implements hook_disable().
*
* Drops the database field and updates the database schema.
*/
function views_redirect_relationship_disable() {
$schema = drupal_get_schema('redirect');
if ($schema) {
db_drop_field('redirect', 'nid', $schema['fields']['nid']);
}
}
/**
* Implements hook_schema_alter().
*/
function views_redirect_relationship_schema_alter(&$schema) {
if (isset($schema['redirect'])) {
$schema['redirect']['fields']['nid'] = array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'The {node}.nid of the node that the redirect points to.',
);
}
}