Commit d1dd13bb authored by generalredneck's avatar generalredneck

[#1614234] Changing the database structure to support entities for D7.

parent bdd22710
......@@ -14,12 +14,19 @@ function views_natural_sort_schema() {
$schema['views_natural_sort'] = array(
'description' => t('Compressed titles for natural sorting.'),
'fields' => array(
'nid' => array(
'description' => t('Node id'),
'eid' => array(
'description' => t('Entity id'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'entity_type' => array(
'description' => t('Entity Type'),
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => 'node',
),
'field' => array(
'description' => t('The field name. This will be title or some cck text field, etc.'),
'type' => 'varchar',
......@@ -35,8 +42,7 @@ function views_natural_sort_schema() {
'default' => '',
),
),
'key' => array('nid', 'field', 'content'),
'primary key' => array('nid', 'field'),
'primary key' => array('eid', 'entity_type', 'field'),
);
return $schema;
......@@ -94,3 +100,31 @@ function views_natural_sort_update_7001() {
module_load_include('inc', 'views_natural_sort', 'views_natural_sort.admin');
views_natural_sort_rebuild_index_submit();
}
function views_natural_sort_update_7200() {
db_drop_primary_key('views_natural_sort');
db_add_field(
'views_natural_sort',
'entity_type',
array(
'description' => t('Entity Type'),
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => 'node'
)
);
db_change_field(
'views_natural_sort',
'nid',
'eid',
array(
'description' => t('Entity id'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
array(
'primary key' => array('eid', 'entity_type', 'field'),
)
);
}
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