-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathentity_boilerplate.install
118 lines (113 loc) · 3.29 KB
/
entity_boilerplate.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
<?php
/**
* @file
* Install, update and uninstall functions for the entity_boilerplate module.
*/
/**
* Implements hook_schema().
*/
function entity_boilerplate_schema() {
$schema = array();
$schema['my_entity'] = array(
'description' => 'The base table for My Entity',
'fields' => array(
'eid' => array(
'description' => 'Primary Key: Identifier for a My Entity.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'type' => array(
'description' => 'The {myentity}.type of this My Entity.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'title' => array(
'description' => 'The title of the My Entity.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'uid' => array(
'description' => 'ID of Drupal user creator.',
'type' => 'int',
'not null' => TRUE,
),
'created' => array(
'description' => 'The Unix timestamp when the My Entity was created.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'changed' => array(
'description' => 'The Unix timestamp when the My Entity was modified.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'description' => array(
'description' => 'The My Entity description.',
'type' => 'text',
),
),
'primary key' => array('eid'),
'indexes' => array(
'type' => array('type'),
),
);
$schema['my_entity_type'] = array(
'description' => 'Stores information about defined My Entity types.',
'fields' => array(
'id' => array(
'type' => 'serial',
'not null' => TRUE,
'description' => 'Primary Key: Unique My Entity type identifier.',
),
'type' => array(
'description' => 'The machine-readable name of this My Entity type.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'label' => array(
'description' => 'The human-readable name of this My Entity type.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'description' => array(
'description' => 'A brief description of this My Entity type.',
'type' => 'text',
'not null' => TRUE,
'size' => 'medium',
'translatable' => TRUE,
),
// Copying columns from entity_exportable_schema_fields.
// See https://www.drupal.org/node/1122812
'status' => array(
'type' => 'int',
'not null' => TRUE,
// Set the default to ENTITY_CUSTOM without using the constant as it is
// not safe to use it at this point.
'default' => 0x01,
'size' => 'tiny',
'description' => 'The exportable status of the entity.',
),
'module' => array(
'description' => 'The name of the providing module if the entity has been defined in code.',
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
),
),
'primary key' => array('id'),
'unique keys' => array(
'type' => array('type'),
),
);
return $schema;
}