forked from fillerwriter/geofield
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgeofield.install
111 lines (103 loc) · 2.85 KB
/
geofield.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
<?php
/**
* @file
* Install, update and uninstall functions for the geofield module.
*/
/**
* Implements hook_field_schema().
*/
function geofield_field_schema($field) {
$schema_callback = 'geofield_backend_default_schema';
/**
* @TODO: Rewrite to use core plugin system.
*/
/*$schema_callback = '';
ctools_include('plugins');
if (isset($field['settings']['backend'])) {
$backend = ctools_get_plugins('geofield', 'geofield_backend', $field['settings']['backend']);
}
else {
$backend = ctools_get_plugins('geofield', 'geofield_backend', 'default');
}
if (!empty($backend['schema'])) {
$schema_callback = $backend['schema'];
} else {
/**
* Edge case, during an update between 7.x-1.x and 7.x-2.x, if ctools is enabled,
* ctools will not see the geofield plugin without manually truncating the cache
* tables. To bypass, we manually seed the $backend array directly if
* $backend['schema'] still isn't declared.
**
module_load_include('inc', 'geofield', 'includes/geofield_backend/default');
$schema_callback = 'geofield_backend_default_schema';
}
$geom_schema = $schema_callback($field);*/
module_load_include('inc', 'geofield', 'includes/geofield_backend/default');
return array(
'columns' => array(
'value' => $schema_callback($field),
/*'value' => array(
'type' => 'blob',
'size' => 'big',
'not null' => FALSE,
),*/
'geo_type' => array(
'type' => 'varchar',
'default' => '',
'length' => 64,
),
'lat' => array(
'type' => 'numeric',
'precision' => 18,
'scale' => 12,
'not null' => FALSE,
),
'lon' => array(
'type' => 'numeric',
'precision' => 18,
'scale' => 12,
'not null' => FALSE,
),
'left' => array(
'type' => 'numeric',
'precision' => 18,
'scale' => 12,
'not null' => FALSE,
),
'top' => array(
'type' => 'numeric',
'precision' => 18,
'scale' => 12,
'not null' => FALSE,
),
'right' => array(
'type' => 'numeric',
'precision' => 18,
'scale' => 12,
'not null' => FALSE,
),
'bottom' => array(
'type' => 'numeric',
'precision' => 18,
'scale' => 12,
'not null' => FALSE,
),
'geohash' => array(
'type' => 'varchar',
'length' => GEOFIELD_GEOHASH_LENGTH,
'not null' => FALSE,
),
),
'indexes' => array(
'lat' => array('lat'),
'lon' => array('lon'),
'top' => array('top'),
'bottom' => array('bottom'),
'left' => array('left'),
'right' => array('right'),
'geohash' => array('geohash'),
'centroid' => array('lat','lon'),
'bbox' => array('top','bottom','left','right'),
),
);
}