forked from DBCDK/ding_campaign
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathding_campaign.install
121 lines (114 loc) · 2.63 KB
/
ding_campaign.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
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
<?php
/**
* @file
* Install, update and uninstall functions for the ding_campaign module.
*/
/**
* Implements hook_schema().
*/
function ding_campaign_schema() {
$schema['ding_campaign'] = array(
'description' => 'Table holding campaign types types for easier access',
'fields' => array(
'id' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'cid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'type' => array(
'type' => 'varchar',
'length' => 128,
),
'weight' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'pane_id' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array('id'),
'indexes' => array(
'cid' => array('cid'),
'weight' => array('weight'),
),
);
$schema['ding_campaign_rules'] = array(
'description' => 'Table for ding campaigns usage',
'fields' => array(
'id' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'default' => 0,
),
'cid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'rule' => array(
'type' => 'varchar',
'length' => 128,
),
'type' => array(
'type' => 'varchar',
'length' => 128,
),
),
'primary key' => array('id'),
'indexes' => array(
'nid' => array('nid'),
'cid' => array('cid'),
'rule' => array('rule'),
'type' => array('type'),
),
);
return $schema;
}
/**
* Implements hook_uninstall().
*/
function ding_campaign_uninstall() {
variable_del('ding_campaign_node_types');
drupal_uninstall_schema('ding_campaign');
}
/**
* Implements hook_update_N().
* Remove column 'theme' from table 'ding_campaign'
*/
function ding_campaign_update_7001(&$sandbox) {
return db_drop_field('ding_campaign', 'theme');
}
/**
* Implements hook_update_N().
* Add pane_id column to table 'ding_campaign'
*/
function ding_campaign_update_7002(&$sandbox) {
return db_add_field('ding_campaign', 'pane_id', array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
));
}
/**
* Implements hook_update_N().
* Remove column 'pane_id' from table 'ding_campaign'
*/
function ding_campaign_update_7003(&$sandbox) {
return db_drop_field('ding_campaign', 'pane_id');
}