1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* Implements hook_field_schema().
|
5
|
*/
|
6
|
function commerce_product_reference_field_schema($field) {
|
7
|
if ($field['type'] == 'commerce_product_reference') {
|
8
|
return array(
|
9
|
'columns' => array(
|
10
|
'product_id' => array(
|
11
|
'type' => 'int',
|
12
|
'unsigned' => TRUE,
|
13
|
'not null' => FALSE,
|
14
|
),
|
15
|
),
|
16
|
'indexes' => array(
|
17
|
'product_id' => array('product_id'),
|
18
|
),
|
19
|
'foreign keys' => array(
|
20
|
'product_id' => array(
|
21
|
'table' => 'commerce_product',
|
22
|
'columns' => array('product_id' => 'product_id'),
|
23
|
),
|
24
|
),
|
25
|
);
|
26
|
}
|
27
|
}
|
28
|
|
29
|
/**
|
30
|
* Implements hook_uninstall().
|
31
|
*/
|
32
|
function commerce_product_reference_uninstall() {
|
33
|
// Delete any product reference fields.
|
34
|
module_load_include('module', 'commerce');
|
35
|
commerce_delete_fields('commerce_product_reference');
|
36
|
}
|