-
Notifications
You must be signed in to change notification settings - Fork 1
/
nestedbox_core.install
104 lines (98 loc) · 2.77 KB
/
nestedbox_core.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
<?php
/**
* @file
* Create table for typical_entity_example_1.
*/
/**
* Implements hook_schema().
*/
function nestedbox_core_schema() {
$schema = array();
$schema['nestedbox'] = array(
'description' => 'The base table for Nested Box entities.',
'fields' => array(
'nestedbox_id' => array(
'description' => 'The primary identifier.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'admin_title' => array(
'description' => 'Administrative title',
'type' => 'varchar',
'length' => 255,
# 'not null' => TRUE,
),
'type' => array(
'description' => 'Entity bundle.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'uid' => array(
// Note this won't get set by the generic form handlers; but we have
// this anyway to demonstrate the 'set owner' operation.
'description' => 'The {users}.uid who owns this entity.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array('nestedbox_id'),
);
$schema['nestedbox_type'] = array(
'description' => 'Stores information about defined Nested Box types.',
'fields' => array(
'id' => array(
'type' => 'serial',
'not null' => TRUE,
'description' => 'Primary Key: Unique Nested Box type identifier.',
),
'type' => array(
'description' => 'The machine-readable name of this Nested Box type.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'label' => array(
'description' => 'The human-readable name of this Nested Box type.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'weight' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'size' => 'tiny',
'description' => 'The weight of this Nested Box type in relation to others.',
),
'data' => array(
'type' => 'text',
'not null' => FALSE,
'size' => 'big',
'serialize' => TRUE,
'description' => 'A serialized array of additional data related to this Nested Box type.',
),
) + entity_exportable_schema_fields(),
'primary key' => array('id'),
'unique keys' => array(
'type' => array('type'),
),
);
return $schema;
}
/**
* Add table column nestedbox.admin_title, for an administrative title.
*/
function nestedbox_core_update_7100() {
$spec = array(
'description' => 'Administrative title',
'type' => 'varchar',
'length' => 255,
# 'not null' => TRUE,
);
db_add_field('nestedbox', 'admin_title', $spec);
}