-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtripal_hq.install
102 lines (96 loc) · 2.37 KB
/
tripal_hq.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
<?php
/**
* @file
*/
/**
* Implements hook_schema.
*
* @return array
*/
function tripal_hq_schema() {
$schema['tripal_hq_submission'] = [
'description' => 'Store pending user requests to create Tripal content',
'fields' => [
'id' => [
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
],
'uid' => [
'description' => "Drupal user ID of submitter",
'type' => 'int',
'not null' => TRUE,
],
'nid' => [
'description' => "Comments node ID",
'type' => 'int',
'not null' => FALSE,
],
'title' => [
'type' => 'varchar',
'length' => '255',
'not null' => TRUE,
],
'data' => [
'description' => 'serialized entity data.',
'type' => 'blob',
'size' => 'big',
'serialize' => TRUE,
],
'entity_id' => [
'description' => 'Tripal Entity ID. NULL For new create requests.',
'type' => 'int',
'not null' => FALSE,
],
'bundle_id' => [
'description' => 'The bundle id. Foreign key to `tripal_bundle.id`.',
'type' => 'int',
'not null' => TRUE,
],
'status' => [
'description' => 'pending, published, rejected, obsolete',
'type' => 'varchar',
'length' => '60',
'not null' => TRUE,
],
'created_at' => [
'description' => 'Date created',
'type' => 'int',
'size' => 'big',
'not null' => TRUE,
],
'updated_at' => [
'description' => 'Date created',
'type' => 'int',
'size' => 'big',
'not null' => FALSE,
],
],
'primary key' => [
'id',
],
];
return $schema;
}
/**
* Uninstall the module.
*/
function tripal_hq_uninstall() {
if (db_table_exists('tripal_hq_submission')) {
db_drop_table('tripal_hq_submission');
}
}
/**
* Add nid column to tripal_hq_submission table.
*/
function tripal_hq_update_7100() {
if (!db_field_exists('tripal_hq_submission', 'nid')) {
db_add_field(
'tripal_hq_submission', 'nid', [
'description' => "Comments node ID",
'type' => 'int',
'not null' => FALSE,
]
);
}
}