forked from slashrsm/commerce_custom_product
-
Notifications
You must be signed in to change notification settings - Fork 0
/
commerce_custom_product.install
66 lines (60 loc) · 1.6 KB
/
commerce_custom_product.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
<?php
/**
* @file
* Defines the database schema for customizable product support.
*/
/**
* Implements hook_schema().
*/
function commerce_custom_product_schema() {
$schema = array();
$schema['commerce_product_line_item_type'] = array(
'description' => 'Stores information about custom product line item types.',
'fields' => array(
'type' => array(
'description' => 'The machine-name of the line item type.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
),
'name' => array(
'description' => 'The human-readable name of the line item type.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
),
'primary key' => array('type'),
);
return $schema;
}
/**
* Implements hook_field_schema().
*/
function commerce_custom_product_field_schema($field) {
if ($field['type'] == 'commerce_custom_product_line_item_type_reference') {
return array(
'columns' => array(
'target_id' => array(
'description' => 'Stored ID of line item type being referenced.',
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
),
'use_multi' => array(
'description' => 'One line item instance per product item will be added if 1.',
'type' => 'int',
'size' => 'tiny',
'unsigned' => TRUE,
'not null' => FALSE,
'default' => 0,
),
),
'indexes' => array(
'target_id' => array('target_id'),
),
);
}
}