Commit 8ff9e52c authored by generalredneck's avatar generalredneck

[#1614234] Adding delta field to the database for cardinality > 1

parent e6368a2a
...@@ -34,6 +34,13 @@ function views_natural_sort_schema() { ...@@ -34,6 +34,13 @@ function views_natural_sort_schema() {
'not null' => TRUE, 'not null' => TRUE,
'default' => '', 'default' => '',
), ),
'delta' => array(
'description' => t('The sequence number for this data item, used for multi-value fields'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'content' => array( 'content' => array(
'description' => t('Filtered content used for sorting.'), 'description' => t('Filtered content used for sorting.'),
'type' => 'varchar', 'type' => 'varchar',
...@@ -42,7 +49,7 @@ function views_natural_sort_schema() { ...@@ -42,7 +49,7 @@ function views_natural_sort_schema() {
'default' => '', 'default' => '',
), ),
), ),
'primary key' => array('eid', 'entity_type', 'field'), 'primary key' => array('eid', 'entity_type', 'field', 'delta'),
); );
return $schema; return $schema;
...@@ -100,6 +107,12 @@ function views_natural_sort_update_7001() { ...@@ -100,6 +107,12 @@ function views_natural_sort_update_7001() {
module_load_include('inc', 'views_natural_sort', 'views_natural_sort.admin'); module_load_include('inc', 'views_natural_sort', 'views_natural_sort.admin');
views_natural_sort_rebuild_index_submit(); views_natural_sort_rebuild_index_submit();
} }
/**
* Impliments hook_update_N().
*
* Upgrade the 7.x-1.x table structure to the 7.x-2.x table structure.
*/
function views_natural_sort_update_7200() { function views_natural_sort_update_7200() {
db_drop_primary_key('views_natural_sort'); db_drop_primary_key('views_natural_sort');
db_add_field( db_add_field(
...@@ -113,6 +126,17 @@ function views_natural_sort_update_7200() { ...@@ -113,6 +126,17 @@ function views_natural_sort_update_7200() {
'default' => 'node' 'default' => 'node'
) )
); );
db_add_field(
'views_natural_sort',
'delta',
array(
'description' => t('The sequence number for this data item, used for multi-value fields'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
)
);
db_change_field( db_change_field(
'views_natural_sort', 'views_natural_sort',
'nid', 'nid',
...@@ -124,7 +148,7 @@ function views_natural_sort_update_7200() { ...@@ -124,7 +148,7 @@ function views_natural_sort_update_7200() {
'not null' => TRUE, 'not null' => TRUE,
), ),
array( array(
'primary key' => array('eid', 'entity_type', 'field'), 'primary key' => array('eid', 'entity_type', 'field', 'delta'),
) )
); );
} }
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
*/ */
function views_natural_sort_views_data_alter(&$data) { function views_natural_sort_views_data_alter(&$data) {
// TODO: Add a field and argument handler to support grouping.
$data['node']['title']['sort']['handler'] = 'views_natural_sort_handler_sort'; $data['node']['title']['sort']['handler'] = 'views_natural_sort_handler_sort';
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment